5 ms·
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+. It is one of the fastest Python frameworks available, as measure
by tiangolo 8y ago
FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+. It is one of the fastest Python frameworks available, as measured by independent benchmarks.
It is based on standard Python type hints. Using them, you get automatic data validation, serialization, and documentation. Including deeply nested JSON documents. And you get editor completion and checks everywhere.
Designed around the OpenAPI (Swagger) and JSON Schema standards.
It includes 2 alternative interactive API documentation systems that are generated automatically.
OAuth2 capable from the start (including JWT). Dependency Injection system, compatible with all databases (relational and NoSQL), Websockets, GraphQL, CORS, etc.
- franey 8y agoIt seems like a lot of the "FastAPI features"[1] are coming not from FastAPI but from Starlette: - Just Modern Python - Editor support - Short - Unlimited "plug-ins" Would it be fair to say that this is Starlette + an API schema + OAuth2 + data validation? [1] https://fastapi.tiangolo.com/features/#fastapi-features https://fastapi.tiangolo.com/features/#fastapi-features
- tiangolo 8y agoYes! Sort of... Most of FastAPI features come from Starlette AND Pydantic. In FastAPI you declare the parameters of your request (including deeply nested JSON bodies) as function parameters. So, "editor support" here means, for example, autocomplete even for deeply nested models. Also, you get automatic data validation and serialization. Automatic detailed errors in your API responses. Also, it has a powerful dependency injection system, that helps in a lot of cases.
- gravypod 8y agoDo you have any examples of a good project layout? How do I have multiple controllers, large numbers of models, etc. There's very little in the way of "just a restful backend" templates in Python.
- tiangolo 8y agoYep, there are a couple of project generators, including Docker integration, Celery, a simple frontend, load balancer with HTTPS etc. In two flavors: * With PostgreSQL and SQLAlchemy: https://github.com/tiangolo/full-stack-fastapi-postgresql https://github.com/tiangolo/full-stack-fastapi-postgresql * With Couchbase: https://github.com/tiangolo/full-stack-fastapi-couchbase https://github.com/tiangolo/full-stack-fastapi-couchbase