FastAPI là modern Python web framework dựa trên Starlette (ASGI) + Pydantic.
Ưu điểm:
- Async native — ~20K RPS, Flask/Django ~4-5K RPS
- Auto OpenAPI docs — Swagger UI + ReDoc tự động từ type hints
- Type-based validation — Pydantic validate request/response
- Dependency Injection built-in
- ASGI hỗ trợ WebSocket, HTTP/2. Dùng FastAPI cho: microservices, AI/ML serving, real-time APIs. Django vẫn tốt cho enterprise apps với admin panel và nhiều features built-in
FastAPI is a modern Python framework built on Starlette (ASGI) + Pydantic.
Advantages:
- Async native — ~20K RPS vs Flask/Django ~4-5K RPS
- Auto OpenAPI docs from type hints
- Pydantic type-based validation
- Built-in Dependency Injection
- WebSocket, HTTP/2 support. Use for: microservices, AI/ML serving, real-time APIs