|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Cursor Cloud specific instructions |
| 4 | + |
| 5 | +This is a single web app: a FastAPI + Jinja2 backend with a PostgreSQL database |
| 6 | +(server-rendered HTML + htmx, no JS build step). End-to-end testing requires two |
| 7 | +services: **PostgreSQL** and the **Uvicorn** dev server. Resend (email) is |
| 8 | +optional; most flows work without it and automated tests mock it. |
| 9 | + |
| 10 | +Standard install/lint/test/run commands live in `README.md` and `pyproject.toml`; |
| 11 | +prefer those. The notes below are the non-obvious, environment-specific caveats. |
| 12 | + |
| 13 | +### Starting services |
| 14 | + |
| 15 | +- **Docker is not managed by systemd here.** Start the daemon manually before |
| 16 | + using Postgres: run `sudo dockerd` as a background process (e.g. in a tmux |
| 17 | + session), then wait until `sudo docker info` succeeds. Docker CLI commands |
| 18 | + require `sudo`. |
| 19 | +- **Postgres** runs via Docker Compose: `sudo docker compose up -d`. It reads |
| 20 | + `DB_USER`/`DB_PASSWORD`/`DB_NAME`/`DB_PORT` from `.env` (port 5432). |
| 21 | +- **Dev server**: `uv run python -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload`. |
| 22 | + Tables and default roles/permissions are created automatically on startup via |
| 23 | + the FastAPI lifespan handler, so no manual migration step is needed. |
| 24 | + |
| 25 | +### Environment file |
| 26 | + |
| 27 | +- `.env` is required and git-ignored, so it is not in a fresh checkout. If it is |
| 28 | + missing, recreate it: `cp .env.example .env`, set `SECRET_KEY` to a 32+ byte |
| 29 | + value (`openssl rand -base64 32`), and set `DB_NAME` (e.g. |
| 30 | + `fastapi-jinja2-postgres-webapp`). The pytest suite sets its own env vars in |
| 31 | + `tests/conftest.py` and does not read `SECRET_KEY`/`DB_NAME` from `.env`, but it |
| 32 | + does need a running Postgres. |
| 33 | + |
| 34 | +### Testing |
| 35 | + |
| 36 | +- The pytest suite (`uv run pytest tests/`) needs Postgres running and Playwright |
| 37 | + Chromium installed (`uv run playwright install --with-deps chromium`). A full |
| 38 | + run takes ~3 minutes. Tests use PostgreSQL (no SQLite fallback) and drop/recreate |
| 39 | + a `webapp-test-db` database each run. |
| 40 | +- If dropping tables fails due to a schema change, reset the DB with |
| 41 | + `sudo docker compose down -v && sudo docker compose up -d`. |
0 commit comments