Skip to content

Development

Niels Franke edited this page Nov 16, 2026 · 2 revisions

Development

Running the stack locally without Docker, for hacking on the code. For production deployment see Self-Hosting and Deployment; for the full technical design see ARCHITECTURE.md in the repository.

Stack

Layer Tech
Backend Python 3.12 · FastAPI · SQLAlchemy · Alembic · Pydantic v2
Frontend Next.js 16 (App Router) · TypeScript · Tailwind · shadcn/ui
Database SQLite
Storage Local filesystem

Backend

cd backend
python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Point the default /data paths at a local dir (a backend/.env works too):
export DB_URL=sqlite:////tmp/cs-dev/contactsheet.db UPLOAD_DIR=/tmp/cs-dev/uploads \
       EXPORTS_DIR=/tmp/cs-dev/exports BRANDING_DIR=/tmp/cs-dev/branding \
       WATERMARKS_DIR=/tmp/cs-dev/watermarks

alembic upgrade head
uvicorn app.main:app --reload --port 8000

The backend's defaults (/data/...) only exist inside the container. Without a local DB_URL and all four *_DIR paths it will fail to start with a read-only-filesystem error (uploads also spool under EXPORTS_DIR/.tmp).

Frontend

cd frontend
npm install
npm run dev   # http://localhost:3000

The Next.js dev server proxies /api/* and /uploads/* to http://localhost:8000 (set NEXT_PUBLIC_API_BASE to point it elsewhere).

Checks

# frontend
npm run lint       # ESLint
npm test           # Vitest unit tests
npm run build      # production build + tsc --noEmit type-check

# backend (from backend/, after pip install -r requirements-dev.txt)
.venv/bin/pytest               # unit suite

# end-to-end smoke test (from the repo root; boots its own isolated stack — see e2e/README.md)
backend/.venv/bin/pytest e2e/

# backend — create a migration after a model change
.venv/bin/alembic revision -m "describe_change"
.venv/bin/alembic upgrade head

Conventions

  • Clean layers: router → service → repository. No business logic in route handlers.
  • UUIDv4 primary keys — never expose auto-increment IDs.
  • Soft delete (deleted_at) on galleries and images.
  • Alembic migration required for every schema change.
  • REST API first — every feature should be reachable through the API.

Translations

UI strings live in frontend/messages/{en,de}.json (English is the source of truth). Validate before committing catalog changes:

cd frontend && node scripts/validate-i18n.mjs

See Translating for the community translation flow via Weblate.


Back to the Home index.

Clone this wiki locally