Save a file. Your app restarts.

coalburn watches your project and restarts your Node.js app when files change. Add --port and the browser reloads too.

npm i -g coalburn
See usage
coalburn --port 3000 app.js [coalburn] Watching /Users/you/my-app [coalburn] Live reload on http://localhost:3000 (app gets port 56195 as process.env.PORT) [coalburn] Starting app.js Server running on port 56195 [coalburn] Open http://localhost:3000 [coalburn] File changed: app.js [coalburn] Restarting... [coalburn] Starting app.js Server running on port 56195 [coalburn] Reloading browser...

Usage

Run it from your project folder. Needs Node.js 20.19 or newer.

coalburn app.js
Runs the file with Node and restarts it when anything in the folder changes.
coalburn node server.js --verbose
Runs any command. Flags after the command go to your app.
coalburn --port 3000 app.js
Serves your app on port 3000 and reloads open tabs after each restart.
coalburn --port 3000 --reload-delay 500 app.js
Reloads the browser half a second after the app is back, instead of one second.

How live reload works

browser coalburn on :3000 your app on a free port

coalburn takes the port you open and gives your app a free one through process.env.PORT. Every HTML page it passes along gets a tiny script that waits for a reload message.

After a restart it waits until your app answers, then one more second, then reloads every open tab.

const PORT = process.env.PORT || 3000;
app.listen(PORT);
The one change your app needs.
OptionWhat it doesDefault
--port <port>Serve the app on this port with live reloadoff
--reload-delay <ms>Wait this long after the app is up before reloading1000

What it handles