forever, nodemon, pm2, and supervisor are utilities designed to keep Node.js applications running continuously. They handle process crashes, restarts, and file changes, but serve different stages of the development lifecycle. nodemon is primarily a development tool that restarts apps when source code changes. pm2 is a robust production process manager with clustering, logging, and monitoring. forever is a simpler legacy tool for keeping scripts alive in the background. supervisor is an older utility similar to nodemon but is largely considered deprecated or unmaintained in modern workflows.
Keeping a Node.js application running reliably is a fundamental requirement for both development and production. forever, nodemon, pm2, and supervisor all address this need, but they target different stages of the lifecycle. Some are built for the feedback loop of coding, while others are engineered for uptime and scale. Let's compare how they handle process lifecycle, configuration, and production readiness.
nodemon is designed for development. It watches your file system and restarts the process when code changes are detected. It is not intended to manage production crashes.
# nodemon: Watch and restart on file change
nodemon server.js
// nodemon: Config via nodemon.json
{
"watch": ["src"],
"ext": "ts js",
"exec": "ts-node"
}
pm2 focuses on production uptime. It restarts processes if they crash or run out of memory, and it can also watch files (though this is discouraged in production).
# pm2: Start and keep alive
pm2 start server.js
// pm2: Config via ecosystem.config.js
module.exports = {
apps: [{
name: "app",
script: "server.js",
instances: 4,
exec_mode: "cluster"
}]
}
forever keeps a script running continuously. If the script exits, forever restarts it. It does not inherently watch for file changes without extra flags or tools.
# forever: Run script continuously
forever start server.js
// forever: Programmatic usage
const forever = require('forever');
forever.start('server.js', {
silent: true,
max: 3
});
supervisor watches for changes and restarts the node process, similar to nodemon. It is an older approach to the same problem.
# supervisor: Watch and run
supervisor server.js
// supervisor: No standard config file support like nodemon/pm2
// Typically run via CLI flags only
// supervisor -w lib server.js
pm2 is the only tool in this list built for horizontal scaling on a single server. It supports cluster mode to utilize all CPU cores.
# pm2: Cluster mode for multi-core utilization
pm2 start server.js -i max
forever runs a single instance per command. To scale, you must manage multiple forever processes manually or via scripts.
# forever: Single instance management
forever start -l log.txt server.js
nodemon runs a single instance. It is not designed to manage load or multiple workers.
# nodemon: Single instance for dev
nodemon server.js
supervisor runs a single instance. It lacks built-in clustering capabilities.
# supervisor: Single instance
supervisor server.js
pm2 offers a comprehensive ecosystem file for managing multiple applications, environments, and deployment hooks.
// pm2: ecosystem.config.js supports env variables
module.exports = {
apps: [{
name: "api",
script: "./app.js",
env: {
NODE_ENV: "development"
},
env_production: {
NODE_ENV: "production"
}
}]
}
nodemon uses a simple JSON config for watch patterns and execution commands.
// nodemon: nodemon.json
{
"ignore": ["test/*", "docs/*"],
"delay": 2500
}
forever relies mostly on CLI flags, though it can be used programmatically.
# forever: CLI flags for logging
forever start -o out.log -e err.log -l forever.log server.js
supervisor has minimal configuration options, mostly handled through command line arguments.
# supervisor: CLI arguments
supervisor -w config -n error server.js
nodemon is actively maintained and is the de facto standard for Node.js development. It receives regular updates for compatibility with new Node versions.
pm2 is actively maintained and widely used in enterprise production environments. It has a large ecosystem of modules and integrations.
forever is maintained but sees less active development compared to pm2. It is stable but lacks modern features like built-in monitoring dashboards.
supervisor is largely considered abandoned or legacy. It has not seen significant updates in years and is not recommended for new projects.
| Feature | nodemon | pm2 | forever | supervisor |
|---|---|---|---|---|
| Primary Use | Development | Production | Production/Legacy | Development (Legacy) |
| Auto Restart | On File Change | On Crash/Exit | On Crash/Exit | On File Change/Crash |
| Clustering | ❌ No | ✅ Yes | ❌ No | ❌ No |
| Config File | nodemon.json | ecosystem.config.js | CLI/Code | CLI |
| Status | ✅ Active | ✅ Active | ⚠️ Stable | ❌ Legacy/Abandoned |
nodemon is your daily driver for writing code. It saves time by automating restarts during development. Never use it to host a live site.
pm2 is your production engine. It ensures your app stays online, scales across cores, and provides logs and metrics. It is the professional choice for hosting.
forever is a reliable fallback for simple scripts or legacy systems where installing pm2 is not feasible. It works, but it shows its age.
supervisor should be avoided. It solves the same problem as nodemon but without the active support or feature parity. Stick to nodemon for development.
Final Thought: Your tooling should match your environment. Use nodemon to build fast, and pm2 to run stable. Leave supervisor in the past and use forever only when simplicity outweighs feature needs.
Choose pm2 for production environments where you need process management, load balancing via clustering, and zero-downtime reloads. It is ideal for applications requiring high availability, log management, and monitoring dashboards. It handles both simple scripts and complex microservice architectures effectively.
Avoid choosing supervisor for new projects as it is largely unmaintained and considered legacy technology. While it functions similarly to nodemon by restarting on changes, it lacks the active community support and modern feature set of current alternatives. Use nodemon instead for development needs.
Choose forever if you need a lightweight, simple solution to keep a script running on a legacy server without complex features. It is suitable for small, single-instance scripts where advanced monitoring or clustering is not required. However, for modern production environments, more robust tools are generally preferred.
Choose nodemon for local development when you need your server to automatically restart upon detecting file changes. It is the industry standard for development workflows due to its ease of configuration and wide plugin support. Do not use it for production hosting as it lacks process management features like clustering.
PM2 is a production process manager for Node.js/Bun applications with a built-in load balancer. It allows you to keep applications alive forever, to reload them without downtime and to facilitate common system admin tasks.
Starting an application in production mode is as easy as:
$ pm2 start app.js
PM2 is constantly assailed by more than 1800 tests.
Official website: https://pm2.keymetrics.io/
Works on Linux (stable) & macOS (stable) & Windows (stable). All Node.js versions are supported starting Node.js 12.X and Bun since v1
$ npm install pm2 -g
$ bun install pm2 -g
Please note that you might need to symlink node to bun if you only want to use bun via sudo ln -s /home/$USER/.bun/bin/bun /usr/bin/node
You can install Node.js easily with NVM or FNM or install Bun with curl -fsSL https://bun.sh/install | bash
You can start any application (Node.js, Bun, and also Python, Ruby, binaries in $PATH...) like that:
$ pm2 start app.js
Your app is now daemonized, monitored and kept alive forever.
Once applications are started you can manage them easily:

To list all running applications:
$ pm2 list
Managing apps is straightforward:
$ pm2 stop <app_name|namespace|id|'all'|json_conf>
$ pm2 restart <app_name|namespace|id|'all'|json_conf>
$ pm2 delete <app_name|namespace|id|'all'|json_conf>
To have more details on a specific application:
$ pm2 describe <id|app_name>
To monitor logs, custom metrics, application information:
$ pm2 monit
The Cluster mode is a special mode when starting a Node.js application, it starts multiple processes and load-balance HTTP/TCP/UDP queries between them. This increase overall performance (by a factor of x10 on 16 cores machines) and reliability (faster socket re-balancing in case of unhandled errors).

Starting a Node.js application in cluster mode that will leverage all CPUs available:
$ pm2 start api.js -i <processes>
<processes> can be 'max', -1 (all cpu minus 1) or a specified number of instances to start.
Zero Downtime Reload
Hot Reload allows to update an application without any downtime:
$ pm2 reload all
More informations about how PM2 make clustering easy
With the drop-in replacement command for node, called pm2-runtime, run your Node.js application in a hardened production environment.
Using it is seamless:
RUN npm install pm2 -g
CMD [ "pm2-runtime", "npm", "--", "start" ]
Read More about the dedicated integration
PM2 allows to monitor your host/server vitals with a monitoring speedbar.
To enable host monitoring:
$ pm2 set pm2:sysmonit true
$ pm2 update


Monitor all processes launched straight from the command line:
$ pm2 monit
To consult logs just type the command:
$ pm2 logs
Standard, Raw, JSON and formated output are available.
Examples:
$ pm2 logs APP-NAME # Display APP-NAME logs
$ pm2 logs --json # JSON output
$ pm2 logs --format # Formated output
$ pm2 flush # Flush all logs
$ pm2 reloadLogs # Reload all logs
To enable log rotation install the following module
$ pm2 install pm2-logrotate
PM2 can generate and configure a Startup Script to keep PM2 and your processes alive at every server restart.
Init Systems Supported: systemd, upstart, launchd, rc.d
# Generate Startup Script
$ pm2 startup
# Freeze your process list across server restart
$ pm2 save
# Remove Startup Script
$ pm2 unstartup
More about Startup Scripts Generation
# Install latest PM2 version
$ npm install pm2@latest -g
# Save process list, exit old PM2 & restore all processes
$ pm2 update
PM2 updates are seamless
If you manage your apps with PM2, PM2+ makes it easy to monitor and manage apps across servers.

Feel free to try it:
Discover the monitoring dashboard for PM2
Thanks in advance and we hope that you like PM2!
PM2 is made available under the terms of the GNU Affero General Public License 3.0 (AGPL 3.0). For other licenses contact us.