Skip to content

Getting Started

This guide walks you through setting up a local Patrimoine development environment. You can run the full stack in containers (recommended) or develop the backend and frontend separately without containers.


  • Podman 6+ (or Docker) — includes podman compose.
  • (Optional) An OIDC provider such as Authentik. If you don’t have one, the app falls back to local email/password auth.

Terminal window
git clone <url> patrimoine
cd patrimoine
Terminal window
mkdir -p ./data

This directory is bind-mounted into the backend container and holds the SQLite database file (patrimoine.db).

Terminal window
cp backend/container/env.example backend/container/.env

The frontend, web and PostgreSQL containers have their own optional templates (frontend/container/env.example, web/container/env.example, data/container/env.example); the defaults work without them. See Environment Variables.

Open backend/container/.env and set the following:

Variable Value
JWT_SECRET A long random string. Generate one with: python -c "import secrets; print(secrets.token_urlsafe(48))"
OIDC_ENABLED true to use OIDC (also needs OIDC_CLIENT_ID); leave unset for local auth only
OIDC_CLIENT_ID Your OIDC client ID (only used when OIDC_ENABLED=true)
OIDC_CLIENT_SECRET Your OIDC client secret (if using OIDC)
OIDC_ISSUER OIDC discovery URL (e.g. http://localhost:9000/application/o/patrimoine/)
OIDC_REDIRECT_URI Optional. Defaults to FRONTEND_URL + /auth/callback; set it only if the registered redirect differs
FRONTEND_URL http://localhost:8080 (or your production URL)
REGISTRATION_ENABLED true — needed to create the first account, then set to false
ADMIN_EMAILS Your account’s email — promotes an OIDC account to admin (optional, OIDC only, see step 7)
Terminal window
podman compose --env-file backend/container/.env up --build

(Or ./podman.sh build && ./podman.sh up, which reads the per-container env files itself.) The first build takes 2–5 minutes (backend, frontend and docs images). Subsequent starts are instant thanks to layer caching.

Open http://localhost:8080 in your browser. The documentation site is served at http://localhost:8082 (SITE_PORT in web/container/.env).

  • OIDC configured: you will be redirected to Authentik to authenticate.
  • OIDC off (the default): the local login page appears. Click “Créer un compte” to register if REGISTRATION_ENABLED=true.
  1. Create your account via “Créer un compte”.
  2. Set REGISTRATION_ENABLED=false in backend/container/.env and restart:
    Terminal window
    podman compose down && podman compose --env-file backend/container/.env up -d
  3. Admin access: with local auth, the first account registered on an empty instance is made admin automatically — ADMIN_EMAILS never applies to local accounts. With OIDC, if you set ADMIN_EMAILS to your account’s email in step 4, log back in (or refresh) to complete the promotion. Either way your account gains an admin-only “Users” page for managing other accounts, from which you can invite additional users by email without ever re-enabling public registration. See Environment Variables and Troubleshooting for details.

For faster iteration, run the backend and frontend directly on your host.

Terminal window
cd backend
uv sync
uv run uvicorn app.main:app --reload --port 8000
Terminal window
cd frontend
npm ci
npm run dev

The Vite dev server runs on port 5173 and proxies /api and /auth requests to the backend on port 8000.

The backend reads a .env file from its working directory, so for local runs copy the backend template there (cp backend/container/env.example backend/.env) and uncomment (or add) these lines in backend/.env:

Terminal window
DEBUG=true
FRONTEND_URL=http://localhost:5173
OIDC_REDIRECT_URI=http://localhost:8000/auth/callback
DATABASE_URL=sqlite+aiosqlite:///data/patrimoine.db

The ci-local.sh script replicates the Forgejo CI pipeline locally:

Terminal window
./ci-local.sh # all checks (backend + frontend + security)
./ci-local.sh backend # lint, test, OpenAPI schema, migration round-trip
./ci-local.sh backend-cov # backend whole suite with coverage (slower; not part of 'all')
./ci-local.sh frontend # lint, type check, test, build, size limit, bundle checks
./ci-local.sh security # pip-audit, npm audit, gitleaks secret scan

See Testing for details on each test layer.