multinoded.js
v1.0.0
Published
Easily create and manage child processes
Readme
multinode
multinode is a lightweight process manager for Node.js.
It allows you to easily run, stop and restart multiple child processes at once, including Node.js scripts, Python scripts, binaries, or any system command.
🚀 Features
- Run multiple child processes in parallel
- Stop / restart individual processes
- Run / stop / restart all processes at once
- Auto-restart crashed processes
- Per-process logs (stdout + stderr)
- Configurable behavior
- Runtime: add/remove processes with
client.new()andclient.delete() - Error & exit callbacks
- Very small footprint, no dependencies
📦 Installation
npm install multinoded.js🧱 Basic usage
const { manager } = require("multinoded.js")
const client = manager.New(
{
api: {
command: "node",
args: ["api.js"],
cwd: "./services",
onStart: () => console.log("API started"),
onStdout: data => console.log("[API]", data),
onExit: code => console.log("API exited", code)
},
worker: {
command: "node",
args: ["worker.js"]
}
},
{
autoRestart: true,
maxRestarts: 5,
restartDelay: 2000,
logDir: "./process-logs"
}
)
client.runAll()⚙️ Config options
You can pass a config object to manager.New():
| Option | Type | Default | Description | | ------------ | ------- | -------- | ---------------------------------------------- | | autoRestart | boolean | true | Restart processes when they exit | | maxRestarts | number | 10 | Max number of automatic restarts | | restartDelay | number | 1500 | Delay before restarting a process | | logDir | string | "./logs" | Directory where stdout/stderr logs are written |
🧩 Process control
Run all processes
client.runAll()Stop all processes
client.stopAll()Restart all
client.restartAll()Run a specific process
client.run("api")Stop a specific process
client.stop("api")Restart a specific process
client.restart("api")➕ Adding/removing processes at runtime
Add a new process
client.new("bot", {
command: "node",
args: ["bot.js"]
})Start it
client.run("bot")Delete it
client.delete("bot")📁 Logs
Each process writes two files inside the configured logDir:
<name>-out.log (stdout)
<name>-err.log (stderr)Example:
logs/api-out.log
logs/api-err.log
logs/worker-out.log
logs/worker-err.log