Skip to content

forever vs nodemon

Which should you use? A side-by-side look at what each one does, who it suits, what it costs, how hard it is to set up, and where each falls short.

forever

Open source · MIT

A command-line tool that keeps a Node.js or other script running, restarting it if it crashes.

nodemon

Open source · MIT

A wrapper for node that restarts your app automatically when files change.

The short answer

Choose forever if you need…

  • 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

Choose nodemon if you need…

  • Node.js developers running a web server locally who want fast edit-and-reload cycles
  • Developers working on scripts in other languages such as Python or Ruby, using the execMap setting
  • Teams that want a simple, configurable file watcher without changing their code
  • Beginners learning Node.js who want changes to show up immediately

Side-by-side

forevernodemon
TypeCLIDev tool
PriceFree and open sourceFree and open source
LicenceMITMIT
GitHub stars13.8k26.7k
Setup difficultyBeginnerBeginner
How you get itInstall with a package managerInstall with a package manager
Main languageJavaScriptJavaScript
Last code update3 years ago4 days ago

What each one is

forever

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.

nodemon

nodemon is a command-line tool that watches the files in your project and restarts your Node.js application when they change. It is a replacement for the node command: you run your script with nodemon instead of node, and it needs no changes to your code. It is used during development so you do not have to stop and start the server by hand after every edit.

Best for

forever

  • 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

nodemon

  • Node.js developers running a web server locally who want fast edit-and-reload cycles
  • Developers working on scripts in other languages such as Python or Ruby, using the execMap setting
  • Teams that want a simple, configurable file watcher without changing their code
  • Beginners learning Node.js who want changes to show up immediately

Strengths

forever

  • 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

nodemon

  • No changes to your code or workflow are required; you just replace node with nodemon
  • Configurable through command-line flags, nodemon.json, or the nodemonConfig section of package.json
  • Works with non-JavaScript scripts through --exec and execMap

Not ideal for

forever

  • 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

nodemon

  • Production servers, since the README presents nodemon as a development tool (the description says it is 'perfect for development')
  • Projects that need restarts triggered by something other than file changes, since the README describes file-change watching as its core behavior

Trade-offs

forever

  • 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

nodemon

  • The README is truncated and some configuration docs are said to 'need better documentation', so advanced setups may take research
  • Ignore patterns must be written as full-path globs (for example ** patterns), which the README notes is easy to get wrong
  • Designed for development use, not as a production process manager

Getting started

forever

Install globally with npm

[sudo] npm install forever -g
Step-by-step guide: how to use forever

nodemon

Install globally with npm

npm install -g nodemon

Install as a dev dependency

npm install --save-dev nodemon
Step-by-step guide: how to use nodemon

Frequently asked questions

What is the difference between forever and nodemon?

forever: A command-line tool that keeps a Node.js or other script running, restarting it if it crashes. nodemon: A wrapper for node that restarts your app automatically when files change. forever suits developers who need a simple way to keep a small node.js script running on a server, while nodemon suits node.js developers running a web server locally who want fast edit-and-reload cycles.

Are forever and nodemon free?

forever: Free and open source. nodemon: Free and open source.

Is forever or nodemon more popular?

nodemon has more GitHub stars (26.7k) than forever (13.8k). Popularity isn't the same as fit — check which one matches your use case above.

What are other alternatives to forever and nodemon?

Other options people compare them with include tsx.

Keep comparing

Built from our catalogue entries for both products: open-source details come from each project's README (AI-assisted, refreshed weekly) and GitHub data; AI-tool details are editorial. Spotted something wrong? Let us know from either product's page.