Series
Inside FastAPI
Follow a request through the framework, the dependency graph, and the ASGI boundary.
3 parts
- Part 1
What happens when an HTTP request reaches FastAPI?
A single GET request crosses a socket, an ASGI server, a router, a dependency graph, and a serializer. Here is what each layer does, and where it can fail.
November 10, 20264 min read - Part 2
How FastAPI resolves a dependency
One Depends parameter can hide a tree of sub-dependencies, per-request cache entries, and cleanup code. Follow the solve order and see where request-scoped resources begin and end.
November 8, 20264 min read - Part 3
How FastAPI serialises a response
Your endpoint returns a Python object. Between that object and the bytes on the socket sit validation, encoding, and a response class that decides how the body is written. Each step has a cost and a failure mode.
November 12, 20264 min read