Quick Start in Python

From the FastAPI cheat sheet · Installation & Setup · verified Jul 2026

Quick Start

Install FastAPI with uvicorn and create a basic application.

python
# Install
pip install "fastapi[standard]"

# main.py
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
async def root():
    return {"message": "Hello World"}

# Run
fastapi dev main.py
💡 "fastapi[standard]" includes uvicorn, email-validator, and other essentials
⚡ Auto-generated docs at /docs (Swagger) and /redoc — no setup needed
📌 Use "fastapi dev" for development (auto-reload) and "fastapi run" for production
🟢 Both sync (def) and async (async def) route handlers are supported
installsetupquickstart
Back to the full FastAPI cheat sheet