Build a REST API with FastAPI: routes, validation, docs
12 steps · about 10 h 45 min · Intermediate
- FastAPI - FastAPI (doc, FastAPI official docs, 10 min)
Start with the framework's own overview to see what FastAPI is, how to install it and what a minimal app looks like.
- FastAPI Course – Code APIs Quickly (video, freeCodeCamp.org (Tomi Tokko), 1 h)
A one-hour crash course gives you the whole picture of installing, routing and request methods before you read the details.
- Tutorial - User Guide - FastAPI (tutorial, FastAPI official docs, 10 min)
Set up a project with uv and FastAPI, and see how the step-by-step guide is organised.
- First Steps - FastAPI (tutorial, FastAPI official docs, 15 min)
Write your first route, run fastapi dev and open the automatic interactive docs at /docs.
- Query Parameters and String Validations - FastAPI (tutorial, FastAPI official docs, 25 min)
Learn how Query and Annotated add min_length, max_length and pattern checks that also show up in the docs.
- Request Body - FastAPI (tutorial, FastAPI official docs, 25 min)
Use Pydantic models to receive and validate JSON bodies in POST and PUT routes, combined with path and query parameters.
- Query Parameters and String Validations in FastAPI — Explained (interactive, FastAPI Interactive, 20 min)
Practise validation rules in a hands-on lesson to lock in the constraints before building a full API.
- Pydantic with FastAPI (article, vizlearn.in, 15 min)
See how FastAPI hands your request body to Pydantic, turns failures into 422 errors and builds the docs from the same model.
- FastAPI Tutorial for Beginners 🔥 Build Your First REST API with Python (video, YouTube, 3 h)
Follow a recent three-hour build-along to put routes, models and validation together into one working REST API.
- Testing - FastAPI (tutorial, FastAPI official docs, 25 min)
Write pytest tests with TestClient so you can check your routes and validation errors without running a server.
- Python API Development - Comprehensive Course for Beginners (video, freeCodeCamp.org (Sanjeev Thiyagarajan), 4 h)
Continue into a production-style API with a database, routers and authentication; watch selected sections as your next project needs them.
- GitHub - fastapi/fastapi (repo, FastAPI on GitHub, 20 min)
Finish by exploring the source repo, its docs and issues so you can keep learning from the real project.