skillfed

django-ninja

Django Ninja - Fast Django REST framework

django-ninja v1.6.2 3.1M downloads/30d#2,735 on PyPI9,164
Permissive license Active released

What it is and what it does

Django Ninja is a REST API framework that layers on top of Django, using Python type hints to define request/response schemas and validation. Instead of writing separate schema definitions, you declare function parameters with type annotations, and Pydantic automatically validates incoming data and generates OpenAPI documentation. It supports both synchronous and asynchronous request handlers, integrates with Django's ORM, and produces interactive API docs at a standard endpoint.

The framework is designed to reduce boilerplate: type hints serve double duty as both documentation and validation rules, so you write less code to define the same API surface. It's built on Django and Pydantic, both mature and widely used, and is marked as production-ready with active maintenance and real-world adoption.

Use it for:

  • Build a REST API on top of an existing Django project without rewriting the core application.
  • Generate OpenAPI documentation automatically from type-hinted endpoint definitions.
  • Validate JSON request bodies and query parameters using Pydantic schemas defined inline.
  • Create async endpoints in Django to handle high-concurrency workloads.
  • Prototype and iterate on API designs quickly by writing minimal endpoint code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Django Ninja builds type-hint-based REST APIs on top of Django, using Pydantic for validation and async support to generate OpenAPI documentation automatically.

Yes. Django Ninja is actively maintained, has no known vulnerabilities, uses permissive MIT licensing, and integrates cleanly with Django and Pydantic. It reduces boilerplate by using type hints for both validation and documentation. Install it if you're building a REST API in Django and want automatic schema generation and validation without extra configuration overhead.

Install

django-ninja on PyPI

pip

pip install django-ninja

uv

uv add django-ninja

poetry

poetry add django-ninja

Installing django-ninja

Before you install

Low install friction with a pure-Python wheel. Actively maintained with recent commits and a large repository presence (9164 stars). Supports Django 3.1 through 6.0 and Python 3.7–3.14.

License in practice

MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install django-ninja

from ninja import NinjaAPI

api = NinjaAPI()

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

Requires Django and Python 3.7 or later; must be integrated into an existing Django project.

Verify before relying

  • Whether async support requires additional configuration or specific application server setup.
  • Performance characteristics compared to other Django REST frameworks under production loads.
  • Maturity and adoption rate of async features specifically.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 2 — Django, pydantic
Maintenance actively maintained — 149 days since the last release
Last repo commit
First released
Downloads 3,134,182/month — #2,735 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_ninja-1.6.2-py3-none-any.whl

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: AsyncIOFramework :: DjangoFramework :: Django :: 3.1Framework :: Django :: 3.2Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersIntended Audience :: Information TechnologyIntended Audience :: System AdministratorsLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: InternetTopic :: Internet :: WWW/HTTPTopic :: Internet :: WWW/HTTP :: HTTP ServersTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

django rest api frameworktype-hint based api builderdjango async apiopenapi schema generationpydantic validation djangofast django restdjango api with type hints
rest-apitype-hintsasync-support

More Software Development packages