Architecture and Chapter Navigation#

This is the 2nd article in the Django Ninja tutorial series.
In the previous article, we discussed the overall direction of the series. Now, I will take a closer look at the series structure and chapter organization.
It can be said that this article is the blueprint of the entire series.
An overview like this would usually appear in the second half of the first article, if at all, but I decided to give it an article of its own.
The reason is simple: I put a lot of effort into the overall tutorial architecture and wanted to give readers a comprehensive overview. This will help you quickly get oriented and understand which part of the series you're currently reading.
Without further ado, let's look at each chapter in turn.
GitHub Example Project#
This series is divided into eight chapters, with only Chapter 3 further broken down into sections, due to its larger scope.
Here is an overview of each chapter. (Article titles and content may still change slightly, but the overall structure will remain the same.)
Chapter 1: Introduction and Django Ninja Overview#
The opening chapter introduces the series' purpose, scope, target audience, and reasons for learning Django Ninja.
The architecture article explains the arrangement and composition of the series, the main content, and the learning order of each article.
Finally, it introduces readers to basic concepts of Django Ninja and Django REST framework, including their positioning, similarities, and differences.
- Article 1: Series Introduction & Target Audience
- Article 2: Architecture and Chapter Navigation (this article)
- Article 3: Introduction to Django Ninja - Main Differences From Django REST Framework
Chapter 2: Example Project and Environment Configuration#
Introduces the series' example project—Django-Ninja-Tutorial, using concrete code changes as a reference during the learning process. (If you feel the project is carefully crafted, please don't hesitate to give it a 🌟! 🥰)

The example code is a good mentor for learning new technologies, and it is also the fruit of my hard work 😭
We will also introduce the Python development tools used in the project to allow readers to experience a real development environment.
Finally, we will guide you step-by-step to get the project running on your local machine.
- Article 4: Introduction to the API Example Project
- Article 5: Introduction to Modern Python Development Tools
- Article 6: Environment Settings & How to Use This Project
Chapter 3: Django Ninja Fundamentals#
The core of Django Ninja, containing the fundamental skills that any API developer needs to be familiar with.
This chapter is divided into three major parts: Routers, Request, and Response.
Section 1: Routers#
Endpoints and routers are the starting point of APIs.
The way Django Ninja configures routing is very different from traditional Django. Therefore, we put routing first as the entry point for learning API development.
- Article 7: Routing (Part 1) Traditional Django Routing Approach
- Article 8: Routing (Part 2) Django Ninja Routing Configurations
Section 2: HTTP Request#
After routing comes the HTTP request, covering three key aspects of request handling in Django Ninja: Path Parameters, Query Parameters, and the Request body.
The most important of these is the body, for which we will use Django Ninja Schema (that is, Pydantic BaseModel) to receive and validate data.
- Article 9: Request (Part 1) Django Ninja Handles HTTP Requests
- Article 10: Request (Part 2) Path Parameters
- Article 11: Request (Part 3) Query Parameters
- Article 12: Request (Part 4) Request Body and Schema Introduction
Section 3: HTTP Response#
After the Request comes the Response. Responses also use Schema, but have more variations than requests do.
This section introduces the basic structure of responses, ways to handle them, Nested Schemas, and Resolver methods.
- Article 13: Response (Part 1) Django Ninja Handles HTTP Responses
- Article 14: Response (Part 2) Creating Nested Structure Responses Using Schema
- Article 15: Response (Part 3) Why Not ModelSchema? - Why I Prefer Django Ninja Over DRF
- Article 16: Response (Part 4) The Resolver Method - Column Data Formatting
Chapter 4: API Documentation#
Once we master how Django Ninja handles requests and responses, the remaining key is API documentation.
The quality and readability of API documentation are critical to API users. This chapter explains how Django Ninja automatically generates API documentation and shares several practices that I find useful.
- Article 17: API Documentation (Part 1) Django Ninja Documentation Practice Guide
- Article 18: API Documentation (Part 2) Pydantic Field Configuration Examples and Default Values
Chapter 5: Data Validation and Error Handling#
Data validation and error handling directly affect an API's stability and reliability. This chapter explores how to validate data, catch errors, and return appropriate responses in Django Ninja.
- Article 19: Data Validation (Part 1) Pydantic Single Field Validation
- Article 20: Data Validation (Part 2) Pydantic Cross-field Validation
- Article 21: Error Handling (Part 1) HttpError and Custom HTTP Responses
- Article 22: Error Handling (Part 2) Global Error Handling - Using Exception Handlers
Chapter 6: API Advanced Features#
Although it is an introduction, it is still necessary to introduce common advanced features of APIs. These techniques will help you meet typical challenges in large-scale projects.
We will guide you through implementing each feature while emphasizing its underlying concepts and use cases. From there, you can continue exploring and applying these features on your own.
- Article 23: File Upload - Django UploadedFile Introduction
- Article 24: Pagination (Part 1) Django Ninja's Built-in Paginator
- Article 25: Pagination (Part 2) Custom Pagination Class
- Article 26: Data Query and Filtering (Part 1) Introduction to FilterSchema
- Article 27: Data Query and Filtering (Part 2) FilterSchema Multi-field Filtering
Chapter 7: Authentication and Unit Testing#
This chapter introduces topics that are indispensable in backend projects. Although Django Ninja does not provide their core implementations, backend developers still need to master them.
- Article 28: Authentication - Session Authentication and Global Settings
- Article 29: Unit Testing - Testing APIs Using Test Client and pytest
Chapter 8: Series Review and Completion Reflections#
This chapter briefly reviews the entire series and shares my reflections on taking part in the iThome Ironman Contest.
Conclusion#
You should now have a clear understanding of the series' overall structure. Each article that follows will use this blueprint to guide you through Django Ninja step by step.
In the next article, we will formally introduce Django Ninja and compare it with the veteran Django REST framework to understand the main functional differences and applicable scenarios of the two in API development.