Skip to content

Install

Requirements

  • Node ≥ 22 (v24 recommended)
  • pnpm ≥ 10 (works with npm/yarn too, but pnpm is the workspace's package manager and the only one tested in CI)
  • TypeScript ≥ 5.9 — Nwire ships strict types and assumes a configured tsconfig

Scaffolder

The fastest start is create-nwire:

bash
pnpm create nwire my-app
cd my-app
pnpm install
pnpm dev

Templates ship; pick the smallest that fits, you can grow into the others without rewriting:

TemplateIncludesWhen to use
service@nwire/app + @nwire/koa: container plugin, structured errors, middleware, in-memory storeCRUD service, single store, ~handful of routes
enterprise+ @nwire/forge: actions, actors, events, projections, workflowsReal domain model, multiple bounded contexts
mcp@nwire/app + MCP wires over stdioModel Context Protocol server for AI clients
bash
pnpm create nwire my-app --template service
pnpm create nwire my-app --template enterprise
pnpm create nwire my-app --template mcp

Manual install

Pick the packages you need:

bash
# Minimal HTTP + graceful shutdown
pnpm add @nwire/app @nwire/endpoint @nwire/wires @nwire/koa zod

# + events and listeners (the everyday decoupling tool)
pnpm add @nwire/app @nwire/endpoint @nwire/wires @nwire/koa @nwire/messages zod

# Full framework with the forge battery (actions/actors/projections/workflows)
pnpm add @nwire/app @nwire/endpoint @nwire/forge @nwire/messages @nwire/wires @nwire/koa zod

@nwire/messages is where defineEvent lives — add it as soon as you reach for events (it also rides in transitively with @nwire/forge).

The package catalog and what each one ships: Reference → Packages.

The nwire command

The CLI binary lives in @nwire/cli, not in the bare nwire package on npm (which is an unrelated DI library by a different author). Scaffolded projects depend on @nwire/cli directly; for a global install use pnpm add -g @nwire/cli (or npm i -g @nwire/cli). The binary registered by that package is still nwirenwire ls, nwire dev, nwire doctor all work as documented once @nwire/cli is installed.

TypeScript config

Nwire is ESM-only. Minimum tsconfig:

jsonc
{
  "compilerOptions": {
    "target":           "ES2022",
    "module":           "ESNext",
    "moduleResolution": "Bundler",
    "strict":           true,
    "esModuleInterop":  true,
    "skipLibCheck":     true,
    "types":            ["vite/client"]
  },
  "include": ["app/**/*"]
}

If you're using tsc (not a bundler), use "moduleResolution": "NodeNext" and append .js to relative imports.

Project layout

The shortest viable layout is one folder:

my-app/
  app/
    main.ts         # entry — endpoint().use(httpKoa()).mount(app).run()
    api.ts          # wires array
  package.json
  tsconfig.json

For larger projects with multiple bounded contexts, see Project structure.

MIT licensed.