Process Managers (PM2)
On this page
What PM2 Solves
Node processes crash. Memory leaks happen. Deployments restart services. PM2 ensures your application stays online by supervising processes and restarting them automatically.
Basic Usage
pm2 start dist/server.js --name api pm2 status pm2 logs api
Cluster Mode
PM2 can spawn multiple instances equal to CPU cores.
pm2 start dist/server.js -i max
Production Advantages
- Automatic restarts on crash
- Log management
- Zero-downtime reloads
Operational Warning
PM2 is a single-host solution. For multi-node deployments, combine it with a load balancer or container orchestration.