Skip to main content

Contract-first integration tooling for Django REST framework and Angular Material.

Project description

django-angular3

django-angular3 enables seamless integration of Django, Django REST Framework (DRF), and Angular — giving teams a contract-first, automation-ready bridge between a DRF backend and an Angular Material frontend.

Project website: https://djangoangular.com/

Documentation: https://django-angular3.readthedocs.io/

Related docs:

  • doc/ARCHITECTURE.md — architecture, integration boundaries, and design decisions
  • TODO.md — implementation sequencing, delivery roadmap, and open items

It allows you to:

  • Keep Django responsible for data, authentication, and administration.
  • Keep Angular responsible for the end-user application and client-side route tree.
  • Use OpenAPI as the source of truth for CRM-facing functionality.
  • Support bespoke non-CRM pages, reactive forms, and workflows via a separate structured input source.
  • Automate the handoff from backend API contract to Angular integration artifacts through a deterministic, repeatable pipeline.

Requirements

See doc/REQUIREMENTS.md for the full requirements.

Installation

pip install django-angular3

To install from a local clone:

pip install -e /path/to/django-angular3/

Django app integration

If you install django-angular3 into a Django project, add the app to INSTALLED_APPS to enable the bundled ng_ management commands.

INSTALLED_APPS = [
    # ...
    "django_angular3",
]

Or use the explicit app config path:

INSTALLED_APPS = [
    # ...
    "django_angular3.apps.DjangoAngular3Config",
]

The specialized Node/Angular tool settings live in django_angular3/settings.py and are configured through DJANGO_ANGULAR3 in your Django project's settings.py. Only set the values you want to override; the example below shows the full supported settings surface, including an optional config_path override:

DJANGO_ANGULAR3 = {
    "config_path": "django-angular3.json",
    "ng_executable": "ng",
    "pnpm_executable": "pnpm",
    "node_executable": "node",
    "command_allowlist": ["ng_openapi_gen"],
    "package_manager": "pnpm",
    "build_configuration": "production",
    "style": "scss",
    "routing": True,
}

The current settings surface and defaults are:

  • config_path: "django-angular3.json" - default project config path used when a CLI or management command path is omitted
  • node_executable: "node"
  • pnpm_executable: "pnpm"
  • ng_executable: "ng"
  • command_allowlist: ("ng_openapi_gen",)
  • package_manager: "pnpm"
  • build_configuration: "production"
  • style: "scss"
  • routing: True

Legacy npm_executable and npx_executable overrides are still accepted and mapped to pnpm_executable for compatibility with older settings modules. Commands are only executed when the resolved django-angular3 command name is in command_allowlist. The default allowlist only permits ng_openapi_gen.

Once installed, Django and the standalone CLI expose the same Angular command resolution flow:

./manage.py ng_new django-angular3.json --dry-run
./manage.py ng_workspace django-angular3.json --dry-run
./manage.py ng_config django-angular3.json --dry-run
./manage.py ng_add django-angular3.json --dry-run
./manage.py ng_gen_app django-angular3.json --dry-run
./manage.py ng_openapi_gen django-angular3.json --dry-run
./manage.py ng_build django-angular3.json --dry-run
  • ng_new creates an empty Angular workspace
  • ng_workspace runs the upstream-aligned workspace bootstrap flow: ng new, workspace defaults, ng add angular-django2, and ng generate angular-django2:ng-workspace
  • ng_config applies workspace defaults such as package manager, style, and routing
  • ng_add installs and registers the configured Angular schematic package
  • ng_gen_app generates an Angular application inside the configured workspace
  • ng_openapi_gen runs a locally installed ng-openapi-gen for the configured OpenAPI source

ng_openapi_gen resolves to pnpm exec, so it only uses dependencies that are already installed in the Angular workspace. It does not download and execute packages at runtime.

  • ng_build builds the configured Angular application

Naming note: The ng_* command names (e.g. ng_workspace, ng_openapi_gen) are the frozen CLI wrapper layer — stable entry points that never change. The automation subsystem uses two separate layers with distinct names: TOOL contracts are deterministic agent-callable operations (e.g. angular_workspace_scaffold, openapi_schema_export) and SKILL names are AI-guided session identifiers (e.g. angular-workspace-foundation, angular-api-integration). See doc/ARCHITECTURE.md §2.23 for the authoritative definition.

If you want these commands to execute instead of only dry-run, configure the command allowlist to include the django-angular3 commands you want to permit.

Use --app-name <name> with ng_gen_app to override the generated Angular application name.

At the moment this reusable Django app contributes configuration helpers and management commands; it does not yet ship models, URLs, templates, static assets, or migrations, so there is no extra URL inclusion or migration step for the package itself.

Example

Let's take a look at a simple example of starting from Django REST framework and then layering Angular Material integration on top.

Start by creating a DRF-backed project in the usual way:

pip install djangorestframework
django-admin startproject mysite .
./manage.py migrate
./manage.py createsuperuser

Now edit your project's urls.py module:

from django.contrib.auth.models import User
from django.urls import include, path
from rest_framework import routers, serializers, viewsets


# Serializers define the API representation.
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ["url", "username", "email", "is_staff"]


# ViewSets define the view behavior.
class UserViewSet(viewsets.ModelViewSet):
    queryset = User.objects.all()
    serializer_class = UserSerializer


# Routers provide a way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r"users", UserViewSet)


# Django serves API and authentication routes.
urlpatterns = [
    path("api/", include(router.urls)),
    path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
]

Add the following to your settings.py module:

INSTALLED_APPS = [
    # ...
    "rest_framework",
]

REST_FRAMEWORK = {
    "DEFAULT_PERMISSION_CLASSES": [
        "rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly",
    ]
}

At this point, Django + DRF own the backend data and authentication services.

The next step is to export the OpenAPI contract from that backend and use it as the source for Angular-side CRM-facing integration.

A simplified schema fragment might look like this:

paths:
  /api/users/:
    get:
      operationId: listUsers
    post:
      operationId: createUser
  /api/users/{id}/:
    get:
      operationId: retrieveUser
    patch:
      operationId: updateUser

Non-CRM pages and bespoke workflows are then supplied separately.

For example:

pages:
  - route: /dashboard
    kind: dashboard

forms:
  - id: invite-user
    mode: reactive
    submit:
      action: createUser

The scaffolded first version in this repository already includes example inputs. For the contributor workflow around local validation and build-plan generation, see Contributing.

Documentation

Public usage documentation is not available yet. The project website is available at https://djangoangular.com/.

Current project documents:

Status

This project now includes a first scaffolded Python package, example specs, and the current contributor workflow. The repository does not yet include a frontend workspace. Actual code generation and Angular assembly are still pending.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_angular3-0.1.0.tar.gz (35.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_angular3-0.1.0-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file django_angular3-0.1.0.tar.gz.

File metadata

  • Download URL: django_angular3-0.1.0.tar.gz
  • Upload date:
  • Size: 35.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_angular3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b78230e2a4a8193df17df1982b7ec5538299c77d05a896b1efa1b18fc6521404
MD5 900bd7771f9e03916e28f45747a108db
BLAKE2b-256 96522c0ff20dd7e9e5a8ce26476fc93682196fb6f83aed148f0f26434b3374a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_angular3-0.1.0.tar.gz:

Publisher: deploy.yml on shlomoa/django-angular3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_angular3-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_angular3-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_angular3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ebcd893d23a5146542481d4784649dfa81e43d65a4221fe660186ff10235e54
MD5 6c4dfbe67140fa3b30ccd7e0fd45160d
BLAKE2b-256 8c49d11aa283536eb565fb63a8ea11b0f0dc9a1155291768516abc8c40fc680a

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_angular3-0.1.0-py3-none-any.whl:

Publisher: deploy.yml on shlomoa/django-angular3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page