Getting an Express API Production-Ready: Configuration, Structured Logging with pino, Health Checks, Graceful Shutdown and Cluster
A production-ready Express API validates its configuration against a schema at startup, writes JSON logs with request ids and redacted secrets using pino, separates liveness from readiness, and on SIGTERM stops new connections and finishes open requests before closing the pool. With real output: an export cut at 22 MB instead of 98 MB, the full file after the fix and a controlled cut on timeout, 503 while draining, PID 1's 10-second wait and a 4-worker cluster.
14 Nov 2026
·
14 min
·
16