Reading the FastAPI docs is the easy part. The docs are excellent. What's hard is the moment you close the tab and try to write an endpoint yourself: you're not sure whether Query(min_length=3) goes in the default or in Annotated, why your PATCH wipes the fields you didn't send, or why your token check accepts a token it shouldn't.

You only learn that by writing the code and finding out it's wrong.

That's what FastAPI Interactive is for. Every lesson is a short explanation next to an editor. You write a real FastAPI app, press Run, and it's checked against the endpoints the lesson asks for. Nothing to install: FastAPI runs right in the browser tab, on WebAssembly.

The FastAPI Interactive homepage: Learn FastAPI by writing FastAPI

What a lesson looks like

Take lesson 5, query parameter validation. The starter describes a search endpoint in TODO comments, and one way to write it is:

from fastapi import FastAPI, Query app = FastAPI() fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}] @app.get("/items/search/") def search_items( q: str = Query(min_length=3, max_length=50), skip: int = Query(0, ge=0), limit: int = Query(10, ge=1, le=100), ): matches = [item for item in fake_items_db if q.lower() in item["item_name"].lower()] return matches[skip : skip + limit] 

Run it, and the lesson calls your API the way a client would:

  • GET /items/search/?q=Baz should return [{"item_name": "Baz"}]
  • GET /items/search/?q=Bar&skip=1 should return []
  • GET /items/search/?q=ab should be refused with 422, because q is shorter than 3 characters

Lesson 5 after pressing Run: every endpoint checked, including the 422 for a too-short query

That last check matters. A lesson about validation is checked on what your API refuses, not just on what it returns. The same goes for the auth lessons: your JWT login is tried with a wrong password, with no token, and with a token signed by a different key, and each has to come back 401.

When something's wrong, you get the actual Python error with a line number, and the expected response next to the one you sent. Forgot to import Query? It tells you which import line it belongs on.

A NameError for Query, followed by a hint saying which import line to add

The three tracks

FastAPI Basics: 45 lessons that follow the official FastAPI tutorial. Path and query parameters, request bodies, validation, response models, forms and file uploads, error handling, dependencies, OAuth2 with JWT tokens, middleware, CORS, SQL databases with SQLModel, bigger applications across multiple files, background tasks and testing.

Build a Blog API with Authentication: 6 lessons that build one project. Data models, the database, user authentication, authorization levels, file uploads that check what was really uploaded, and error handling.

Advanced FastAPI Patterns: 10 lessons for after the basics. Async endpoints and dependencies, lifespan events, WebSockets with rooms and broadcasting, custom middleware, rate limiting, caching, custom responses and API versioning.

Yes, the WebSocket lessons open real WebSocket connections to your code, and the broadcasting lesson checks that a message sent on one connection arrives on another.

Things you can do besides the lessons

  • Send your own requests. Every lesson has a request bar, so you can call your endpoints with any method, body and headers and look at the raw response.
  • Open /docs. The interactive API docs FastAPI generates for your app work too.
  • Use the playground: a ready FastAPI app with examples, to try anything without a lesson around it.
  • Keep your progress. Sign in with GitHub or Google and your code and solved lessons follow you to another computer.
  • Get a certificate. Finish a track and you can get a certificate of completion with your name on it and a public page that verifies it.

The playground: an editor, a request bar and the response, all in the browser

A sample certificate of completion

Who it's for

  • You know some Python and want to learn FastAPI by writing it, not just by reading about it.
  • You've read the FastAPI tutorial and want to check you can actually do it.
  • You teach a course and want students to practice without a setup day.

Try it

Lesson 1 takes about five minutes: First Steps.

Over the next posts I'll go deeper into single topics: OAuth2PasswordBearer, status codes, testing with TestClient, each with code you can run. If there's a FastAPI topic you'd like covered, tell me in the comments.