NestJS Terminus

The official health-check module for NestJS applications

Library
npm
v11.1.1
742stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
65/100Good
Development Activity60
Maintenance52
Community60
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture83
Code Quality82
Innovation68
Learning Curve78

@nestjs/terminus is the official NestJS integration for building /health endpoints, providing a HealthCheckService plus a library of ready-made health indicators for databases (TypeORM, Mongoose, Sequelize, Prisma, MikroORM), disk and memory usage, HTTP dependencies (via Axios), and microservice transports (gRPC, and others reachable through Nest’s microservice client). It only requires the driver dependency for the checks you actually use, throwing a clear error if a required peer dependency is missing.

Health checks are composed declaratively: a @HealthCheck() decorated controller method calls HealthCheckService.check([...indicators]) with an array of indicator functions, and Terminus aggregates their results into a standard health-check response shape consumable by orchestrators like Kubernetes liveness/readiness probes or uptime monitors.

What You Get

  • HealthCheckService and @HealthCheck() decorator for aggregating multiple indicator results into one endpoint response
  • Database health indicators for TypeORM, Mongoose, Sequelize, Prisma, and MikroORM connections
  • Disk-usage and memory (heap/RSS) health indicators with configurable thresholds
  • HTTP health indicator built on Axios for checking reachability of external dependencies
  • Microservice health indicators (gRPC and other Nest microservice transports)
  • A graceful-shutdown-timeout utility for coordinating health status during application shutdown

Common Use Cases

  • Exposing a /health endpoint for Kubernetes liveness and readiness probes
  • Aggregating database, disk, and memory checks into a single health-check response for uptime monitoring tools
  • Verifying downstream HTTP or microservice dependencies are reachable before reporting an application as healthy
  • Coordinating graceful shutdown so load balancers stop routing traffic before in-flight requests are dropped

Under The Hood

Architecture — The library is centered on lib/terminus.module.ts registering providers, with the actual work split between lib/health-check/health-check-executor.service.ts (runs the array of indicator functions passed to @HealthCheck() and aggregates pass/fail results) and lib/health-indicator/ (one subdirectory per dependency type: database/, disk/, memory/, http/, microservice/, each exporting an indicator class with a .pingCheck()-style method). lib/errors/ defines typed error classes per failure mode (connection not found, storage exceeded, timeout, unhealthy response code) so failures are distinguishable programmatically, not just by message string.

Tech Stack — Peer-dependency driven: Terminus itself has a small core dependency footprint and dynamically requires the ORM/HTTP client package matching whichever indicator you use (e.g. only needs typeorm installed if you use TypeOrmHealthIndicator), checked via lib/utils/checkPackage.util.ts which throws a descriptive error if the peer dependency is missing. Built with pnpm workspaces and tested against a docker-compose.yml stack of real database services for integration coverage.

Code Quality — Indicator services and the check-executor carry .spec.ts unit tests (health-check.service.spec.ts, health-check-executor.service.spec.ts, http.health.spec.ts, grpc.health.spec.ts, graceful-shutdown-timeout.service.spec.ts), and the repo has a separate e2e/ directory exercising indicators against real services via the docker-compose stack rather than mocks alone — a meaningfully more rigorous test posture than typical for a peer-dependency-heavy integration package.

API Design — The @HealthCheck() + HealthCheckService.check([...]) pattern keeps a health endpoint to a few lines: pass an array of indicator function calls (() => this.db.pingCheck('database')) and Terminus handles aggregation, timeout, and response shaping. Each indicator follows the same .pingCheck(key, options) shape regardless of underlying dependency type, so adding a new check type to an existing endpoint requires no new mental model — a deliberate consistency choice across an otherwise heterogeneous set of integrations.

Used by 7 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
95%
AGPL 3.0

Docmost

Productivity · Note Taking · Collaboration

21,411

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 days ago
TypeScript
98%
Other

Novu

Developer Tools

39,615

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
65
Dependency
Built with
TypeScript98%
Updated today
TypeScript
97%
AGPL 3.0

Swetrix

Analytics

1,123

Privacy-first, cookieless web analytics with error tracking, session replays, and performance monitoring — self-host or use Cloud.

View details
87
Repo Health
71
Technical
71
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
99%
Other

Teable

Databases · No Code Platforms

21,665

A no-code PostgreSQL database with spreadsheet UX, real-time collaboration, and native AI agents — built for teams that outgrow Airtable.

View details
79
Repo Health
76
Technical
64
Dependency
Built with
TypeScript99%
Updated today
TypeScript
79%
Other

twenty

CRM

55,120

The open-source CRM you build, ship, and version like the rest of your stack — with customizable objects, AI agents, and a TypeScript SDK.

View details
92
Repo Health
82
Technical
67
Dependency
Built with
TypeScript79%
MDX17%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search