Getting Started
Installation and basic setup
Installation & Setup
Install FastAPI and create your first app
bash
# Install FastAPI with all dependencies
pip install "fastapi[all]"
# Or minimal install
pip install fastapi
pip install uvicorn[standard]FastAPI Features
- Fast: Very high performance, on par with NodeJS and Go.
- Fast to code: Increase the speed to develop features by about 200% to 300%.
- Fewer bugs: Reduce about 40% of human (developer) induced errors.
- Intuitive: Great editor support. Completion everywhere. Less time debugging.
installationsetup
Basic Application
Create your first FastAPI application
Creating the App
python
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
# Run with: uvicorn main:app --reloadAutomatic Docs
- Interactive API docs: Automatic interactive API documentation (provided by Swagger UI).
- Alternative API docs: Alternative automatic documentation (provided by ReDoc).