Database Seeding
47 seed files populate the database with reference data, test fixtures, and real German funding programs.
Entry Points
| File | Purpose |
|---|---|
backend/src/db/seeds/index.ts | Main orchestrator — manages seed order and dependencies |
backend/src/db/seeds/minimal.ts | Minimal seed: 3 Users, 3 Buildings, 5 Projects (<30s, used for PR Preview Deployments) |
Deterministic UUIDs
All seed records use deterministic UUIDs for idempotency:
import { seedUuid, SEED_NAMESPACES } from './seed-utils';
seedUuid(SEED_NAMESPACES.USER, 'admin@renewa.de');Seed Pattern
- Check for marker record
- Skip if already seeded
- Insert with
seedUuid()
This makes seeds idempotent and incremental. Auto-runs on startup when AUTO_SEED=true.
Large Seed Files
| Seed File | Size | Content |
|---|---|---|
document-templates-data.ts | 319KB | Document template definitions |
products.ts | 173KB | Full product catalog |
typology-u-values.ts | 173KB | Building U-value reference data |
hubspotPropertyMappings.ts | 70KB | HubSpot field mappings |
document-obtaining.ts | 64KB | Document workflow data |
form-builder/fields.ts | 45KB | Form field definitions |
Infrastructure Seeds
| Category | Seeds |
|---|---|
| Organization | Departments, employees, roles |
| Workflows | Workflow definitions, steps, transitions |
| Forms | Form templates, field definitions |
| Documents | Templates, collection settings |
| Permissions | Roles, permissions, assignments |
Real German Funding Programs
Seeds include actual funding program data:
- KfW BEG WG — Bundesfoerderung fuer effiziente Gebaeude (Wohngebaeude)
- KfW BEG EM — Einzelmassnahmen
- BAFA BEG EM — BAFA efficiency measures
- IFB Hamburg — Regional Hamburg programs
Running Seeds
make db-seed # Run all seeds
AUTO_SEED=true # Auto-seed on container startupSee Makefile Commands for all database commands.
Key Files
backend/src/db/seeds/index.tsbackend/src/db/seeds/minimal.tsbackend/src/db/seeds/seed-utils.tsbackend/src/db/seeds/*.ts(47 files)
See Also
- Database Migrations — schema must be migrated before seeding
- Database Architecture — database connection and pooling
- Makefile Commands —
make db-seed - Docker Setup — container startup behavior