mot.fastapi/
├── app/
│ ├── config/
│ ├── controllers/
│ ├── core/
│ ├── db/
│ ├── models/
│ ├── routes/
│ ├── security/
│ ├── services/
│ └── main.py
├── migrations/
├── scripts/
├── seeds/
├── tests/
├── alembic.ini
├── docker-compose.yaml
├── Dockerfile
├── pyproject.toml
├── pytest.ini
└── ruff.toml
Clone this repo snrub.api and the frontend snrub.client into a folder adjacent to each other.
In snrub.api Copy .env.example -> .env.development and fill in the values
Build with docker for local development
docker-compose up -d --buildAPI documentation is available via Scalar at:
Stop and remove the containers
$ docker compose down
Log output from the application:
docker compose logs -f api
docker compose logs -f client
Mailhog is used for password reset flows it can be accessed on
Hit this endpoint with with token (must be super admin)
GET http://localhost:8000/api/admin/migrate
Or with Docker
To generate a new migration file, run the following command:
docker compose exec api alembic revision --autogenerate -m "Your migration message"Run migrations:
docker compose exec api alembic upgrade headConnect to the PostgreSQL container:
docker-compose exec db psql -U postgres -d mot_database
Once connected, you can run SQL commands:
postgres=# SELECT * FROM users; # View users table
Docker needs to be up and running for integration tests to work.
Run all tests
APP_ENV=test uv run pytestJust run integration tests
APP_ENV=test uv run pytest tests/integrationExport current dev DB state (new users + incident reports) to seed-friendly format:
docker compose exec api python scripts/export_seed_data.py- New users are printed as dicts to append to
seeds/data/users.py, photos written toseeds/data/photos/ - Incident reports are printed as the full
INCIDENT_REPORTSlist forseeds/data/incident_reports.py
Seeds run automatically on docker compose up. To re-seed manually:
docker compose exec api python -m seeds.seed_runneruv run ruff check . --fix
uv run ruff format .