Primitives
Every public define* / create* primitive, grouped by what it's for. Summaries come straight from each symbol's doc comment, so this page can't drift from the shipped surface. Each links to its full reference page.
App & transport
Build an app, wire handlers, mount it under an endpoint.
| Primitive | Package | What it does |
|---|---|---|
createApp | @nwire/app | Create an app — the container, plugins, and handlers that make up a backend. |
appCompose | @nwire/app | Compose several apps into one process; each keeps its own container. |
createTestApp | @nwire/test-kit | Boot an app in-process with in-memory adapters, for tests. |
definePlugin | @nwire/app | Package cross-cutting behaviour: container bindings, lifecycle hooks, boot/shutdown work. |
defineCapability | @nwire/runtime | Declare a typed capability that locks a ctx contribution into the type system and the runtime. |
Handlers, errors & responses
The transport-agnostic unit of work and the surface it presents.
| Primitive | Package | What it does |
|---|---|---|
defineHandler | @nwire/handler | Define a named handler — the transport-agnostic unit of work. |
defineResource | @nwire/handler | Declare the public shape of a response; the field allow-list is the contract. |
defineError | @nwire/handler | Declare a typed, status-tagged error to throw; the transport renders it safely. |
Events & reactions
Announce facts and react to them.
| Primitive | Package | What it does |
|---|---|---|
defineEvent | @nwire/messages | Declare a past-tense fact with a schema — emitted by handlers, reacted to by listeners. |
defineAction | @nwire/forge | Declare a command: a named, typed intent a handler fulfils and may emit events from. |
defineCommand | @nwire/messages | Declare a typed command message (name + input schema). |
Forge — state & read models
The opt-in battery for things that hold state and views you query.
| Primitive | Package | What it does |
|---|---|---|
defineActor | @nwire/forge | Model a thing with identity that owns its state and enforces a rule. |
defineSchema | @nwire/forge | Declare an actor's data shape, key, and lifecycle states, once. |
defineProjection | @nwire/forge | Fold events into a read model shaped for how it's queried. |
defineQuery | @nwire/forge | Declare a typed read over a projection. |
defineWorkflow | @nwire/forge | React to events over time: a stateless reaction or a stateful saga with timers. |
Orchestrator — scheduled & external work
Cron, inbox/outbox, webhooks, and outbound calls.
| Primitive | Package | What it does |
|---|---|---|
defineCron | @nwire/forge | Run a handler on a schedule. |
defineInbox | @nwire/forge | Deduplicate and record inbound messages for idempotent processing. |
defineOutbox | @nwire/forge | Buffer outbound events for reliable delivery. |
defineExternalCall | @nwire/forge | Wrap a call to another system with retries and telemetry. |
defineInboundWebhook | @nwire/forge | Turn an inbound HTTP webhook into a typed dispatch. |
Access control
Permissions and policy.
| Primitive | Package | What it does |
|---|---|---|
defineAbility | @nwire/rbac | Define an ability factory — a pure function from a user to a CASL ability. |
Other
| Primitive | Package | What it does |
|---|---|---|
createAppHooks | @nwire/app | Construct a per-App lifecycle registry with every built-in slot pre-instantiated. |
createMongoActorStore | @nwire/mongo | A MongoDB-backed actor store (collections + lock) from one Db. |
createPinoLogger | @nwire/logger-pino | A Logger backed by pino with sensible defaults. |
defineEnv | @nwire/config | Declare the app's environment contract from a zod schema. |
defineRegistry | @nwire/app | Declare an app registry by hand. |
27 primitives.