Course page
Log in

You are watching a free preview. Enroll to open all 26 lessons, track progress and ask the course tutor.

Enroll for $69.99

Section 1: FastAPI fundamentals

What we are building and the stack

Video 8 min Lesson 1 of 26 Sample clip Preview

In this course we build Taskboard, a back end API for small teams. Users belong to organisations. Organisations have projects, projects have tasks, and tasks have comments and attachments. Users can only see data from their own organisations, and some actions require an admin role.

It is a typical business API, and that is the point. Almost every backend you will build has the same ingredients: users and permissions, related data, lists with filters, file uploads and background work.

The stack

  • FastAPI: the web framework. It uses type hints to parse and validate requests, and generates an OpenAPI document and interactive docs automatically.
  • Pydantic v2: data validation and serialisation, used by FastAPI for request and response bodies and for our settings.
  • PostgreSQL: the database. Reliable, feature rich and the default choice for most new relational workloads.
  • SQLAlchemy 2.0: the ORM and SQL toolkit, with typed models and a clear session model.
  • Alembic: database migrations.
  • pytest: tests.
  • Docker: local database and the final deployment image.
  • uv: Python environment and dependency management.

Why FastAPI

FastAPI's main advantages are developer speed and correctness. You declare what a request should contain using Python types, and FastAPI validates it, converts it and documents it. Invalid input gets a clear 422 response automatically. Dependency injection makes database sessions, current users and permissions easy to share across endpoints. It also supports async endpoints, which helps services that spend most of their time waiting on the network.

It is not the only good option. Django with Django REST Framework is excellent when you want an admin panel and batteries included. Flask is small and flexible. I will point out where those tools would make different choices.

Sync or async

FastAPI supports both regular def endpoints, which run in a thread pool, and async def endpoints, which run on the event loop. Async helps when you make many concurrent I/O calls, but it requires async compatible libraries all the way down. Blocking code inside an async def endpoint stalls every request. We start with async SQLAlchemy and explain exactly where blocking would hurt.

In the next lesson we set up the project and run the first endpoint.

← → switch lessons