Skip to main content

django-angular3

Nightly regression django-angular3 on PyPI angular-django2 on npm openui-spec on PyPI

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
  • doc/specifications/SPECIFICATIONS.md — exact platform structures and topology definitions
  • doc/specifications/AI_AUTOMATION_SPECIFICATIONS.md — exact AI automation module organization and realization
  • doc/specifications/TEST_SCENARIO_SPECIFICATIONS.md — exact build-scenario suite realization and coverage
  • doc/contracts/CHANGE_MODEL_CONTRACTS.md — shared Change Model and interface boundaries
  • doc/contracts/TOOL_CONTRACTS.md — deterministic Tool contracts
  • doc/contracts/HOOK_CONTRACTS.md — lifecycle Hook contracts
  • doc/contracts/PROVIDER_ADAPTER_CONTRACTS.md — provider-adapter contracts
  • doc/contracts/PLUGIN_CONTRACTS.md — Plugin packaging contracts
  • doc/contracts/SKILL_CONTRACTS.md — Skill contracts and catalog ownership
  • doc/contracts/TEST_SCENARIO_CONTRACTS.md — build-scenario input and expected oracle boundaries
  • doc/plan/CONFIGURATION_PLAN.md — configuration planning
  • doc/plan/CONSTRUCTION_PLAN.md — construction sequencing and backlog
  • doc/plan/AUTOMATION_PLAN.md — automation sequencing and backlog
  • doc/plan/APPLICATION_DELIVERY_PLAN.md — generated-application delivery
  • doc/plan/VERIFICATION_PLAN.md — verification sequencing and backlog

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 API-contract-derived functionality.
  • Support pages, reactive forms, navigation, and workflows through an OpenUI concrete UI document.
  • Automate the handoff from backend API contract to Angular integration artifacts through a deterministic, repeatable pipeline.

Requirements

See the requirements corpus for product, generated-application, build_app, and AI automation requirements.

Installation

pip install django-angular3

To install from a local clone:

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

For contributor development, use the development setup in CONTRIBUTING.md, which includes both the dev and docs extras for code and documentation validation. The installation commands above are for package use, not the contributor toolchain.

OpenAPI and OpenUI validation

django-angular3 uses openapi-spec-validator for full OAS compliance validation of OpenAPI documents and openui-spec to validate structured OpenUI documents against its schema and catalog. Both are pure-Python dependencies installed automatically with the package — no external validation toolchain is required.

OpenAPI documents are validated against the full OpenAPI specification using openapi-spec-validator; OpenUI documents are validated through openui-spec. An OpenUI document is versionless: the OpenUI schema version is declared solely by the SCHEMA_VERSION file of the installed openui-spec package — managed by the tooling, like the OpenAPI schema version — and every type must be an exact, case-sensitive literal from its canonical catalog. Use id for instance identity and attrs for configuration rather than aliases, selectors, or implementation names.

An attribute key is categorized: uses.<name> configures the element, produces.<name> is an event it emits, and behaves.<name> is a behavior it applies. An attribute value is a string or null, or a list of strings and null: null indicates no value, and "null" is the string null. A JSON number or Boolean is not a value; write it as a string, such as "true" or "25". A string literal is quoted inside the string, such as "\"Users\"".

The oasdiff requirement of build_app

build_app compares OpenAPI schemas with oasdiff. It uses, in order, an executable in the package's .bin/ directory, an oasdiff on PATH, and otherwise downloads the latest release from the GitHub releases API into .bin/ on first use. The automatic download supports Linux and Windows on amd64 or arm64 only; on macOS or any other platform, install oasdiff yourself and put it on PATH. Where the download is blocked (for example by an egress policy), build_app stops with a CommandError that names the cause. Place an oasdiff executable at the printed path, install it on PATH, or allow network access to api.github.com and the oasdiff GitHub releases.

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 static django-angular3.json configures djng's Angular tool settings, including executable resolution. DJANGO_ANGULAR3 and DjangoAngularSettings are derived from that file; they are not independent configuration authorities.

django-angular3.json is mandatory and has no fallback. It must exist next to the project configuration (settings.BASE_DIR in a configured Django runtime, otherwise the current directory). There is no packaged or in-code default: a command that needs it (ng_*, build_app, export_schema, ...) fails with an error naming the expected path, and a file without the mandatory angular.build.browserOutputPath or tool.ngAddPackage is rejected. The packaged file is only a template that django-angular3 install-tutorial copies; start from it and set the values of your own project.

The generated app's identity and artifact locations are instead supplied by the project configuration defined in doc/specifications/SPECIFICATIONS.md §2.1.

To reset a generated app's build artifacts, run django-admin clean. To remove all untracked files and directories from its Git worktree, run django-admin distclean; use --dry-run with either command to inspect its effect first.

Once installed, Django and the standalone CLI expose the same Angular command resolution flow. Use --dry-run only for diagnostic validation and debugging; it resolves commands without executing Angular tooling:

./manage.py ng_new --dry-run
./manage.py ng_workspace --dry-run
./manage.py ng_config --dry-run
./manage.py ng_add --dry-run
./manage.py ng_gen_app --dry-run
./manage.py ng_page --name orders --target-path src/app/features/orders --dry-run
./manage.py ng_component --name order-card --dry-run
./manage.py ng_reactive_form --name contact --definition forms/contact.json --dry-run
./manage.py ng_openapi_gen --dry-run
./manage.py ng_build --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:workspace-setup
  • ng_config applies workspace defaults such as package manager, style, and routing
  • ng_add installs and registers the configured angular-django2 package (named, without a hard-coded version, by tool.ngAddPackage; a local checkout's build is preferred when one is present), whose OpenUI integration requires validated versionless canonical-catalog documents
  • ng_gen_app generates an Angular application inside the configured workspace via the angular-django2:material-app schematic, forwarding --ssr, --zoneless, and --defaults to align with the Angular CLI ng new defaults
  • ng_material_setup configures Angular Material in an existing project via the angular-django2:material-setup schematic, forwarding optional --theme, --typography, and --animations
  • ng_page, ng_component, and ng_reactive_form wrap the matching angular-django2 schematics without changing their deterministic behavior
  • ng_workspace, ng_gen_app, ng_page, ng_component, ng_complex_component, and ng_reactive_form accept --document (a workspace-relative OpenUI document) and, except ng_workspace, --node-id to compile an OpenUI element; ng_openapi_setup accepts --auth-scheme bearer|basic
  • ng_openapi_gen runs a locally installed ng-openapi-gen for the configured OpenAPI source

build_app --dry-run derives these steps from detected OpenAPI, OpenUI and project changes, following the command mapping of the installed angular-django2 package, and prints each step's order, wrapper command, resolved parameters and reason. Without --dry-run it runs the same steps in order, halts at the first failure and writes build/build-evidence.json. It refuses what ngdj cannot do; see Changes build_app turns into steps for what is supported and refused.

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 §3.6.4 for the authoritative definition.

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

Beyond these workspace wrappers, angular-django2 ships schematics for composing bespoke feature UI. ng generate angular-django2:component <name> scaffolds a standalone component seeded with begin/end embedding hooks, and ng generate angular-django2:embed-component --component=<child.ts> --parent=<parent.ts> wires a generated child into a parent — importing the class, registering it in the parent standalone imports array, feeding input signals, and binding outputs to on<Output>() handler stubs. Embedding is idempotent, so it is safe to re-run during iterative development. See the Usage workflow for the full generate → embed composition flow.

For advanced Material components, use the ng_complex_component wrapper. It invokes angular-django2:complex-component, which owns theme mixins, nested child composition, projection slots, CDK overlay support, and create/modify/ delete lifecycle handling:

./manage.py ng_complex_component \
  --name dashboard-card --target-path src/app/features/dashboard \
  --features mixins,nested,projection --dry-run

Use --mode delete --confirm for deletion.

This reusable Django app contributes configuration helpers, management commands and one view, django_angular3.spa, which serves the built Angular application from Django (see Serving the built application). It ships no models, templates, static assets, or migrations, so there is no migration step for the package itself.

Serving the built application

To serve the browser files that manage.py ng_build leaves from the same origin as the API, as the production deployment of the specification requires, add the Angular patterns last in urls.py, so that Django's own routes win:

# urls.py
from django_angular3.spa import angular_urlpatterns

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/v1/", include(router.urls)),
    *angular_urlpatterns(),
]

Nothing is set in settings.py. Where the files are is configuration, in two places:

  • artifacts.angularWorkspace of the project configuration, django-angular3-<project>.json, is the workspace root (for example build/angular);
  • angular.build.browserOutputPath of django-angular3.json is the directory inside the workspace that ng_build leaves the browser files in (for example dist/simple_crm/browser). It is mandatory and has no default: a tool configuration without it is rejected, and every command that runs Angular tooling (ng_new, ng_build, ...) fails until it is set. It must be a relative path inside the workspace.

The directory is <angularWorkspace>/<browserOutputPath>. The project configuration is found from settings.BASE_DIR, as for every other command, and the tool configuration is read from the same directory. The tutorial project's django-angular3.json sets "browserOutputPath": "dist/simple_crm/browser"; set the value of your own application, which is where ng build writes the browser files of your Angular project.

A request is answered with the bundle file of that name (main-*.js, styles-*.css), with index.html for any other path, so a hard refresh on an Angular route such as /customers works, and with a 404 for a wrong /api/, /api-auth/, /admin/ or /static/ URL or a file that is not in the bundle. A missing build is reported as ImproperlyConfigured. The generated application uses <base href="/"> and relative /api/... paths, so it needs no proxy and no CORS configuration. The view reads the files through Django, which suits development, tests and small deployments; behind real traffic, serve the same directory with a reverse proxy or a static-file layer such as WhiteNoise. The tutorial project (install-tutorial) is wired this way.

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 API-contract-derived Angular 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

Under the generated-app convention, UI requirements are supplied in the project-root app.openui.json selected by artifacts.openuiSpecification. The OpenUI concrete UI document may complement or reference API-contract-derived content. Its role, grammar, and catalog relationship are defined by the OpenUI artifact-role SSOT; see the OpenUI examples for the per-scope vocabulary.

For example:

{
  "id": "root",
  "type": "Application",
  "children": [
    {
      "id": "dashboardPage",
      "type": "DashboardPage"
    },
    {
      "id": "inviteUserForm",
      "type": "Form",
      "attrs": {
        "title": "\"Invite user\"",
        "behaves.submit": "createUser(form.value)"
      }
    }
  ]
}

The scaffolded first version in this repository already includes example inputs. For the contributor workflow around local validation, see Contributing; it also describes the opt-in end-to-end validation that runs the real Angular and browser tooling against the tutorial project.

Documentation

User-facing usage documentation is published at https://django-angular3.readthedocs.io/:

  • Tutorial — install, run the bundled tutorial, and complete the workflow end to end.
  • Configuration — configuration guidance and references.
  • Usage workflow — the contract-first cycle for your own project.
  • Command reference — every command in both the standalone CLI and management-command form.

The project website is available at https://djangoangular.com/.

Current project documents:

Status

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

Metadata

Release files for django-angular3 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-angular3 0.5.0
File Size Uploaded Provenance Actions
django_angular3-0.5.0.tar.gz 137.0 kB With provenance Details for django_angular3-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-angular3 0.5.0
File Interpreter ABI Platform Actions
django_angular3-0.5.0-py3-none-any.whl Python 3 none any Details for django_angular3-0.5.0-py3-none-any.whl

Total release size: 233.4 kB

Release files / django_angular3-0.5.0.tar.gz

Download URL django_angular3-0.5.0.tar.gz
Size 137.0 kB
Tags Source
SHA-256 checksum
How to use checksums
26fcfb37102896cefe0f712c369e20bff06d5648d552bca3561b3910b015b2ad
BLAKE2b-256 checksum
How to use checksums
c5e48a228a0df8c9b97bdd4e183fdfeaa7bc34b264653a991b9c174a7b45cf37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / django_angular3-0.5.0-py3-none-any.whl

Download URL django_angular3-0.5.0-py3-none-any.whl
Size 96.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfb27ce0d23c5a32dec271e538f33fe1868382f96fb784e003cea0989b6a749e
BLAKE2b-256 checksum
How to use checksums
d5f5089d4ac69a13359a2985a033a9dfe93e9332e64a09954426942d369b725d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for django-angular3 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_angular3-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page