DEV Community

Ashraf
Ashraf

Posted on

Released: health-chk – A Production-Ready Health Check Middleware for Express.js

Hey everyone πŸ‘‹
I just published health-chk, a lightweight, customizable health check middleware for Express.js, perfect for containerized environments like Kubernetes, Docker, and cloud setups (AWS, GCP, etc).
πŸ”§ What it does:

Simple GET /healthz endpoint
Reports memory, uptime, CPU, PID, and more
Supports custom async diagnostics (e.g., DB status)
Environment variable output support
Graceful error reporting
Perfect for readiness/liveness probes

app.use(
  healthCheck({
    path: '/healthz',
    info: async () => ({
      database: "connected",
      service: "auth-service"
    }),
    includeEnv: true,
    envKeys: ['NODE_ENV', 'SERVICE_NAME']
  })
);
Enter fullscreen mode Exit fullscreen mode

Install: npm install health-chk

Github NPM

Let me know what you think, happy to hear feedback or PR suggestions!

nodejs #expressjs #npm #devops #kubernetes #docker #healthcheck #sre #microservices #opensource

Top comments (0)