Overview
What FastAPI is, why it exists, and where it sits relative to Starlette and Pydantic.
Third-party documentation. This is independently authored analysis of the public FastAPI codebase — not the official docs, and not reviewed or endorsed by the FastAPI team.
FastAPI
FastAPI is a modern, high-performance Python web framework for building APIs, built directly on top of two focused libraries: Starlette for the underlying ASGI transport layer, and Pydantic for data validation and serialization. Its defining idea is that a plain Python function signature, annotated with standard type hints, carries enough information for the framework to derive request parsing, validation, serialization, and OpenAPI documentation automatically — no separate schema files, no hand-written marshalling code.
Why it exists
Before FastAPI, building a typed, self-documenting Python API meant either hand-maintaining an OpenAPI spec alongside the code (which drifts out of sync over time) or accepting a validation layer that didn't share a type system with the rest of the application. FastAPI's core bet is that the function signature is the schema — ordinary Python type hints, not a separate DSL layered on top.
Where it sits in the ecosystem
- Starlette — every FastAPI app is a valid Starlette app; ASGI request/response handling, routing, middleware, and WebSockets all come from Starlette directly.
- Pydantic (v2) — every request body, response model, and query/path parameter type is validated and (de)serialized through Pydantic's Rust-accelerated core.
- Uvicorn (or another ASGI server) — runs the actual process; FastAPI does not include its own server.
