Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

django-ninja

> 后端框架
Open source

Fast, Async-ready, Openapi, type hints based framework for building APIs

9.2K stars0 likes1 views
WebsiteGitHub

About

Fast, Async-ready, Openapi, type hints based framework for building APIs

^ Please read ^

Fast to learn, fast to code, fast to run

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]).

Documentation: https://django-ninja.dev


Installation

bash
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
...
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):

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.
  • Share it via Twitter
  • If you already using django-ninja, please share your feedback to [email protected]

Issues· 223 open

View all issuesOpen on GitHub
  • #1784

    Implement OpenAPI callbacks

    Updated Sep 25, 2026
  • #1773

    Refcount corruption during GC when a `mode='wrap'` validator's `handler` outlives validation (shared validator tree traversed twice)

    Updated Sep 16, 2026
  • #1530

    Django Ninja fails with ForeignObject fields: AttributeError 'ForeignObjectRel' object has no attribute 'help_text'

    bugUpdated Sep 3, 2026
  • #1723

    How to prevent XSS attacks ?

    Updated Aug 28, 2026
  • #1767

    [BUG] transaction.non_atomic_requests is ignored on Ninja routes

    Updated Aug 28, 2026
  • #383

    Russia invaded Ukraine

    Updated Jul 15, 2026
  • #1736

    how to use exception_handler in an async view function

    Updated Jul 13, 2026
  • #789

    How implement permissions like DRF in django-ninja?

    Updated Jun 12, 2026
  • #1665

    Why are non-nullable Django fields marked as nullable in JSON schema?

    Updated Jun 10, 2026
  • #1730

    [Suggestion] Support OpenAPI 3.1 webhooks in code via @api.webhook(...) or similar

    Updated Jun 6, 2026

> Tags

Pythondjangodjango-ninjaopenapipydantic

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 29, 2026
Category后端框架
PricingOpen source

> Related tools

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架