FastAPI runs on ASGI, so a request travels through an async pipeline: the ASGI server accepts it, middleware wraps it, the router matches a path, dependencies are resolved, your path operation runs, and the return value is serialized into the response.
The stages
uvicorn (ASGI server)
│ scope + receive/send
▼
ASGI / Starlette middleware ── (CORS, GZip, custom)
▼
Routing ── method + → operation
▼
Dependencies (Depends) ── resolve -deps, security, -setup
▼
Path operation 