- FastAPI – Interview Questions
The questions a FastAPI role actually asks, answered against the seventeen lessons before this one. Why type hints do the validating, def versus async def and what happens to each, how dependency injection is tested, where a transaction begins and ends, what BackgroundTasks does not promise, and how a request is traced in production. Short answers, with the reasoning behind them.
- FastAPI – Getting It Into Production
From a working image to something serving users. Workers and what they cost in database connections, a reverse proxy in front, configuration and secrets from the environment, running migrations as a step rather than at boot, and rolling out without dropping requests. Plus what to check first when it works locally and not in the cluster.
- FastAPI – Containerising It Properly
A multi-stage Dockerfile that leaves the compiler behind, a .dockerignore that cuts the build context from hundreds of megabytes and keeps .env out of a layer, and a non-root user. Then the settings that decide whether it works: --host 0.0.0.0, PYTHONUNBUFFERED, how many workers, and a healthcheck. With the resulting image size and build time measured rather than estimated.
- FastAPI – Logging, Health Checks and Request Tracing
Making a running API explainable. Structured JSON logs with a correlation id carried by a ContextVar so it survives both async routes and the threadpool, a health check that reports each dependency separately, and what to log per request. Includes two things that bite in a container: uvicorn quietly replacing your log config, and a test that asserted on log content while reading another handler's work.
- FastAPI – Testing the Whole Stack
TestClient against the real ASGI stack, dependency_overrides to swap the database and the current user, and a fixture that runs every test inside a transaction it rolls back. Which tests belong at the service layer and which can only be written through HTTP — including the class of bug that lives entirely in configuration and is invisible to everything below TestClient.