This guide covers setting up the Python FastAPI template for local development or GitHub Codespaces.
- Python 3.10+
- pip / pipx
- Docker (optional — SQLite works without it)
Open this repo in GitHub Codespaces. The devcontainer installs all dependencies automatically. After the container builds:
./scripts/install.sh # Set up venv, install deps, init DB
./scripts/dev.sh # Start dev server with hot-reloadOpen http://localhost:8000 in your browser.
git clone <repo-url>
cd <repo-name>
# Install Python dependencies + set up environment
./scripts/install.sh
# Start dev server
./scripts/dev.sh
# → http://localhost:8000- Creates
.venv/and installsrequirements-dev.txt - Detects Docker contexts
- Checks for
age/sops(for secrets encryption) - Installs
clasi,dotconfig,rundbatvia pipx - Resets CLASI history if this is a fresh project from the template
- Generates
.envfromconfig/dev/public.env+ secrets - Runs
alembic upgrade headto create the database
All config is in .env (generated by install.sh). See
config/dev/public.env for non-secret defaults and
config/dev/secrets.env.example for required secrets.
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
sqlite:///./data/dev.db |
Database connection string |
SECRET_KEY |
(required) | Session / token signing key |
DEPLOYMENT |
dev |
Environment name |
APP_NAME |
Python App Template |
Display name |
DEBUG |
false |
Enable debug logging |
- Start a Postgres container:
rundbat create dev - Set
DATABASE_URL=postgresql+asyncpg://...in.env - Add
asyncpgtorequirements.txt - Run
alembic upgrade head
python3 -m pytest tests/ -vruff check app/ tests/
ruff format app/ tests/# Apply pending migrations
alembic upgrade head
# Create a new migration (after changing app/models.py)
alembic revision --autogenerate -m "describe your change"
# Roll back one step
alembic downgrade -1