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

@openknot-ts/health

v0.0.6-preview

Published

Lifecycle-bound liveness, readiness and health checks for OpenKnot applications.

Readme

OpenKnot health

@openknot-ts/health supplies liveness, readiness and health checks bound to the application lifecycle through Wire's applicationStatus. Plugs declare checks next to the resources they check; the application selects a health module or a transport adapter; the adapter exposes the probes. The package owns no server and no HTTP code.

runApplication → starting   liveness up   readiness down
               → ready      liveness up   readiness up    health = readiness + every check
stop / SIGTERM → stopping   liveness up   readiness down  (switches inside app.stop(), before any shutdown task)
               → stopped    liveness down
  • Liveness is up while the application can serve. Checks never affect it, so a database outage does not restart the process.
  • Readiness is up only while the application is ready: down during startup and from the moment stopping begins.
  • Health is readiness combined with every check. Checks run concurrently; a check that rejects or throws counts as down.

Declare checks

A check is declared beside the resource it checks and listed in that plug's existing provision:

import { healthCheck } from "@openknot-ts/health";

export const databaseHealth = healthCheck({
  name: "database",
  requirements: { database },
  check: async ({ database }, { signal }) => {
    await database.$client.execute("SELECT 1");
    return "up";
  },
});

export const io = providePlugs([database, transaction, databaseHealth, identity, storage]);

healthCheck() returns an ordinary Wire unit that joins the healthChecks collection contract. Every check listed in the application's selected modules joins, in module order; nothing is scanned or registered globally, so two applications in one process keep their own checks. Check names must be distinct; a duplicate fails startup. signal ends with the caller's request or at the check's timeoutMs deadline, one second by default; pass it to native work that accepts one. A check that has not settled by its deadline reports down, so a dependency that holds a request cannot hold the probe. A check is built only when the application selects the health probes, through the health module or an adapter that requires them.

Enable the probes

List the module like any other layer:

import { health } from "@openknot-ts/health";

export const application = defineApplication({
  modules: [behavior, flow, health, io, channels, transport],
  // ...
});

The health module provides probe semantics without adding HTTP routes. For the Node HTTP host, select the separate @openknot-ts/knot-health adapter's healthHttp module instead: its middleware requires the probes, so they join without listing health; it implements generic native middleware, owns path configuration and maps up/down to 200/503. The HTTP host has no health import or dependency. Other transports can consume healthProbes and implement their own protocol mapping.

healthProbes.health({ signal }) also returns the application status and each check's status by name. Public HTTP probes answer only { "status": "up" | "down" }; a host that shows the details protects that view itself.

Kubernetes

Point the probes at the host's paths. When a pod is deleted, Kubernetes removes it from Service endpoints while it sends SIGTERM, so give the endpoints time to propagate before the application stops:

spec:
  terminationGracePeriodSeconds: 30 # above the preStop sleep plus the drain time
  containers:
    - name: api
      livenessProbe:
        httpGet: { path: /livez, port: 3000 }
      readinessProbe:
        httpGet: { path: /readyz, port: 3000 }
      lifecycle:
        preStop:
          sleep: { seconds: 5 }

SIGTERM then stops the application: readiness turns down, the HTTP host stops intake and admitted work finishes with Connection: close before resources close. A graceful signal-initiated stop exits with status 0.

Tests cover the lifecycle phases, checks gathered from several modules, concurrency, failures, the absent module and duplicate names. The separate HTTP adapter's tests and both main examples verify the probes over real HTTP.