Build a REST API with FastAPI: routes, validation, docs

12 steps · about 10 h 45 min · Intermediate

  1. 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.

  2. 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.

  3. 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.

  4. First Steps - FastAPI (tutorial, FastAPI official docs, 15 min)

    Write your first route, run fastapi dev and open the automatic interactive docs at /docs.

  5. 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.

  6. 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.

  7. 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.

  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. 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.