@samveys/health

Liveness and readiness endpoints, shutdown-aware

Version
1.0.3Nov 5, 2026
Install
pnpm add @samveys/health

This list was read from version 1.0.2; run pnpm sync to refresh it.

Import
import { health } from '@samveys/health'

Function (1)

health Function

The `@samveys/health` plugin: `GET <path>/live` (process is up) and `GET <path>/ready` (every check passes; 503 with details otherwise, and 503 from the moment shutdown begins).

function health(options?: HealthOptions): import("@samveys/core").Plugin<HealthOptions | undefined>;

Exported from packages/health/src/plugin.ts

Interface (4)

HealthCheckReport Interface

No documentation comment.

interface HealthCheckReport {
    readonly ok: boolean;
    readonly message?: string;
}

Exported from packages/health/src/contracts.ts

HealthCheckResult Interface

Outcome of one readiness check.

interface HealthCheckResult {
    readonly ok: boolean;
    readonly message?: string;
}

Exported from packages/health/src/contracts.ts

HealthOptions Interface

No documentation comment.

interface HealthOptions {
    /** Extra readiness checks by name. */
    readonly checks?: Readonly<Record<string, HealthCheckFunction>>;
    /** URL prefix of the endpoints (default `/health`): `<path>/live` and `<path>/ready`. */
    readonly path?: string;
    /** Per-check timeout in ms (default 5000). */
    readonly timeout?: number;
}

Exported from packages/health/src/contracts.ts

ReadinessReport Interface

No documentation comment.

interface ReadinessReport {
    /** `shutting_down` once `app:terminating` fired. */
    readonly status: 'ok' | 'unavailable' | 'shutting_down';
    readonly checks: Readonly<Record<string, HealthCheckReport>>;
}

Exported from packages/health/src/contracts.ts

Type (1)

HealthCheckFunction Type

A named readiness check passed to `health({ checks })`; a throw or rejection counts as a failure.

type HealthCheckFunction = (signal: AbortSignal) => HealthCheckResult | Promise<HealthCheckResult>;

Exported from packages/health/src/contracts.ts