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 viarelease_command. - No → mock/demo data: lives in
backend/src/db/mocks/, loads at startup only whenAUTO_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:
- Deterministic UUIDs:
deterministicUuid(UUID_NAMESPACES.X, key)(frommocks/utils; renamed fromseedUuid/SEED_NAMESPACES) - Marker check → skip if found → insert (idempotent, incremental)
- Register in
mocks/index.ts
Loading:
| Mechanism | Behaviour |
|---|---|
AUTO_MOCK=true at startup | local / pr-preview / development only; legacy AUTO_SEED honoured as deprecated alias |
make db-mock | Load mock/demo data (idempotent); db-seed is a deprecated alias |
make db-mock-large | Additional large-scale data (~300 collections / ~500 sets / ~3000 documents); db-seed-large deprecated alias |
mocks/minimal.ts | Lightweight 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-syncruns beforedb:mockon 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 registrybackend/src/db/mocks/minimal.ts— PR-preview minimal setbackend/src/db/mocks/utils.ts—deterministicUuid,UUID_NAMESPACESbackend/src/db/config-export.ts— config snapshot export
See Also
- Database Migrations — config data delivery mechanism
- PR Preview Deployments — minimal mock data + ephemeral DBs
- Makefile Commands —
make db-mock,make db-mock-large,make config-export - Database Architecture — connections and pooling