A minimal FastAPI "Hello, World!" service, managed with uv.
This main branch contains only the app and local dev setup. Deployment is demonstrated on two separate branches:
deploy-script— deploy with a localgcloudscript (deploy.sh).deploy-github— deploy from GitHub via a GitHub Actions workflow.
- Python 3.13
- FastAPI + Uvicorn (standard)
- uv for dependency / venv management
- Docker (python:3.13-slim + uv binary from
ghcr.io/astral-sh/uv)
.
├── main.py # FastAPI app (/, /healthz)
├── pyproject.toml # project metadata + deps
├── uv.lock # locked dependency graph
├── .python-version # pins Python 3.13 for uv
├── Dockerfile # uv-based container build
└── .dockerignore
| Method | Path | Response |
|---|---|---|
| GET | / |
{"message": "Hello, World!"} |
| GET | /healthz |
{"status": "ok"} |
| GET | /docs |
Swagger UI |
| GET | /redoc |
ReDoc UI |
- uv (
brew install uv) - Docker (only if you want to build/run the container locally)
uv sync
uv run uvicorn main:app --reload --port 8080Then:
curl http://localhost:8080/
curl http://localhost:8080/healthz
open http://localhost:8080/docsuv add <package> # add a runtime dep
uv add --dev <package> # add a dev-only dep
uv remove <package> # remove a dep
uv lock --upgrade # refresh uv.lockdocker build -t fastapi-basic .
docker run --rm -p 8080:8080 fastapi-basicThe image installs deps with uv sync --frozen --no-dev against uv.lock, so the container matches local exactly.
Check out one of the deploy branches:
git checkout deploy-script # local gcloud-based deploy
# or
git checkout deploy-github # GitHub Actions deploy