npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

zero-crash

v1.0.0

Published

ZeroCrаsh: the ultimate Node.js global crash guard with smart logging and disciplined exit codes.

Readme

💥 zero-crash

🛡️ Prevent silent crashes in Node.js apps in one line.

📊 Project Stats

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.


🚀 Why zero-crash?

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


📦 Installation

npm install zero-crash

🧠 Basic Usage

const zero = require("zero-crash");

zero.protect(async () => {
  // your app logic
  startServer();
});

That’s it. Global crash protection is now active.


🔥 Advanced Usage (Recommended)

🧩 Role Awareness

zero.role("api");

Crash output will include role:

💥 [api] RUNTIME_ERROR

🔐 Environment Validation

zero.requireEnv(["PORT", "DB_URL"]);

zero.protect(async () => {
  startServer();
});

If missing:

💥 [app] CONFIG_ERROR
Missing env: DB_URL
Exit: 2

🛑 Safe Shutdown Hooks

zero.onShutdown(async () => {
  await db.close();
  await redis.quit();
});

Runs on:

  • crash
  • Ctrl+C
  • SIGTERM
  • process exit

⚠️ Crash Classification

throw zero.config("Invalid configuration");
throw zero.dependency("MongoDB not reachable");

Mapped exit codes:

| Type | Exit Code | | ---------------- | --------- | | Success | 0 | | Runtime Error | 1 | | Config Error | 2 | | Dependency Error | 3 | | Manual Interrupt | 130 |


🧪 Full Example

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");
});

🪄 Crash Output Example

💥 [bot] CONFIG_ERROR
Reason: SESSION missing
Exit: 2
CrashID: ZC-A91F2B
Node: v20.11.1
Memory: 42MB
Uptime: 12s

⚙️ Options

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 |


🛠️ Use Cases

  • REST APIs
  • CLI tools
  • WhatsApp / Telegram bots
  • Cron jobs
  • Microservices
  • Workers & daemons

If it runs on Node.js, zero-crash belongs there.


⭐ Support the Project

If this package improved your app’s stability:

👉 Give it a ⭐ on GitHub Stars help this project reach more developers ❤️


🔄 Updates & Contributions

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.


📜 License

MIT License © 2026 Abhishek Suresh https://github.com/AbhishekSuresh2

⚠️ Please do not copy, rebrand, or republish this package as your own without explicit permission.


🌍 Vision for 2026

Failures are inevitable. Chaos is optional.

zero-crash makes crashes predictable, readable, and safe — so your app never dies silently again 💥🛡️