Health check

Endpoint GET /health com NestJS Terminus — banco e Redis opcional.

Feature opt-in instalada com kl-nest new (multiselect) ou kl-nest add health.

Expõe GET /health usando @nestjs/terminus. O endpoint é público (@IsPublic()) e omitido do OpenAPI (@ApiExcludeEndpoint()).

Indicador Quando roda
Database Sempre — ping TypeORM
Redis Apenas se REDIS_CONNECTION_STRING estiver definido no .env

Se REDIS_CONNECTION_STRING existir mas o pacote ioredis não estiver instalado (cache Redis não foi adicionado), o indicador retorna up com aviso em vez de falhar o 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

O HealthCheckModule é registrado no AppModule pela CLI.

json
{
  "status": "ok",
  "info": {
    "database": { "status": "up" },
    "redis": { "status": "up" }
  },
  "error": {},
  "details": {
    "database": { "status": "up" },
    "redis": { "status": "up" }
  }
}
Variável Efeito no health
REDIS_CONNECTION_STRING Ativa verificação Redis
Demais vars de DB Usadas pelo ping TypeORM

Koala Nest

Facilitador para criar APIs NestJS com arquitetura DDD. Código copiado para o seu repositório — legível, adaptável e sob seu controle.

Creator

igordrangel.com.br

Design, back-end e estratégia de produto.

Comandos rápidos

CLI global e scripts no projeto gerado

  • bun install -g @koalarx/nest
  • kl-nest new
  • kl-nest add cache
  • bun run migration:run # template CRUD
  • kl-nest --help
© 2026 Koala NestFeito para desenvolvedores NestJS e fluxos assistidos por IA.