Django 5.2+ · Django Ninja 1.4+ · Python 3.12+

Ship the API,
skip the scaffolding.

A production-oriented Django and Django Ninja starter. Secure defaults, health checks, OpenAPI docs, tests, typing and CI on day one, with auth, CMS, shop and notifications as opt-in apps that install nothing until you name them.

pipx install django-ninja-starter
4login methods
4second factors
4social providers
3token modes
4transports

Feature apps

Everything is opt-in

Name an app in its environment variable, run make migrate, restart. Leave it unset and the project carries no tables, routes or admin for it at all.

DJANGO_CMS_ENABLED

CMS

Pages made of sections made of typed, translatable fields. Shared sections, menus, drafts with preview links, and an admin screen built for whoever writes the copy rather than whoever wrote the models.

DJANGO_NOTIFICATIONS_ENABLED

Notifications

A read API and a WebSocket that pushes new notifications the moment they exist, with the history, badge and read state kept in sync across devices.

DJANGO_SHOP_ENABLED

Shop

A storefront with variants, several sellers, discount campaigns, reviews, baskets, and an order cycle that reserves stock, issues an invoice and settles a payment.

DJANGO_WALLET_ENABLED

Wallet

A wallet per account, every way money moves in and out, and a balance derived from the movements rather than stored.

DJANGO_SUPPORT_ENABLED

Support

Live chat and support tickets between a client and the desk, over four transports at once.

DJANGO_CLUB_ENABLED

Club

Clubs with a levelled ladder, and missions that complete themselves from what the rest of the deployment does.

DJANGO_WEBHOOKS_ENABLED

Webhooks

Accounts register https endpoints; matching events are POSTed signed, retried and recorded.

DJANGO_FILES_ENABLED · DJANGO_FLAGS_ENABLED

Files and flags

Owned uploads on disk or S3, and feature flags with per-account overrides and percentage rollouts.

Authentication

Pick a way in. Every login ends the same way.

Each method, factor, provider and token mode is a separate app. Every login mints a signed JWT.

Login methods

  • Password
  • Email code
  • SMS code
  • Magic link

Second factors

  • Authenticator app (TOTP)
  • Email code
  • SMS code
  • Recovery codes

Social providers

  • Google
  • Apple
  • Microsoft
  • GitHub

Token modes

  • Sliding
  • Session
  • Rotation

One backend, four transports

Versioned REST. GraphQL. gRPC. WebSockets.

Every JSON response carries the same envelope, so a client handles success and failure one way.

REST/api/v1/…
GraphQL/graphql
gRPCmake grpc
WebSocketnotifications feed

Scaffold a versioned API

One command creates the router, a matching test, and registers it in both the OpenAPI schema and the Swagger version selector.

# creates src/apps/users/api/v1.py + test
python manage.py startapi users --api-version v1

# GET /api/v1/users/
# Swagger:  /api/docs
# ReDoc:    /api/redoc

The response envelope

The same six keys on success and failure. Clients key their translations off the title enum.

{
  "errors": null,
  "data": { /* payload */ },
  "isSuccess": true,
  "statusCode": 200,
  "title": "SUCCESS",
  "description": "The request succeeded."
}

Quick start

From zero to a running API in five commands

Install the generator, create a project, then set it up. The generator refuses to overwrite a non-empty directory.

  1. Install the generatorWith pipx, or use the GitHub Template instead.
  2. Create a projectChoose another folder with --directory.
  3. Install and configureVirtualenv, dependencies and a copy of .env.example.
  4. Migrate and runTurn on only the feature apps you need.
  5. Open the docsInteractive Swagger at /api/docs.
pipx install django-ninja-starter
django-ninja-starter my-api
cd my-api

python3 -m venv .venv
source .venv/bin/activate
make install
cp .env.example .env
make migrate
make run

Production-oriented

The boring parts are already done

Defaults you would otherwise argue about in week three.

FAQ

Questions people ask first

Is it a template or a package?

Both. Use the GitHub Template button, or install the generator with pipx and run django-ninja-starter my-api.

Why are some apps missing from the API docs?

A generated project ships the feature apps turned off. Set the app's DJANGO_*_ENABLED variable, migrate and restart, and its routes appear.

Which database does it use?

PostgreSQL is supported for production. Settings are driven by environment variables.

Can I try the API from the browser?

Yes. Open /api/docs. Signed in to the admin as staff, the page authorises itself for Try it out.

What licence is it under?

AGPL-3.0. See the LICENSE file in the repository.

Start with the parts you need.

Read the docs one app at a time, or generate a project and turn things on as you grow.