ADR-0014: Django and FastAPI expose the same auth HTTP surface and security defaults, over whichever library fits each framework
Status: accepted (2026-10-26) · Scope: rn-forge-django,
rn-forge-fastapi and any later framework binding of rn-forge-auth
Decision
Both frameworks mount the same auth routes, return the same session body and error codes, and apply the same session, cookie, CSRF and revocation defaults. An SPA cannot tell which framework serves it.
The libraries underneath may differ. Each framework binds whichever evaluated library fits it, and each login flow on each framework has exactly one owner: a library's integration or pykit's adapter over the library's core, never both. This applies ADR-0005 to auth.
Consequences
- ngkit builds one client against one contract.
- Each security control is tested on both frameworks, case for case, so a control added to one binding is not done until the other has it.
- Two library stacks are maintained, and a library change on one framework can force binding work to keep the surface identical.
- A framework binding that cannot meet a default through its library writes the missing part, and the design names the requirement no library met.
Influences
E13's design: its HTTP surface, sessions and cookies, libraries and ngkit client contract. F13.5 and F13.6 bind it.
Alternatives considered
- The same library on both frameworks. No maintained library covers accounts, sessions and CSRF on both Django and Starlette. Forcing one would bypass Django's own sessions and CSRF, or leave FastAPI without them.
- Each framework's native auth surface. The SPA would need a client per backend, and the security defaults would drift.
- Protocol adapters written in each framework package. The protocol code would be written twice, and the shared surface would drift.