Skip to content
New 3.0: one serializer, sync or async

Your Django models,
served as REST APIs.

Say which fields each operation reads and writes. django-ninja-aio-crud builds the Django Ninja endpoints, validation and OpenAPI schema, and serves them sync or async.

Get started Take the tutorial
  • Python 3.10–3.14
  • Django Ninja 1.7.x
  • MIT license
from django.db import models
from ninja_aio import ModelSerializer, SchemaConfig


class Article(ModelSerializer):
    title = models.CharField(max_length=200)
    body = models.TextField()
    is_published = models.BooleanField(default=False)

    class Schemas:
        create = SchemaConfig(fields=["title", "body"])
        update = SchemaConfig(optionals=[("title", str), ("body", str)])
        read = SchemaConfig(fields=["id", "title", "body"])

Generated endpoints

200 OK
{
  "items": [{ "id": 1, "title": "Hello", "body": "..." }],
  "count": 1
}

How it works

Three steps from model to API

  1. 1

    Describe the fields

    A Schemas class lists what each operation reads and writes.

  2. 2

    Register a viewset

    One decorator on a class with no body is enough to start.

  3. 3

    Ship the endpoints

    Five validated routes and an OpenAPI schema, sync or async.

Features

Everything a real API needs

Start with five lines. Add the rest when you need it.

Performance

Automation that costs microseconds

Median time for the list endpoint, same models and database for every framework.

See all benchmarks
  • django-ninja-aio-crud0.24 ms
  • FastAPI0.22 ms
  • Django Ninja0.18 ms
  • ADRF13.84 ms

Where to go next

Pick your path

Build your first endpoint now

Install the package and follow the quick start.