A small FastAPI app used in the Light Cloud tutorial FastAPI in production: from main.py to a public URL.
Light Cloud finds main.py and requirements.txt, installs the requirements and starts
uvicorn main:app on the port it gives the container. No Dockerfile needed.
flowchart LR
push[git push] --> lc[Light Cloud build]
lc -->|pip install -r requirements.txt| img[Container image]
img -->|uvicorn main:app on PORT| api[FastAPI app]
api --> docs[/docs interactive docs/]
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
fastapi dev main.pyThen open http://127.0.0.1:8000/docs.
| Route | What it does |
|---|---|
GET / |
greeting |
GET /health |
{"status":"ok"} |
GET /books |
list books (in memory) |
POST /books |
add a book; validated by Pydantic |
GET /books/{id} |
one book, or 404 |