vitalik /django-ninja
💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
★ 9,245⑂ 626👁 62⑃ 617● 1,057▤ 71
-1
Daily
9,245
stars
626
forks
62
watchers
617
prs
1,057
issues
71
releases
README
^ Please read ^
Fast to learn, fast to code, fast to run
!Test
!Coverage
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 [email protected]).
!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:
Python
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:
Python hl_lines="3 7"
...
from .api import api
urlpatterns = [
path("admin/", admin.site.urls),
path("api/", api.urls), 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
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 [email protected]Top issues
#383🛑 Russia invaded Ukraine33 comments · 2022-03-02#789How implement permissions like DRF in django-ninja?18 comments · 2023-07-12#637'api-1.0.0' is not a registered namespace17 comments · 2022-12-20#1306[BUG] JSON payload not parsed when using upload with extra fields12 comments · 2024-09-27#1037[BUG] Typing error with Field q kwarg12 comments · 2024-01-05#1444[BUG] Pydantic V2.11 Seems to cause up to x2.5 memory usage to ninja models build11 comments · 2025-04-11#961[BUG] Response generation dramatically slower when using aliases in Ninja v1/Pydantic v211 comments · 2023-11-26#333Dynamic response schema based on request parameters11 comments · 2022-01-22
Discussions
#1785⚡ Native B-FAST Binary Renderer for Django Ninja: Sub-microsecond serialization & 89% bandwidth reduction0 comments · 2026-09-24#1750Idempotency middleware for Django Ninja (works out of the box, it's plain ASGI)0 comments · 2026-08-06#1740How to use dynamic keys in schema?1 comments · 2026-06-17#1693Should newly added Status class be a generic?1 comments · 2026-03-12#1681GlitchTip uses django-ninja with ASGI and real asyncio-native cache, workers0 comments · 2026-02-19#1672Show and tell: Wireup - Type-safe Dependency Injection for Django Ninja0 comments · 2026-02-14#1664FastAPI Voyager now supports Django Ninja, A visualization tool for APIs0 comments · 2026-02-03#1654.0 comments · 2026-01-21
Latest release
v1.8.0 v1.8.0 2026-11-08What's New Webhooks You can now document the webhooks your API sends. Decorate the payload Schema with @api.webhook or @router.webhook and it appears in the OpenAPI 3.1 webh What's New Webhooks You can now document the webhooks your API sends. Decorate the payload Schema with @api.webhook or @router.webhook and it appears in the OpenAPI 3.1 webhooks section, so Swagger and Redoc show it next to your operations. This is documentation only: Ninja doesn't send anything. The guide shows one way to deliver them with Django tasks. python from ninja import NinjaAPI, Router, Schema ap