Shutdown-Cleanup

Logo

Node.js module to gracefully shut down an application

View the Project on GitHub hypercliq/shutdown-cleanup

@hypercliq/shutdown-cleanup

npm npm downloads CI license

Phased graceful shutdown for Node.js — register async cleanup handlers that run in order when your process receives SIGTERM, SIGINT, SIGHUP, or beforeExit.

Quick start

import { registerHandler } from '@hypercliq/shutdown-cleanup'

registerHandler(async (signal) => {
  await server.close()
  await db.disconnect()
})

Features

Installation

npm install @hypercliq/shutdown-cleanup
# or
yarn add @hypercliq/shutdown-cleanup
# or
pnpm add @hypercliq/shutdown-cleanup

Documentation

Full API reference, phased shutdown examples, signal-specific handlers, error strategies, and best practices in the Developer Guide.

License

MIT