Deployment

Build, migrate, run the web process and the worker, and check readiness.

ScriptEffect
npm run buildkeystone build --no-ui && next build; does not migrate
npm run migrateprisma migrate deploy (creates row-level security policies, so the database role must be one you control)
npm startnext start
npm run workerRuns validate:env, then the background worker
npm run validate:envChecks required environment
npm run verify:audit, verify:migrations, verify:retained-upgradeAudit-chain and migration checks; migration checks need disposable databases (MIGRATION_SHADOW_DATABASE_URL)
npm run build
npm run migrate     # against a backed-up database
npm start
npm run worker      # separate long-running process

Settlement, webhook delivery, recovery, scheduled jobs, and audit anchoring depend on the worker. If it is not running those queues do not drain.

Production environment

Set DATABASE_URL, SESSION_SECRET (32+ characters), CUSTOMER_IDENTITY_SECRET (32+), PII_ENCRYPTION_KEY, OUTBOUND_WEBHOOK_SECRET and WEBHOOK_EGRESS_HOSTS for outbound webhooks, AUDIT_ANCHOR_DIR and AUDIT_ANCHOR_SECRET for anchoring, METRICS_BEARER_TOKEN for probes, SMTP for recovery emails, and the Authorize.net variables for payments.

Health

  • /api/health returns ok with the service name and time.
  • /api/ready checks migrations, stale worker leases, degraded providers, oldest pending queue age, worker heartbeats, row-level security coverage, exposure consistency, audit anchoring, and privileged operators without MFA. Detail needs METRICS_BEARER_TOKEN in production.
  • /api/metrics returns Prometheus text (wagers, queues, providers, dead letters, incidents, markets, journal imbalance) and 404s without the bearer token in production.
  • Set OTEL_EXPORTER_OTLP_ENDPOINT for OpenTelemetry from the app and worker.

After deploy

Create the first operator at /dashboard/init, enrol two-factor, run onboarding, and create the independent approver. See Getting started.

On this page