Composable health probes and HTTP responses for Pegma hosts.
Important
Pegma is in early 0.x development. Packages are published, but no public
API is stable.
Hosts need a boring public /health that proves the process is alive, optionally
proves storage round-trips, emits a structured log line, and never leaks
secrets. This package owns that contract; the host owns wiring and backends.
Explicit checks at the composition root. No autodiscovery. No owned Store. Safe detail only.
import {
createDetailCheck,
createProcessCheck,
createStorePingCheck,
healthProbeCollection,
runHealthChecks,
toHealthResponse,
} from "@pegma/health";
const result = await runHealthChecks({
service: "my-api",
logger,
checks: [
createProcessCheck(),
createDetailCheck("logging", { datadog: true }),
createStorePingCheck({ store, collection: healthProbeCollection }),
],
});
const { status, body } = toHealthResponse(result);- Metrics, APM, or alert fan-out
- Storage adapters
- UI dashboards
Requires Node.js 22 or 24.
corepack enable
pnpm install --frozen-lockfile
pnpm run format:check
pnpm run check
pnpm testMaintainers should follow the release runbook. Releases publish only from protected signed tags through npm trusted publishing.
MIT