|
| 1 | +--- |
| 2 | +user-invocable: false |
| 3 | +description: Use when writing code, adding features, or modifying the app |
| 4 | +--- |
| 5 | + |
| 6 | +# Towlion App Conventions |
| 7 | + |
| 8 | +Key conventions for Towlion application repositories: |
| 9 | + |
| 10 | +## FastAPI Backend |
| 11 | +- Entry point: `app/main.py` with a `FastAPI()` instance |
| 12 | +- Run with: `uvicorn app.main:app --host 0.0.0.0 --port 8000` |
| 13 | +- Must expose `GET /health` returning `{"status": "ok"}` with HTTP 200 |
| 14 | + |
| 15 | +## Project Layout |
| 16 | +- `app/` — Python backend (FastAPI) |
| 17 | +- `deploy/` — Docker Compose, Caddyfile, env.template |
| 18 | +- `scripts/` — Utility scripts (health-check.sh) |
| 19 | +- `frontend/` — Optional Next.js frontend |
| 20 | + |
| 21 | +## Dependencies |
| 22 | +- `requirements.txt` at repo root (not inside `app/`) |
| 23 | +- Must include `fastapi` and `uvicorn` |
| 24 | +- Dockerfile build context is `..` (repo root) to access both `requirements.txt` and `app/` |
| 25 | + |
| 26 | +## Database |
| 27 | +- PostgreSQL via SQLAlchemy |
| 28 | +- Migrations with Alembic (`app/alembic/`) |
| 29 | +- Connection via `DATABASE_URL` env var |
| 30 | + |
| 31 | +## Background Tasks |
| 32 | +- Celery with Redis as broker |
| 33 | +- Workers run as separate containers |
| 34 | +- Connection via `REDIS_URL` env var |
| 35 | + |
| 36 | +## Environment Variables |
| 37 | +- All config via env vars, never hardcode secrets |
| 38 | +- Template in `deploy/env.template` |
| 39 | +- Required: `APP_DOMAIN`, `DATABASE_URL`, `REDIS_URL` |
| 40 | + |
| 41 | +## Commit Convention |
| 42 | +- Format: `type: description` (lowercase type, no scope) |
| 43 | +- Types: `feat`, `fix`, `docs`, `chore`, `refactor`, `test`, `ci` |
| 44 | +- No Conventional Commits scope syntax — just `type: description` |
| 45 | + |
| 46 | +## Docker |
| 47 | +- Two compose files: `docker-compose.yml` (multi-app), `docker-compose.standalone.yml` (full stack) |
| 48 | +- App container exposes port 8000 |
| 49 | +- Include healthcheck in compose definition |
0 commit comments