This guide defines the production deployment order for the Trust-Link backend. Use it for staging and production releases so infrastructure, database migrations, service rollout, and validation happen in a consistent sequence.
- Node.js 20 runtime.
- PostgreSQL 15 or newer.
- Redis for response and tracking cache when
REDIS_URLis configured. - Stellar Horizon access for the selected network.
- SendGrid and Twilio credentials when notifications are enabled.
- HTTPS termination at the load balancer or ingress.
- Centralized log collection for JSON logs.
- OpenTelemetry collector when tracing is enabled.
Set all required variables before running migrations or starting the service:
NODE_ENV=productionPORTDATABASE_URLSEP10_JWT_SECRETADMIN_ADDRESSSTELLAR_NETWORKSTELLAR_WEBHOOK_SECRETREDIS_URLALLOWED_ORIGINSAPI_BASE_URLSENDGRID_API_KEYTWILIO_ACCOUNT_SIDTWILIO_AUTH_TOKENOTEL_ENABLEDOTEL_EXPORTER_OTLP_ENDPOINT
Keep secrets in the deployment platform secret manager. Do not bake them into images, workflow files, or migration scripts.
- Confirm the target
DATABASE_URLpoints at the production database. - Take a database backup and record the backup identifier in the release notes.
- Run
npm ciin a clean build environment. - Run
npm run db:generate. - Apply migrations with
npm run db:migrateor the platform migration job. - Verify Prisma can connect with a read-only health query.
- Start one application instance against the migrated database.
- Verify health, auth, escrow reads, admin reads, webhooks, and notification queues.
- Roll out remaining instances after validation passes.
Never run application instances from a new build against an old schema when the release includes required schema changes.
- Install dependencies:
npm ci. - Type-check:
npm run typecheck. - Lint:
npm run lint:check. - Unit tests with coverage:
npm run test:cov. - Coverage gate:
node scripts/check_coverage.js. - Build:
npm run build. - Build container image:
npm run docker:build. - Run database migration job.
- Deploy one canary instance.
- Promote to full rollout after validation milestones pass.
- The service starts without configuration warnings for required production variables.
GET /healthreturns a successful response.GET /versionreturns the expected release version.- SEP-10 challenge and verify flows issue tokens.
- Vendor escrow list queries return within the expected latency budget.
- Admin endpoints return 403 for vendor tokens and 200 for admin tokens.
PATCH /admin/dispute/:id/resolveis reachable only by admin JWTs.- Webhook signature validation rejects missing or invalid signatures.
- Queue dashboard and logs show no failed background jobs.
- Error rate and p95 latency remain stable for at least one canary window.
- Stop the rollout and keep the canary isolated.
- Revert the application image to the previous release.
- Restore the database from the pre-release backup when migrations are not backward-compatible.
- Re-run health, auth, escrow, admin, and webhook validation.
- Document the failing milestone before reopening rollout.