ZeroCrΠ°sh: the ultimate Node.js global crash guard with smart logging and disciplined exit codes.
npm install zero-crash!npm
!downloads
!stars
!issues
!license
!views
Global runtime crash protection for modern Node.js apps.
Stop silent crashes, messy stack traces, and undefined exits.
zero-crash enforces disciplined failures, clean shutdowns, and human-readable crash logs β automatically.
Built for 2026 projects, production-safe, and dependency-free.
---
Most Node apps crash in ugly ways:
* Silent exits
* Infinite restart loops
* Unhandled promise rejections
* Random process.exit(1)
* No context, no discipline
zero-crash gives your app a runtime safety contract.
β Zero dependencies
β Global crash interception
β Clean exit codes
β Shutdown hooks
β Context-aware crash logs
β Works for APIs, CLIs, bots, servers
---
``bash`
npm install zero-crash
---
`js
const zero = require("zero-crash");
zero.protect(async () => {
// your app logic
startServer();
});
`
Thatβs it.
Global crash protection is now active.
---
`js`
zero.role("api");
Crash output will include role:
``
π₯ [api] RUNTIME_ERROR
---
`js
zero.requireEnv(["PORT", "DB_URL"]);
zero.protect(async () => {
startServer();
});
`
If missing:
``
π₯ [app] CONFIG_ERROR
Missing env: DB_URL
Exit: 2
---
`js`
zero.onShutdown(async () => {
await db.close();
await redis.quit();
});
Runs on:
* crash
* Ctrl+C
* SIGTERM
* process exit
---
`js`
throw zero.config("Invalid configuration");
throw zero.dependency("MongoDB not reachable");
Mapped exit codes:
| Type | Exit Code |
| ---------------- | --------- |
| Success | 0 |1
| Runtime Error | |2
| Config Error | |3
| Dependency Error | |130
| Manual Interrupt | |
---
`js
const zero = require("zero-crash");
zero.role("bot");
zero.requireEnv(["SESSION"]);
zero.onShutdown(async () => {
console.log("Cleaning up...");
});
zero.protect(async () => {
throw zero.config("SESSION missing");
});
`
---
``
π₯ [bot] CONFIG_ERROR
Reason: SESSION missing
Exit: 2
CrashID: ZC-A91F2B
Node: v20.11.1
Memory: 42MB
Uptime: 12s
---
`js`
zero.protect(app, {
verbose: false,
quiet: false,
json: false,
onCrash: (err, meta) => {
// send to webhook / logs
}
});
| Option | Description |
| --------- | ------------------------- |
| verbose | Show full stack trace |quiet
| | Disable console logs |json
| | Output crash info as JSON |onCrash
| | Custom crash hook |
---
* REST APIs
* CLI tools
* WhatsApp / Telegram bots
* Cron jobs
* Microservices
* Workers & daemons
If it runs on Node.js, zero-crash belongs there.
---
If this package improved your appβs stability:
π Give it a β on GitHub
Stars help this project reach more developers β€οΈ
---
Want to improve zero-crash`?
* π Found a bug? β Open an Issue
* β¨ Feature idea? β Create an Issue
* π§ Fix something? β Fork & Pull Request
* π Improvements welcome
Please contribute only through the official repository.
---
MIT License Β© 2026
Abhishek Suresh
https://github.com/AbhishekSuresh2
> β οΈ Please do not copy, rebrand, or republish this package as your own without explicit permission.
---
Failures are inevitable.
Chaos is optional.
zero-crash makes crashes predictable, readable, and safe β
so your app never dies silently again π₯π‘οΈ