Nodemon is a development tool for Node.js that automatically restarts the application whenever project files are modified, making development faster and more efficient. Nodemon is commonly used as it:
- Automatically restarts the server after file changes.
- Reduces manual work during development.
- Monitors project files continuously.
Installing nodemon
The module is installed globally using the following command:
npm install -g nodemonAfter installing the module you can check the current version of the module by typing on console as shown below:
nodemon --version
Using nodemon
The nodemon wraps your application, so you can pass all the arguments you would normally pass to your app.
Syntax:
nodemon [your node app]Example:
nodemon index.js
Output

Now everytime any changes are saved in this file, the nodemon triggers the automatic restart of Node application.
Key CLI Options
We have a list of options available for nodemon, that we can use. We can get that list using :
nodemon -h
where,
1. --watch:
Tells nodemon which specific file or folder to monitor. By default it watches the current directory, but you can narrow it down.
Syntax
nodemon --watch src app.jsOutput
[nodemon] watching path(s): src/**/*
[nodemon] starting `node app.js`
2. --ext:
Defines which file extensions should trigger a restart. By default nodemon watches .js, .mjs, and .json. Use nodemon --ext js,ts,env to include additional types.
Syntax
nodemon --ext js,txt app.jsOutput
[nodemon] watching extensions: js,txt
[nodemon] restarting due to changes...
3. --ignore:
Excludes certain files or directories from being watched. Useful for ignoring node_modules, log files, or test folders.
Syntax
nodemon --ignore logs app.jsOutput
Changes inside logs/ will not restart the app4. --delay:
Adds a wait time (in seconds) before restarting after a file change is detected. Helpful when multiple files save in quick succession.
Syntax
nodemon --delay 2 app.jsOutput
[nodemon] delaying restart for 2 seconds
[nodemon] restarting due to changes...