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

v0.7.1

Published

Nwire — the framework's core primitives. defineAction, defineEvent, defineHandler, defineActor, defineProjection, defineQuery, defineWorkflow, defineModule, defineApp, definePlugin, createApp. MessageEnvelope with correlation/causation. The runtime is the

Readme

@nwire/forge

The framework's domain primitives — one import for actions, actors, events, workflows, projections, modules, and the runtime that ties them together.

What it does

Provides the define* surface that domain code uses every day, plus the runtime that fires them. Forge composes lower packages (@nwire/messages, @nwire/handler, @nwire/app) into one ergonomic API; you can also use the lower packages directly when you want a narrower surface.

Install

pnpm add @nwire/forge zod

Quick start

import { z } from "zod";
import { defineEvent } from "@nwire/messages";
import { defineAction, defineActor, defineModule, createApp } from "@nwire/forge";

// 1. A past-tense fact the domain cares about.
export const StudentWasEnrolled = defineEvent({
  name: "enrollments.student-was-enrolled",
  schema: z.object({ studentId: z.string(), courseId: z.string() }),
});

// 2. An aggregate that holds state + invariants.
export const Student = defineActor("Student", {
  schema: z.object({
    studentId: z.string(),
    enrolments: z.array(z.string()),
  }),
  initial: (id: string) => ({ studentId: id, enrolments: [] }),
  methods: {
    enrol(state, courseId: string) {
      if (state.enrolments.includes(courseId)) return state;
      return { ...state, enrolments: [...state.enrolments, courseId] };
    },
  },
});

// 3. A user-visible command that emits the event.
export const enrolStudent = defineAction({
  name: "enrollments.enrol-student",
  schema: z.object({ studentId: z.string(), courseId: z.string() }),
  emits: [StudentWasEnrolled],
  handler: async (input, { use }) => {
    const student = await use(Student, input.studentId);
    student.enrol(input.courseId);
    return StudentWasEnrolled({
      studentId: input.studentId,
      courseId: input.courseId,
    });
  },
});

// 4. A module bundles the bounded context.
export const enrollmentsModule = defineModule("enrollments", {
  events: [StudentWasEnrolled],
  actors: [Student],
  actions: [enrolStudent.public()],
});

// 5. createApp wires the modules into a runnable app.
export const app = createApp({ modules: [enrollmentsModule] });
await app.start();
await app.runtime.dispatch(enrolStudent, { studentId: "avi", courseId: "heb-1" });

API surface

| Primitive | Purpose | | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | | defineAction | User-visible command — validated input, emits events | | defineEvent | Past-tense fact (re-exported from @nwire/messages) | | defineHandler | Operation primitive — transport-agnostic | | defineActor | Aggregate with state, methods, optional state machine | | defineSchema | Data shape + lifecycle states + storage hints | | defineProjection | Read-model fold over events | | defineQuery | Projection-backed read function | | defineWorkflow | Reaction + saga unified — stateful or stateless | | defineModule | Bundle of actors + actions + events + projections + queries | | defineApp | App declaration (multi-wire instantiation) | | createApp | App runtime — boots modules, owns the bus | | definePlugin | Cross-cutting: provide bindings, hook lifecycle, intercept dispatch | | defineResource | Public response shape (field allowlist + OpenAPI schema) | | defineError | Typed throwable with status code | | defineMiddleware | Reusable handler middleware step | | defineCron, defineInbox, defineOutbox, defineExternalCall, defineInboundWebhook | Orchestrator primitives | | runCli(app, argv) | Argv dispatcher — operator CLI without HTTP |

Forge also re-exports MessageEnvelope, seedEnvelope, deriveEnvelope from @nwire/envelope and the Logger contract from @nwire/logger.

When to use forge

When you want the full framework DX in one import. If you only need typed handlers without the actor/event machinery, pull @nwire/handler instead; if you only need lifecycle + plugins, pull @nwire/app. Forge is the default for app code; the smaller packages are the standalone path.