
forever
A command-line tool that keeps a Node.js or other script running, restarting it if it crashes.
- Stars
- 13.8k
- Forks
- 931
- Licence
- MIT
- Language
- JavaScript
- Last update
- 3.5 years ago
- Type
- CLI
No commits in over a year — check for forks or alternatives before adopting.
What it is
forever is a command-line tool that runs a script and restarts it if it stops or crashes. You point it at a script such as app.js and it keeps that script running, optionally in the background as a daemon. The README notes that the project currently depends on the community for fixes and new features, and recommends pm2 or nodemon for new installations.
- Start a script as a background daemon with logs written to files
- Restart a script automatically when its files change using the -w watch option
- Stop, restart, or list running scripts by name, index, or ID
- Start multiple apps from a single JSON configuration file
Great for
- Developers who need a simple way to keep a small Node.js script running on a server
- People who want to run a script in the background without using nohup
- Users maintaining an existing setup that already uses forever
- Developers who want to limit restarts with the -m option during testing
Not ideal for
- New projects, since the README recommends pm2 or nodemon instead
- Anyone who needs active feature development, because the README says fixes and features depend on the community
- Users who need programmatic control in code, who should use forever-monitor as the README directs
How to get it
- 1
Install with a package manager
You'll need: Node.js and npm
Install globally with npm
[sudo] npm install forever -g - 2
Run it
- Install forever globally with npm.
- Run forever start app.js to start your script as a daemon.
- Run forever list to see running scripts.
- Run forever stop app.js to stop it.
- 3
Get the most out of it
- Use -l, -o, and -e to write forever's log, stdout, and stderr to files, as the README recommends for daemons
- Use -w and --watchIgnore to restart on file changes while skipping certain patterns
- Put options in a JSON file and start it with forever start config.json, with comments supported
- Use --killTree with stop to end the whole child process tree
Downloads
Strengths
- Simple command-line interface with clear actions such as start, stop, and list
- Works with scripts written in Node.js and, per the README, other languages too
- Supports JSON configuration files with comments and multi-app setups
Trade-offs
- The README says the project currently relies on the community for fixes and new features, and recommends pm2 or nodemon for new installs
- The README's build and dependency badges point to older services (Travis CI, David-DM), and the last push date is May 2023
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| forever (this) | 13.8k | CLI | beginner | 3.5 years ago | Developers who need a simple way to keep a small Node.js script running on a server |
| nodemon | 26.7k | Dev tool | beginner | 4 days ago | Node.js developers running a web server locally who want fast edit-and-reload cycles |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.