Seed Data

Seed data

`pnpm db:seed` upserts eight system roles and forty-eight permissions, then repairs each system role's grant set to the reviewed seed definition. Repeated runs are safe for these d

Use this when...

Use this when you need a quick orientation to Seed Data.

Deterministic authorization data

pnpm db:seed upserts eight system roles and forty-eight permissions, then repairs each system role's grant set to the reviewed seed definition. Repeated runs are safe for these deterministic system records.

Seeded permission keys:

dashboard.view
users.view          users.manage
roles.view          roles.manage
crm.view            crm.manage
audits.view         audits.manage
quotes.view         quotes.manage
approvals.view      approvals.manage
documents.view      documents.manage
finance.view        finance.manage       finance.approve
projects.view       projects.manage      projects.approve
support.view        support.manage       support.approve
inventory.view      inventory.manage     inventory.approve
command_center.view command_center.manage
alerts.view         alerts.manage
required_actions.view required_actions.manage
search.view
knowledge.view      knowledge.manage      knowledge.approve
source_truth.view   source_truth.manage
imports.view        imports.manage       imports.approve
drive_sources.view  drive_sources.manage
migration.view      migration.manage
settings.view       settings.manage

Development administrator

When SEED_ADMIN_NAME, SEED_ADMIN_EMAIL, and SEED_ADMIN_PASSWORD are all present, the seed creates or updates one local verified user, creates a Better Auth credential account with a scrypt hash, and assigns Founder/Admin. The password must have at least 12 characters and is never logged.

If any administrator variable is absent, role/permission seeding continues and user creation is skipped. Never reuse the sample local identity or password in production.

Caution

Rerunning seed resets grants for the eight system roles. Feature records are not created unless local-only sample flags below are explicitly enabled. Production seeding and the first production administrator bootstrap require a separate controlled procedure.

Optional local CRM sample

SEED_CRM_SAMPLE_DATA=true adds deterministic Sprint 3 examples for all six CRM models after the development administrator is available. It is off by default, safe to rerun, and rejected when NODE_ENV=production. The records are examples only and must never be treated as customer data.

Optional local audit sample

SEED_AUDIT_SAMPLE_DATA=true adds one deterministic Sprint 4 audit, load items, findings, a calculation snapshot, and an activity-log entry after the development administrator is available. It is off by default, safe to rerun, and rejected when NODE_ENV=production.

The audit sample creates or reuses CRM context so the audit can demonstrate company/contact/opportunity links. The records are examples only and must never be treated as customer data.

Optional local inventory sample

SEED_INVENTORY_SAMPLE_DATA=true adds deterministic Sprint 10 products, categories, a supplier, stock locations, stock items, an explicit movement, a reservation, aliases, a product document placeholder, and product links for sample quote items when those records exist. It is off by default, safe to rerun, and rejected when NODE_ENV=production.

The inventory sample can run alone for product/stock examples, but it becomes more useful when the quote, project, and support sample flags are also enabled.

Optional local command-center sample

SEED_COMMAND_CENTER_SAMPLE_DATA=true adds deterministic Sprint 11 system alert, required action, executive snapshot, and activity-log examples after the development administrator is available. It is off by default, safe to rerun, and rejected when NODE_ENV=production.

The command-center sample can run alone for basic UI examples, but the dashboard is more meaningful when the CRM, audit, quote, finance, project, support, and inventory sample flags are also enabled.

Knowledge foundation records

pnpm db:seed creates deterministic Sprint 12 source-of-truth registry records and data-dictionary entries for the existing sheets/docs/modules named in the Sprint 12 brief. These are foundation records, not customer data.

Optional local knowledge sample

SEED_KNOWLEDGE_SAMPLE_DATA=true adds deterministic local-only knowledge, SOP, decision, entity link, document index placeholder, search index record, and activity-log examples after the development administrator is available. It is off by default, safe to rerun, and rejected when NODE_ENV=production.

Import staging foundation records

pnpm db:seed creates deterministic Sprint 13 import source registry companions for the existing Sprint 12 source-of-truth records. These records verify source provenance and staging links only.

Optional local import sample

SEED_IMPORT_SAMPLE_DATA=true adds local-only import mappings, column mappings, dry-run rows, validation issues, duplicate candidates, approval request, migration audit entries, and activity-log examples after the development administrator is available. It is off by default, safe to rerun, and rejected when NODE_ENV=production.

Developer Details
Source
apps/docs/content/seed-data.md
Owner
Module Owner
Status
Needs Review
Module
Seed Data
Related route
None