FastAPI, by Calling It
Routes, validation and documentation that come from the same annotations - each one runnable on the page.
About this track
FastAPI is a thin, well-chosen layer over two ideas you can learn separately: ASGI, which is what a Python web application actually is, and Pydantic, which turns your annotations into validation. Almost everything that looks like framework magic is one of those two doing its job.
This track works up from a first route to dependencies, middleware and testing. There is no server on these pages - a browser tab cannot listen on a port - so a test client calls the app the way a server would, which means routing, validation, status codes and the generated schema all behave exactly as they do in production.
Every example runs a real FastAPI application in the browser against a test client, so a request and its response are both on the page - including the requests that are rejected, which is where most of the framework's behaviour is visible.
What you will be able to do
- Build an endpoint and know which part of the request each parameter is reading.
- Use dependency injection for shared work, and override it in tests.
- Choose between async and sync endpoints from what the handler actually does.
- Return the right status code and shape the error responses deliberately.
- Structure an application that is still navigable once it outgrows one file.
How the track is ordered
The first endpoint comes first, then the request - path parameters, query parameters, bodies, headers, forms and files - because everything else assumes you can read the input. Responses and status codes follow. Dependencies get the largest share of the track, since they are the mechanism FastAPI is built around and the thing that makes an application testable. The track closes with structure, security, testing and the async question, which is where most production problems actually live.
Where this leads
FastAPI is Pydantic applied to HTTP, so the Pydantic track explains the validation layer these pages rely on. Beyond it lie deployment, databases and the operational material a running service needs.
All 26 modules, in teaching order
- 01What FastAPI Is
- 02Your First Endpoint
- 03Path Parameters
- 04Query Parameters
- 05Request Bodies
- 06Response Models
- 07Reading a 422
- 08HTTP Methods and Routing
- 09Headers and Cookies
- 10Form Data and File Uploads
- 11Status Codes
- 12Error Handling
- 13APIRouter
- 14Dependency Injection
- 15Dependencies with yield
- 16Sub-dependencies
- 17Class Dependencies
- 18Router and Global Dependencies
- 19Dependency Overrides
- 20async def or def
- 21Background Tasks
- 22Lifespan Events
- 23Testing
- 24OpenAPI and the Docs
- 25Security Basics
- 26Project Structure