Health check

GET /health endpoint with NestJS Terminus — database and optional Redis.

Exposes GET /health using @nestjs/terminus. The endpoint is public (@IsPublic()) and excluded from OpenAPI (@ApiExcludeEndpoint()).

Indicator When it runs
Database Always — TypeORM ping
Redis Only when REDIS_CONNECTION_STRING is set in .env

If REDIS_CONNECTION_STRING is set but the ioredis package is not installed (Redis cache was not added), the indicator returns up with a warning instead of failing the health check.

text
src/host/controllers/health-check/
├── health-check.controller.ts
└── health-check.module.ts

src/infra/services/
├── database.indicator.service.ts
└── redis.indicator.service.ts

The CLI registers HealthCheckModule in AppModule.

json
{
  "status": "ok",
  "info": {
    "database": { "status": "up" },
    "redis": { "status": "up" }
  },
  "error": {},
  "details": {
    "database": { "status": "up" },
    "redis": { "status": "up" }
  }
}
Variable Health effect
REDIS_CONNECTION_STRING Enables Redis check
Other DB vars Used by TypeORM ping