Deploying Node means choosing a runtime version, setting env vars, running npm ci, and keeping the process alive behind a reverse proxy or platform.
Common targets
- PaaS — Railway, Render, Fly.io, Heroku-style platforms
- Containers — Docker image with
node:20-alpine, multi-stage builds - Serverless — AWS Lambda, Cloud Functions (cold starts, stateless)
- VPS — PM2 or systemd + Nginx reverse proxy
Production checklist snippet
- Pin Node LTS in engines field
npm ci --omit=devin build- Health check route for load balancers
- Graceful shutdown on SIGTERM (close server, drain connections)
Important interview questions and answers
- Q: PM2 vs cluster module?
A: Both scale across CPU cores; PM2 adds process management, logs, and zero-downtime reload—cluster is built-in. - Q: Why reverse proxy in front?
A: Nginx handles TLS, static files, rate limits; Node handles dynamic app logic.
Self-check
- Why use npm ci instead of npm install in CI?
- What signal should apps handle for graceful shutdown?