How does a request flow through FastAPI's Uvicorn/Starlette/Pydantic stack?medium
Uvicorn, an ASGI server, accepts the raw HTTP/WebSocket connection; Starlette routes the request to the matching path operation; FastAPI uses Pydantic to parse and validate the path, query, and body data against your type hints; your endpoint function runs; and the return value is serialized back to JSON.
FastAPI doesn't handle raw sockets itself — it sits on top of a small stack where each layer has one job. ASGI (Asynchronous Server Gateway Interface) is the async successor to WSGI and is what makes native async def endpoints possible; Uvicorn implements that server side. Starlette provides routing, middleware, background tasks, and the request/response objects that FastAPI builds on. Pydantic isn't just documentation — it actually parses and validates data at runtime against your type hints and BaseModel classes. Interview line: Uvicorn runs it, Starlette routes it, Pydantic validates it, and FastAPI is the layer that wires the three together around your type hints.