Dev Container Setup (VS Code)
For developers who want a fully containerized development environment. Everything runs inside Docker — no local Node.js or pnpm required.
Prerequisites
| Tool | Version |
|---|---|
| Docker Desktop | 4.40+ |
| VS Code | Latest |
| Dev Containers extension | Latest |
First-Time Setup
- Clone the repo and ensure the production stack is running (
docker compose up -d) - Open the repo folder in VS Code
- Press
F1and select Dev Containers: Reopen in Container - Wait for the dev databases to start, migrations to run, and sanitized data to populate
The dev server starts automatically on port 3001. Open http://localhost:3001 in your browser. Production remains on port 3000.
Before starting the Contributor preview, set CONTRIBUTOR_PREVIEW_PASSWORD in
the repository .env to a development-only password of at least 12 characters.
Do not reuse ADMIN_PASSWORD or another live credential.
Login: preview-admin@dpf.test / the value of
CONTRIBUTOR_PREVIEW_PASSWORD in .env.
What the Dev Container Provides
- An isolated PostgreSQL database (separate from production), including vector and graph storage
- Sanitized copy of production data (PII obfuscated, credentials replaced)
- Shared LLM inference via Docker Model Runner (no duplication)
- Pre-installed extensions: ESLint, Prisma, Tailwind CSS, Prettier
- Hot-reload Next.js dev server
Important Notes
- Build Studio and VS Code should be treated as complementary interfaces, not separate source trees
- Production promotion still belongs to the portal’s governed workflow
- The sanitized clone runs on first startup — production must be running as the data source
- Contributor database readiness verifies both PostgreSQL connectivity and pgvector availability before migrations start. If
dev-postgresremains unhealthy, inspect its health output and recreate that contributor-only service from the checked-inpgvector/pgvector:pg16image; do not bypassdev-initor edit an applied migration. - Migration deploy for the preview runs through a disposable-only converge wrapper (
packages/db/scripts/dev-preview-migrate-deploy.mjs). The known20260605060000_hive_contributions_surfacedrift remains independently allowlisted: before marking it applied, the wrapper verifies every owned schema effect, including required column types, nullability, declared defaults, ledger primary key and original indexes. Additive effects from later immutable migrations are permitted. - The separate
20261114130000_relation_drift_repairrecovery restores missing migration-owned graph reference rows only when both immutable SQL files match their reviewed hashes, the earlier registry migration has matching completed history, the registry shape matches, and the only active failed migration has the exact matching checksum and known missingPART_OF/DEPENDS_ONforeign-key error. Restoration rechecks this proof under a transaction lock, uses the original registry migration’s missing-only insert, and verifies every expected key before committing. Existing labels, statuses and custom rows are retained. Prisma then marks the failed attempt rolled back and actually reruns migration deploy once; this migration is never marked applied. A second failure stops the attempt. Wrong destination, source/history/schema mismatch or unrelated failure remainsblocked_sandbox_drift; retain the evidence and use the governed recovery path rather than editing history or deleting the volume. - A successful migration deploy also checks dictionary custody. A complete dictionary needs no repair. Missing rows can be restored only for the demonstrated completed-history shape: one exact completed drift migration with one applied step, one exact rolled-back zero-step drift attempt carrying the known foreign-key diagnostic, matching original registry history/source/schema, and no active failed migration. This branch uses the same locked, missing-only original insert, without any Prisma history command or migration replay. Different history shapes require an explicitly qualified source change; they never fall through to automatic recovery.
- Before preview initialization, the governed helper compares the canonical image’s actual clone source checksum with the verified mounted source. Missing or different bytes refuse startup before stopping or initializing the preview. Ask the designated canonical upgrade owner to install the protected repair; mounting corrected source does not replace the clone baked into the initializer. This identity check is separate from an actual served acceptance check, and neither resolves unknown historical actor attribution.
-
Disposable recovery (contributor preview only): when logs say
blocked_sandbox_driftand name volumedpf_dev_pgdata, recreate that volume and re-run the dev profile. Never delete live portal volumes (dpf_pgdata/ production Postgres). Example:docker compose --profile dev stop dev-portal dev-init dev-postgres docker volume rm dpf_dev_pgdata docker compose --profile dev up -d - The clone resets the disposable development application tables before copying. Restricted provider, credential, token, and connection records are not copied; production-derived search/vector values are omitted rather than carrying source terms or embeddings into the preview.
- The preview copies production’s data, never its identity. After copying, the clone removes production’s installation identity (installation id and signing key), its operating intent and environment declaration, its estate identity, and every federation link, outbox record and delivery job. The preview therefore never presents itself to a paired installation as production, and it starts with no federation links of its own.
- Every copied workforce password remains invalid. After sanitization, the clone provisions only
preview-admin@dpf.testfrom the separate development-onlyCONTRIBUTOR_PREVIEW_PASSWORD; production hashes and passwords are never reused. Authorization memberships are omitted with their restricted platform roles, so the preview cannot retain dangling role references. - Additive source-schema differences are expected during concurrent development. Source-only columns or tables are left out of the preview, destination-only columns use their migrated defaults, and a shared column with an incompatible type stops the clone with a precise error instead of risking a corrupt preview.
- Before copying, the clone verifies the live source’s critical identity indexes and their heap semantics. A message naming
InventoryEntity_entityKey_keyorPlatformIssueReport_dedupeKey_open_keyis a source-integrity stop: the live source must be repaired through a forward migration before preview can proceed. Recreating the disposable preview volume cannot repair that source condition. - Clone publication is fail-safe: if any table cannot be copied or sanitized, the development application tables are cleared again while Prisma migration history and the installed migration-owned graph dictionary are retained. Both reset and source COPY exclude that dictionary, so an empty or older source cannot erase its installed reference rows. The Contributor preview will not start against a partially copied relational dataset. Correct the reported source/tooling error and use the governed development initialization path to retry. Deploy or revert the coupled reset/COPY policy together; a source rollback that restores dictionary deletion holds preview work instead of deleting restored rows or changing history.
Related
- Developer Setup — native pnpm + Docker sidecars alternative
- Development Workspace — how Build Studio, VS Code, and production promotion fit together