npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fluojs/terminus

v1.0.0-beta.3

Published

Health indicator composition and enriched runtime health aggregation for Fluo applications.

Readme

@fluojs/terminus

Health indicator toolkit for fluo applications. @fluojs/terminus layers on top of runtime health/readiness endpoints to provide dependency-aware status reporting.

Table of Contents

Installation

pnpm add @fluojs/terminus

When to Use

  • When you need to monitor external dependencies (databases, Redis, APIs) as part of your application's health status.
  • When you want a structured JSON health report that aligns with standard monitoring patterns.
  • When you need your /ready check to fail if critical downstream services are unreachable.

Quick Start

Import TerminusModule.forRoot() to register health indicators.

import { Module } from '@fluojs/core';
import { HttpHealthIndicator, MemoryHealthIndicator, TerminusModule } from '@fluojs/terminus';

@Module({
  imports: [
    TerminusModule.forRoot({
      indicators: [
        new HttpHealthIndicator({ key: 'upstream-api', url: 'https://example.com/health' }),
        new MemoryHealthIndicator({ key: 'memory', heapUsedThresholdRatio: 0.9 }),
      ],
    }),
  ],
})
class AppModule {}

Common Patterns

Built-in Indicators

The package provides several indicators out of the box:

  • PrismaHealthIndicator / DrizzleHealthIndicator
  • RedisHealthIndicator (from @fluojs/terminus/redis)
  • HttpHealthIndicator
  • MemoryHealthIndicator
  • DiskHealthIndicator

DI-Backed Indicators

To use indicators that require dependencies from the DI container (like Redis or Database clients) without importing peer dependencies at module load time, use the provider factories.

import { TerminusModule } from '@fluojs/terminus';
import { createRedisHealthIndicatorProvider } from '@fluojs/terminus/redis';

TerminusModule.forRoot({
  indicatorProviders: [
    createRedisHealthIndicatorProvider({ key: 'redis' })
  ],
});

Omit clientName to keep probing the default Redis client. If the indicator should use a named Redis connection, pass clientName so the provider resolves that named client token instead of the default one.

TerminusModule.forRoot({
  indicatorProviders: [
    createRedisHealthIndicatorProvider({ key: 'redis' }),
    createRedisHealthIndicatorProvider({ clientName: 'cache', key: 'cache-redis' }),
  ],
});

Execution Guardrails

Use execution.indicatorTimeoutMs when custom indicators might hang or depend on slow downstreams. When a probe exceeds the configured timeout, Terminus marks that indicator as down instead of waiting forever.

TerminusModule.forRoot({
  execution: {
    indicatorTimeoutMs: 1_500,
  },
  indicators: [
    new HttpHealthIndicator({ key: 'upstream-api', url: 'https://example.com/health' }),
  ],
});

Failure Semantics

When an indicator fails, it throws a HealthCheckError. The TerminusHealthService aggregates these failures into a report:

  • /health returns HTTP 503 if any indicator fails.
  • /ready returns HTTP 503 if any indicator associated with readiness fails.
  • The response body contains a structured JSON object with status, contributors, info, error, and details.
  • Indicators may emit multiple keyed entries in a single check result; /health preserves every keyed entry in details and in the contributors.up / contributors.down summaries.
  • Unsupported, empty, or non-object indicator results are reported as down diagnostics instead of being silently discarded.
  • If an indicator reuses a key that was already reported earlier in the same run, Terminus keeps the first entry and adds a deterministic *-duplicate-key-error contributor instead of silently overwriting data.
  • Platform health/readiness failures are surfaced as deterministic fluo-platform-health and fluo-platform-readiness contributors in /health responses.

Public API Overview

TerminusModule

  • static forRoot(options: TerminusModuleOptions): ModuleType
    • Main entry point for registering indicators and providers.

TerminusHealthService

  • check(): Promise<HealthCheckReport>
    • Runs the currently registered indicators and returns the aggregated report.
  • isHealthy(): Promise<boolean>
    • Returns whether the current aggregated report is fully healthy.

@fluojs/terminus/redis

  • RedisHealthIndicator, createRedisHealthIndicator(), createRedisHealthIndicatorProvider()
    • Redis-specific indicator helpers are exported from the dedicated subpath so the root package stays import-safe without the optional Redis peer installed.

HealthCheckError

  • Throw this error within custom indicators to signal a "down" state.

Related Packages

  • @fluojs/metrics: Often used together for observability.
  • @fluojs/prisma / @fluojs/drizzle / @fluojs/redis: Peer dependencies for specific indicators.

Example Sources

  • examples/ops-metrics-terminus/src/app.ts: End-to-end integration of health and metrics.
  • packages/terminus/src/health-check.test.ts: Demonstrates aggregation and assertion flow.