<a href="https://github.com/vitalik/django-ninja/issues/383"><img width="814" alt="SCR-20230123-m1t" src="https://user-images.githubusercontent.com/95222/214056666-585c0479-c122-4cb3-add4-b8844088ccdd.png"></a>
<a href="https://github.com/vitalik/django-ninja/issues/383">^ Please read ^</a>
<p align="center">
<a href="https://django-ninja.dev/"><img src="https://django-ninja.dev/img/logo-big.png"></a>
</p>
<p align="center">
<em>Fast to learn, fast to code, fast to run</em>
</p>


[](https://badge.fury.io/py/django-ninja)
[](https://pepy.tech/project/django-ninja)
# 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 **<a href="https://pydantic-docs.helpmanual.io" target="_blank">Pydantic</a>** and **<a href="/docs/docs/guides/async-support.md">async support</a>**.
- **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).

**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), # <---------- !
]
```
**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 <a href="http://127.0.0.1:8000/api/docs" target="_blank">http://127.0.0.1:8000/api/docs</a>
You will see the automatic interactive API documentation (provided by <a href="https://github.com/swagger-api/swagger-ui" target="_blank">Swagger UI</a> or <a href="https://github.com/Redocly/redoc" target="_blank">Redoc</a>):

## 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](https://twitter.com/intent/tweet?text=Check%20out%20Django%20Ninja%20-%20Fast%20Django%20REST%20Framework%20-%20https%3A%2F%2Fdjango-ninja.dev)
- If you already using django-ninja, please share your feedback to ppr.vitaly@gmail.com
Raw data
{
"_id": null,
"home_page": "https://django-ninja.dev",
"name": "django-ninja",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": null,
"author": "Vitaliy Kucheryaviy",
"author_email": "ppr.vitaly@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fa/9a/558489e0e25173772fbd826306b7d1777e80285b02d69e0e1aaec41e3eec/django_ninja-1.4.5.tar.gz",
"platform": null,
"description": "<a href=\"https://github.com/vitalik/django-ninja/issues/383\"><img width=\"814\" alt=\"SCR-20230123-m1t\" src=\"https://user-images.githubusercontent.com/95222/214056666-585c0479-c122-4cb3-add4-b8844088ccdd.png\"></a>\n\n\n\n<a href=\"https://github.com/vitalik/django-ninja/issues/383\">^ Please read ^</a>\n\n\n\n\n<p align=\"center\">\n <a href=\"https://django-ninja.dev/\"><img src=\"https://django-ninja.dev/img/logo-big.png\"></a>\n</p>\n<p align=\"center\">\n <em>Fast to learn, fast to code, fast to run</em>\n</p>\n\n\n\n\n[](https://badge.fury.io/py/django-ninja)\n[](https://pepy.tech/project/django-ninja)\n\n# Django Ninja - Fast Django REST Framework\n\n**Django Ninja** is a web framework for building APIs with **Django** and Python 3.6+ **type hints**.\n\n\n **Key features:**\n\n - **Easy**: Designed to be easy to use and intuitive.\n - **FAST execution**: Very high performance thanks to **<a href=\"https://pydantic-docs.helpmanual.io\" target=\"_blank\">Pydantic</a>** and **<a href=\"/docs/docs/guides/async-support.md\">async support</a>**.\n - **Fast to code**: Type hints and automatic docs lets you focus only on business logic.\n - **Standards-based**: Based on the open standards for APIs: **OpenAPI** (previously known as Swagger) and **JSON Schema**.\n - **Django friendly**: (obviously) has good integration with the Django core and ORM.\n - **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).\n\n\n\n\n\n**Documentation**: https://django-ninja.dev\n\n---\n\n## Installation\n\n```\npip install django-ninja\n```\n\n\n\n## Usage\n\n\nIn your django project next to urls.py create new `api.py` file:\n\n```Python\nfrom ninja import NinjaAPI\n\napi = NinjaAPI()\n\n\n@api.get(\"/add\")\ndef add(request, a: int, b: int):\n return {\"result\": a + b}\n```\n\n\nNow go to `urls.py` and add the following:\n\n\n```Python hl_lines=\"3 7\"\n...\nfrom .api import api\n\nurlpatterns = [\n path(\"admin/\", admin.site.urls),\n path(\"api/\", api.urls), # <---------- !\n]\n```\n\n**That's it !**\n\nNow you've just created an API that:\n\n - receives an HTTP GET request at `/api/add`\n - takes, validates and type-casts GET parameters `a` and `b`\n - decodes the result to JSON\n - generates an OpenAPI schema for defined operation\n\n### Interactive API docs\n\nNow go to <a href=\"http://127.0.0.1:8000/api/docs\" target=\"_blank\">http://127.0.0.1:8000/api/docs</a>\n\nYou will see the automatic interactive API documentation (provided by <a href=\"https://github.com/swagger-api/swagger-ui\" target=\"_blank\">Swagger UI</a> or <a href=\"https://github.com/Redocly/redoc\" target=\"_blank\">Redoc</a>):\n\n\n\n\n## What next?\n\n - Read the full documentation here - https://django-ninja.dev\n - To support this project, please give star it on Github. \n - Share it [via Twitter](https://twitter.com/intent/tweet?text=Check%20out%20Django%20Ninja%20-%20Fast%20Django%20REST%20Framework%20-%20https%3A%2F%2Fdjango-ninja.dev)\n - If you already using django-ninja, please share your feedback to ppr.vitaly@gmail.com\n",
"bugtrack_url": null,
"license": null,
"summary": "Django Ninja - Fast Django REST framework",
"version": "1.4.5",
"project_urls": {
"Documentation": "https://django-ninja.dev",
"Homepage": "https://django-ninja.dev",
"Repository": "https://github.com/vitalik/django-ninja"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "49e3168274a8def4b9a2fb2540319a68914e8e4e529cd7f7b5f1ba8939d011bc",
"md5": "b12e9c64a40a417ce3b61f04a0627c55",
"sha256": "d779702ddc6e17b10739049ddb075a6a1e6c6270bdc04e0b0429f6adbf670373"
},
"downloads": -1,
"filename": "django_ninja-1.4.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b12e9c64a40a417ce3b61f04a0627c55",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2426449,
"upload_time": "2025-10-19T18:28:00",
"upload_time_iso_8601": "2025-10-19T18:28:00.518786Z",
"url": "https://files.pythonhosted.org/packages/49/e3/168274a8def4b9a2fb2540319a68914e8e4e529cd7f7b5f1ba8939d011bc/django_ninja-1.4.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fa9a558489e0e25173772fbd826306b7d1777e80285b02d69e0e1aaec41e3eec",
"md5": "75928239616710eac8da779a024d1158",
"sha256": "aa1a2ee2b22c5f1c2f4bfbc004386be7074cbfaf133680c2b359a31221965503"
},
"downloads": -1,
"filename": "django_ninja-1.4.5.tar.gz",
"has_sig": false,
"md5_digest": "75928239616710eac8da779a024d1158",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 3710511,
"upload_time": "2025-10-19T18:28:02",
"upload_time_iso_8601": "2025-10-19T18:28:02.362359Z",
"url": "https://files.pythonhosted.org/packages/fa/9a/558489e0e25173772fbd826306b7d1777e80285b02d69e0e1aaec41e3eec/django_ninja-1.4.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-19 18:28:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "vitalik",
"github_project": "django-ninja",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-ninja"
}