Develop a shared library for Node.js that provides custom error classes, async route wrappers, centralized error middleware, and consistent error responses to reduce boilerplate code across projects.
Something I keep noticing across Node/Express projects: Every new service ends up recreating the same things again and again: * custom error classes * async route wrappers * centralized error middleware * consistent error responses * logging hooks Different codebases… but almost the **same error-handling architecture** every time. At some point it starts feeling like **boilerplate we all keep rebuilding**. Out of curiosity I extracted the pattern from a couple of projects into a small reusable module just to avoid rewriting it. The idea was to keep it **framework-agnostic**, so it can work in: * Node.js APIs * Express backends * server utilities * even frontend environments like React where centralized error formatting can be useful. Not really posting this as promotion — I'm more curious how other teams approach this. Do you usually: • keep an internal shared error library • copy boilerplate between projects • use an npm package • or just handle errors per-service? For context, this is what I experimented with: [https://www.npmjs.com/package/universal-error-handler](https://www.npmjs.com/package/universal-error-handler) Curious how people handle this in production systems.