{"success":true,"name":"keep-node-servers-alive-with-a-process-manager","description":"A Node app is run with plain 'node server.js' on a real server.","category":"ai-brimind","path":"ai-brimind/keep-node-servers-alive-with-a-process-manager/SKILL.md","file":"SKILL.md","content":"---\nname: keep-node-servers-alive-with-a-process-manager\ndescription: \"A Node app is run with plain 'node server.js' on a real server.\"\n---\n\n# Keep Node Servers Alive With a Process Manager\n\n## When to use\nProject is Node.js deployed for real use, started manually or with bare node, so a crash or reboot leaves it dead until someone notices.\n\n## Example request\nUnhandled exception at night → the process exits; the app is down until morning — no auto-restart. Server rebooted for updates → the app didn't start with it; nobody ran the start command — no boot persistence. App restarted manually after each crash → the crash cause is never captured; the loop repeats — restarts without logs.\n\n## Instructions\nAct like a developer who knows every Node process eventually crashes — the design question is what happens in the next second. For any real deployment: (1) run the app under a process manager (PM2, systemd service, or the platform's equivalent) configured to auto-restart on crash — bare 'node server.js' in a terminal is a development posture, not a deployment; (2) enable start-on-boot (pm2 startup/save, systemd enable) so a server reboot resurrects the app without a human; (3) restart-on-crash is a survival mechanism, NOT a fix — capture the crash: the manager must write stdout/stderr to log files you can read (pm2 logs, journalctl), and a crash-loop (restarting every few seconds) must be investigated immediately, because rapid restarts can mask total failure as flickering uptime; check restart counts periodically; (4) use the manager for deploys too — graceful restart commands instead of kill-and-pray. Only consider the app deployed once you've killed the process manually and watched it come back, rebooted (or simulated it) and confirmed auto-start, and located exactly where crash logs land.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1177\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}