Internals overview#
next.dj is built from the subsystems mapped below, which share one settings layer, one dependency resolver, and one signal bus. This page maps them and shows how signals flow between them.
Note
If you want to know how to extend the framework rather than how it works inside, read Extending first. That page covers the five extension mechanisms and the decision tree for choosing between them. The pages here explain the implementation.
Subsystems#
Subsystem |
Responsibility |
Public module |
|---|---|---|
Pages |
Page modules, layouts, body sources, context, processors. |
|
Components |
Component discovery, loading, rendering, slots, context. |
|
URLs |
File router, dispatcher, reverse helpers, hot reload. |
|
Forms |
Form action registry, dispatch, validation, formsets. |
|
Static |
Asset discovery, collector, kinds, backends, JS context. |
|
Partial |
Zones, patches, SSE streams, partial protocol backend. |
|
Dependencies |
Parameter resolver, providers, request cache. |
|
Server |
Autoreload watcher, watch specs, signals. |
|
Config |
Settings access, defaults, helpers. |
|
Testing |
Test client, signal recorder, isolation. |
|
App |
Django |
|
Bootstrap#
Django calls NextFrameworkConfig.ready() once per process after all applications load.
The hook calls register_all() to register the framework system checks.
It then runs five startup hooks in a fixed order.
The hooks wire autoreload, templates, staticfiles, components, and form autodiscovery into the Django runtime.
The final hook autodiscover_forms() registers shared forms before the first request arrives.
See Apps reference for the canonical ordering and the full API.
How they compose#
A request passes from next.urls through next.pages and next.deps to next.static and next.components before the final HTML returns to the client.
Form submissions take a parallel path through next.forms, which on validation failure reuses the same render pipeline.
Partial requests take a zone-patch path through next.partial, which renders the targeted zones through the same render pipeline and returns patches instead of a full page.
Request lifecycle traces the render and form paths end to end.
How a partial request flows traces the zone-patch path.
Signals fan out#
Most cross subsystem coordination happens through signals. The diagram below shows which subsystem emits each signal and the typical receivers.
flowchart LR
Pages["next.pages"]
Components["next.components"]
URLs["next.urls"]
Forms["next.forms"]
Static["next.static"]
Partial["next.partial"]
Deps["next.deps"]
Server["next.server"]
Conf["next.conf"]
Audit["Audit and metrics"]
Cache["Cache invalidation"]
Watch["Long lived listeners"]
Pages -- "template_loaded, context_registered, page_rendered" --> Audit
Components -- "component_registered, components_registered, component_rendered, component_backend_loaded" --> Audit
URLs -- "route_registered, router_reloaded" --> Watch
Forms -- "action_registered, action_dispatched, form_validation_failed, form_access_denied, wizard_step_submitted, wizard_completed" --> Audit
Forms -- "action_dispatched" --> Cache
Static -- "asset_registered, collector_finalized, html_injected, backend_loaded" --> Audit
Partial -- "zone_registered, zone_rendered, patch_op_registered, field_validated, sse_stream_opened, sse_stream_closed" --> Audit
Deps -- "provider_registered" --> Audit
Server -- "watch_specs_ready" --> Watch
Conf -- "settings_reloaded" --> Watch
Conf -- "settings_reloaded" --> Cache
Note
The diagram is a coordination sketch. Signals is the canonical catalog of signal names, senders, and payloads.
Subsystem dependencies#
The dependency graph between subsystems is shallow.
next.confhas no internal dependencies and sits at the bottom.next.depsimports nothing from the framework and sits at the bottom next tonext.conf.next.pagesandnext.componentsdepend onnext.confandnext.deps.next.staticdepends onnext.conf,next.pages, andnext.components, whose trees its discovery and staticfiles finder walk.next.formsdepends onnext.conf,next.pages,next.deps,next.components, andnext.static, the last two through the component-widget binding.next.urlsdepends onnext.conf,next.deps,next.pages,next.components, andnext.forms.next.partialdepends onnext.conf,next.pages,next.components,next.static, andnext.formsto render zones and shape patches, and touchesnext.urlsonly in its system checks.next.serverdepends onnext.conf,next.pages,next.urls, andnext.components, the subsystems whose trees it watches.next.testingdepends on the page, component, form, dependency, static, and partial subsystems to drive isolation and rendering helpers.next.appsdepends on every subsystem. It is the Django-facing entry point that calls each subsystem’s startup hook.
Module map#
Each subsystem keeps a flat module layout.
Subsystem |
Submodules |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A single flat module that provides |
|
|
|
|
See also#
See also
Request lifecycle for the end to end request path. Extending for the user-facing extension mechanisms built on top of this architecture. Signals for the signal catalog. API reference for the public API.