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

@nwire/endpoint

v0.15.1

Published

Nwire — production process lifecycle. Wraps any Node server (Express, Fastify, Koa, Nest, Nwire interfaces) with K8s-grade graceful shutdown, http-terminator drain, and lightship readiness/liveness probes. Standalone — no framework dependency beyond @nwir

Readme

@nwire/endpoint

Process lifecycle — boot an app under one or more transports, drain in-flight work on SIGTERM, surface K8s probes. The only Nwire layer that talks to the operating system.

pnpm add @nwire/endpoint

Quick example

import { createApp } from "@nwire/app";
import { endpoint } from "@nwire/endpoint";
import { httpKoa } from "@nwire/koa";

const app = createApp({ appName: "api" });
// ... app.wire(...) wires here ...

await endpoint("api", { port: 3000 }).use(httpKoa()).mount(app).run();

.use(adopter) installs a transport runtime — httpKoa, expressAdapter, queueInMemory, bullmqAdapter, mcpAdapter, cronAdapter. Each adopter consumes the wires whose binding matches its kind. Stack as many as you want on one endpoint; the same wires run under all of them.

Multi-transport example

import { createApp } from "@nwire/app";
import { endpoint } from "@nwire/endpoint";
import { httpKoa } from "@nwire/koa";
import { queueInMemory } from "@nwire/queue";
import { mcpAdapter } from "@nwire/mcp";

await endpoint("svc", { port: 3000 })
  .use(httpKoa({ prefix: "/api" }))
  .use(queueInMemory())
  .use(mcpAdapter())
  .mount(app)
  .run();

Adopter contract

interface Adapter {
  readonly $kind: "adapter";
  readonly kind: string; // "http", "queue", "mcp", ...
  boot(ctx: AdapterBootContext): Promise<void>;
  shutdown(reason?: string): Promise<void>;
}

interface AdapterBootContext {
  readonly wires: ReadonlyArray<Wire>;
  containerOf(wire: Wire): Container | undefined;
  readonly logger: Logger;
  addCheck(check: HealthCheck): void;
}

Each adopter receives the full wire collection at boot, picks the ones it serves (binding.$adapter === <its kind>), and dispatches handlers through the runtime when forge is in play, or directly otherwise.

Lifecycle

| Stage | What runs | | ------- | ------------------------------------------------------ | | boot | App plugins boot; adopters consume wires; probes open. | | serve | Adopters listen / subscribe; readiness flips green. | | drain | SIGTERM/SIGINT: stop accepting new work, finish open. | | close | Adopters shut down in reverse order; probes close. |

endpoint() returns a RunningEndpoint from .run(). Tests call running.shutdown("test") to skip the SIGTERM dance.

Config

endpoint("api", {
  banner: true, // boot banner on stdout
  probes: { port: 9_400, enabled: true },
  shutdown: { drainTimeout: 30_000, hardTimeout: 5_000 },
  exitOnShutdown: true, // tests pass false
});

Probes

When probes.enabled is true, a separate HTTP server on probes.port (default 9400) serves:

  • GET /live — liveness; 200 if the process is up
  • GET /ready — readiness; 200 once boot completes and all addCheck() contributors pass

Both are intentionally on a separate port from the app — Kubernetes can poll them without touching the app's traffic.

Related