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/app

v0.15.1

Published

Nwire — managed Container with plugin lifecycle, framework hooks, and DI. Composes apps + plugins, boots in order, exposes a Container, fires framework hooks at every lifecycle transition.

Readme

@nwire/app

The composition root. createApp, appCompose, definePlugin, runtime, framework events.

pnpm add @nwire/app

Quick start

import { createApp } from "@nwire/app";
import { post } from "@nwire/wires/http";
import { z } from "zod";

const app = createApp({ appName: "api" });

app.wire(post("/hello", { body: z.object({ name: z.string() }) }), async (input) => ({
  message: `Hello, ${input.name}!`,
}));

createApp builds an App — a bounded context with its container, plugins, and wires. The App is the unit you endpoint().mount() later.

Plugins

definePlugin(name, setup) declares an installable plugin. Plugins receive a PluginContext with bind (register on the container) and dispose (run on shutdown):

import { definePlugin } from "@nwire/app";

const todoStorePlugin = () =>
  definePlugin("todo-store", ({ bind, dispose }) => {
    const store = new TodoStore();
    bind("todos", store);
    dispose(async () => store.close());
  });

const app = createApp({
  appName: "todo",
  plugins: [todoStorePlugin()],
});

The runtime boots plugins in declaration order and disposes them in reverse on shutdown.

Multi-app composition

Apps don't have to be the whole process. appCompose(...apps) merges several Apps into one — each keeps its own container and plugins; adopters see the merged wire collection but routes back to the source app's container per dispatch.

import { appCompose, createApp } from "@nwire/app";

const ordersApp = createApp({ appName: "orders" /* ... */ });
const inventoryApp = createApp({ appName: "inventory" /* ... */ });

const monolith = appCompose(ordersApp, inventoryApp);
await endpoint("monolith", { port: 3000 }).use(httpKoa()).mount(monolith).run();

Framework events

The runtime fires typed events at lifecycle transitions — AppBooting, AppBooted, AppReady, PluginBooting, PluginBooted, AppShuttingDown, AppShutdown. Observe them from a plugin's ctx on — the payload is typed from the named hook.

import { definePlugin } from "@nwire/app";

const readyLog = definePlugin("ready-log", ({ on }) => {
  on("AppBooted", ({ appName, bootedAt }) => {
    console.log(`${appName} booted at ${bootedAt}`);
  });
});

Surface

  • createApp(opts) — builds an App
  • appCompose(...apps) — merges Apps for monolith composition
  • definePlugin(name, setup) — plugin factory
  • App, CreateAppOptions, PluginContext, PluginDefinition — core types
  • Runtime, createRuntime — the per-App runtime
  • FrameworkEventBus, lifecycle events — AppBooting, AppBooted, etc.

Related