MCPcopy Create free account
hub / github.com/vitalik/django-ninja

github.com/vitalik/django-ninja @v1.6.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.6.2 ↗ · + Follow
7,619 symbols 24,092 edges 185 files 294 documented · 4% 7 cross-repo links updated 6d agov1.6.2 · 2026-03-18★ 9,132135 open issues

Browse by type

Functions 5,682 Types & classes 1,552 Endpoints 385
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SCR-20230123-m1t

^ Please read ^

<em>Fast to learn, fast to code, fast to run</em>

Test Coverage PyPI version Downloads

Django Ninja - Fast Django REST Framework

Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints.

Key features:

  • Easy: Designed to be easy to use and intuitive.
  • FAST execution: Very high performance thanks to Pydantic and async support.
  • Fast to code: Type hints and automatic docs lets you focus only on business logic.
  • Standards-based: Based on the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
  • Django friendly: (obviously) has good integration with the Django core and ORM.
  • Production ready: Used by multiple companies on live projects (If you use django-ninja and would like to publish your feedback, please email ppr.vitaly@gmail.com).

Django Ninja REST Framework

Documentation: https://django-ninja.dev


Installation

pip install django-ninja

Usage

In your django project next to urls.py create new api.py file:

from ninja import NinjaAPI

api = NinjaAPI()


@api.get("/add")
def add(request, a: int, b: int):
    return {"result": a + b}

Now go to urls.py and add the following:

...
from .api import api

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/", api.urls),  # <---------- !
]

That's it !

Now you've just created an API that:

  • receives an HTTP GET request at /api/add
  • takes, validates and type-casts GET parameters a and b
  • decodes the result to JSON
  • generates an OpenAPI schema for defined operation

Interactive API docs

Now go to http://127.0.0.1:8000/api/docs

You will see the automatic interactive API documentation (provided by Swagger UI or Redoc):

Swagger UI

Sponsors

sendcloud-logo

Become a sponsor

What next?

  • Read the full documentation here - https://django-ninja.dev
  • To support this project, please give star it on Github. github star
  • Share it via Twitter
  • If you already using django-ninja, please share your feedback to ppr.vitaly@gmail.com

Core symbols most depended-on inside this repo

Shape

Function 3,583
Method 2,099
Class 1,552
Route 385

Languages

TypeScript72%
Python28%

Modules by API surface

ninja/static/ninja/swagger-ui-bundle.js4,350 symbols
ninja/static/ninja/redoc.standalone.js1,146 symbols
tests/main.py109 symbols
tests/test_openapi_schema.py96 symbols
tests/test_router_reuse.py81 symbols
tests/test_pagination.py75 symbols
tests/test_status.py65 symbols
tests/test_pagination_cursor.py65 symbols
tests/test_streaming.py55 symbols
tests/test_orm_schemas.py53 symbols
ninja/pagination.py47 symbols
tests/test_orm_metaclass.py42 symbols

Dependencies from manifests, versioned

griffe0.47.0 · 1×
markdown-include0.8.1 · 1×
mkdocs1.5.3 · 1×
mkdocs-autorefs1.0.1 · 1×
mkdocs-material9.5.4 · 1×
mkdocs-material-extensions1.3.1 · 1×

For agents

$ claude mcp add django-ninja \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page