Mock and Config Data

“Seeding” is retired as a concept (PR#1573). Data the app needs is split into two categories that must never mix, plus a third category owned by the Entra sync. Supersedes Database Seeding.

Decision Rule

Would the app fail in production without this row?

  • Yes → config data: ships as a DB migration (make db-generate NAME=config_<thing>), runs in every environment via release_command.
  • No → mock/demo data: lives in backend/src/db/mocks/, loads at startup only when AUTO_MOCK=true.

NEVER put config data in mocks/ — staging and production set AUTO_MOCK=false, so it silently breaks there.

Mock / Demo Data

~50 TypeScript modules in backend/src/db/mocks/ (demo users, buildings, projects, invoices, funding programs like KfW BEG WG/EM, BAFA BEG EM, IFB Hamburg, form-builder fixtures, e2e bot accounts, …).

Pattern for each mock module:

  1. Deterministic UUIDs: deterministicUuid(UUID_NAMESPACES.X, key) (from mocks/utils; renamed from seedUuid/SEED_NAMESPACES)
  2. Marker check → skip if found → insert (idempotent, incremental)
  3. Register in mocks/index.ts

Loading:

MechanismBehaviour
AUTO_MOCK=true at startuplocal / pr-preview / development only; legacy AUTO_SEED honoured as deprecated alias
make db-mockLoad mock/demo data (idempotent); db-seed is a deprecated alias
make db-mock-largeAdditional large-scale data (~300 collections / ~500 sets / ~3000 documents); db-seed-large deprecated alias
mocks/minimal.tsLightweight set for PR Preview Deployments: 3 users, 3 buildings, 5 projects, essential reference data (<30s vs 3-5 min full load)

Config Data

Rows the app needs to function (enum lookups, system permissions, default workflows, …) ship as migrations so they run idempotently in every environment including staging/production. Document templates, filters, and forms were baselined from staging via migration (PR#1789); mock infrastructure no longer touches them.

make config-export exports a JSON snapshot of config tables (backend/src/db/config-export.ts + config-manifest.ts) — export only, no import counterpart yet.

Third Category — Entra-Owned

Departments and internal employees come from the Entra sync, not from mocks or migrations (spec: docs/superpowers/specs/2026-06-09-mock-people-defer-to-entra-design.md):

  • db:entra-sync runs before db:mock on local/pr-preview/development
  • Hourly BullMQ scheduler keeps them fresh in every environment
  • Neither mocks nor migrations may re-seed them

Key Files

  • backend/src/db/mocks/index.ts — orchestrator + module registry
  • backend/src/db/mocks/minimal.ts — PR-preview minimal set
  • backend/src/db/mocks/utils.tsdeterministicUuid, UUID_NAMESPACES
  • backend/src/db/config-export.ts — config snapshot export

See Also