What Frameworks Shaped FastAPI? Lessons from Django, Flask, and More
This article explores the various Python frameworks and tools—Django, Django REST Framework, Flask, Requests, Swagger/OpenAPI, Marshmallow, Pydantic, Starlette, and Uvicorn—that inspired FastAPI, highlighting the features each contributed such as automatic documentation, micro‑framework flexibility, type‑hinted validation, and high‑performance async support.
The article explains what inspired the creation of FastAPI, compares it with alternative frameworks, and extracts the lessons learned. It emphasizes that without building on previous work, FastAPI would not exist.
Frameworks that Inspired FastAPI
Django
Django is the most popular Python framework, trusted for building systems like Instagram, and tightly coupled with relational databases such as MySQL or PostgreSQL, making NoSQL integration less straightforward.
Django REST Framework
Django REST Framework (DRF) is a flexible tool for building Web APIs and was the first framework to automatically generate API documentation, a key motivation for FastAPI. Its author, Tom Christie, also created Starlette and Uvicorn, which FastAPI builds upon.
DRF’s automatic API docs and UI inspired FastAPI’s own auto‑generated documentation and interactive web UI.
Flask
Flask is a lightweight micro‑framework without built‑in database integration, offering simplicity and flexibility that allow use of NoSQL databases and easy extension through plugins.
Its decoupled modules and simple routing system inspired FastAPI to become a micro‑framework that mixes and matches needed tools.
Requests
Requests is a popular HTTP client library. While FastAPI is not a replacement for Requests, it draws inspiration from Requests’ simple, intuitive design and reasonable defaults.
Requests is one of the most downloaded Python packages everExample of a GET request with Requests:
response = requests.get("http://example.com/some/url")Equivalent FastAPI route:
@app.get("/some/url")
def read_url():
return {"message": "Hello World"}Both use similar syntax such as requests.get(...) and @app.get(...), reflecting FastAPI’s goal of a simple, intuitive API with powerful defaults.
Swagger / OpenAPI
The desire for automatic API documentation led to the adoption of the Swagger/OpenAPI standard, which describes APIs in JSON or YAML and provides a web UI (Swagger UI, ReDoc) for interactive exploration.
FastAPI adopts an open standard for API specifications and integrates standard UI tools like Swagger UI and ReDoc.
Flask REST Frameworks
Several Flask REST frameworks were evaluated, but many are abandoned or have long‑standing issues, making them unsuitable for FastAPI’s goals.
Marshmallow
Marshmallow provides data serialization (converting objects to JSON, etc.) and validation, automating checks that would otherwise require manual code.
FastAPI’s inspiration: use code to define data types and validation schemas, with automatic validation.
Frameworks Used by FastAPI
Pydantic
Pydantic uses Python type hints for data validation, serialization, and JSON‑Schema documentation, offering fast performance and excellent editor support.
FastAPI relies on Pydantic for all data validation, serialization, and automatic model documentation.
Starlette
Starlette is a lightweight ASGI framework/toolkit designed for high‑performance asyncio services. It offers impressive performance, WebSocket, GraphQL, background tasks, events, testing utilities, CORS, GZip, static files, sessions, and 100% type‑annotated code.
Starlette provides the core web functionality; FastAPI extends it with data validation, dependency injection, security utilities, and OpenAPI generation.
Uvicorn
Uvicorn is a lightning‑fast ASGI server built on uvloop and httptools. It is the recommended server for both Starlette and FastAPI, often combined with Gunicorn for multi‑process async serving.
FastAPI recommends Uvicorn as the primary web server for deployment.
(Copyright belongs to the original author, please delete if infringing)
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
