Member-only story
Django-Ninja: Built-in Django Feels like FastAPI
Discover the future of Django development with Django-Ninja and FastAPI

Django is the web framework most widely used by Python developers. Django offers a powerful toolkit for creating web applications, making it easier for developers to create complex web applications effectively and efficiently.
However, Django has weaknesses. When it comes to performance, flexibility of project structure, compatibility with other libraries, or creating microservices, Django is not the main choice, and usually, Python developers will choose to use FastAPI. Why?
FastAPI excels at building APIs and real-time applications, utilizing asynchronous programming and type hints, while Django, with its full-stack framework features, is better suited to traditional web applications with admin panels, user authentication, and more.
But, what if you could leverage the benefits of Django and get performance similar to FastAPI? I will introduce you to Django-ninja, a game-changing framework that seamlessly bridges this gap, offering web developers a versatile tool to build high-performance web APIs without compromising the power and flexibility of Django. For me, it was a combination between Django and FastAPI.
So, what is Django-ninja?
Django Ninja is a Django API framework that FastAPI, a popular Python web framework, heavily influences. It offers a variety of features, many of which are inspired by FastAPI, such as support for asynchronous programming, type-hinted and schema-based request and response validation, automatic API documentation, and a simple, intuitive, and Pythonic way to define REST API routes.
Django Ninja provides an alternative to Django REST Framework (DRF), another popular Django API framework. DRF is a powerful tool, but Django Ninja is a more lightweight and appealing alternative that may better fit some Django projects.
For more information, you can visit their homepage.
In this article, I will show you how to create a simple CRUD API with Django-ninja and see how the code is just like FastAPI. To create a simple CRUD API with Django Ninja, we can follow these steps: