Production Deployment
Production Deployment
Pre-flight checklist
-
ROOT_API_KEYset to a securely generated value (64 hex chars) -
JWT_SECRETset to ≥ 32 random chars, notchangeme -
DATABASE_URLpoints to a managed Postgres instance (RDS, Cloud SQL, Supabase, etc.) - TLS termination at reverse proxy or load balancer
- Backups configured on the database
-
NODE_ENV=productionset
Reverse proxy (nginx)
Zero-downtime deploys
Use Docker's rolling update strategy:
Or with a container orchestrator (Kubernetes, Fly.io, Railway), set replicas: 2 and use a rolling update policy.
Migrations
Always run migrations before restarting the application:
Monitoring
The /health endpoint is suitable for uptime monitors and load-balancer health checks.
For metrics, the api-server emits structured JSON logs consumable by any log aggregation stack (Loki, Datadog, CloudWatch).
Security hardening
- Bind
api-serverto127.0.0.1(not0.0.0.0) if behind a reverse proxy. - Rotate
ROOT_API_KEYandJWT_SECRETwith zero-downtime using a key-overlap window. - Enable Postgres SSL (
sslmode=requireinDATABASE_URL).