@kasifraza/nestjs-health
v1.0.0
Published
A health check module for NestJS with DB, Redis, queue, disk, and memory checks
Downloads
4,607
Maintainers
Readme
@kasifraza/nestjs-health
A health check module for NestJS with memory, disk, and ping indicators. Perfect for Kubernetes liveness/readiness probes.
Installation
npm install @kasifraza/nestjs-healthUsage
import { HealthModule, MemoryHealthIndicator, DiskHealthIndicator, PingHealthIndicator } from '@kasifraza/nestjs-health';
@Module({
imports: [
HealthModule.register({
checks: [
new MemoryHealthIndicator(),
new DiskHealthIndicator(),
new PingHealthIndicator('https://api.example.com'),
],
}),
],
})
export class AppModule {}This exposes a GET /health endpoint returning:
{
"status": "up",
"checks": {
"memory": { "status": "up" },
"disk": { "status": "up" },
"ping": { "status": "up" }
}
}Custom Indicators
import { HealthIndicator } from '@kasifraza/nestjs-health';
class RedisHealthIndicator extends HealthIndicator {
name = 'redis';
async check() {
// your logic
return { status: 'up' };
}
}License
MIT
