Reference
The API surface, organized by primitive and by package.
Primitives
The define* functions that domain code uses every day. Each has its own page with signature, params, return type, runtime semantics, and a working example.
Core
defineHandler— operation primitive (transport-agnostic)defineEvent— past-tense fact with a Zod schemacreateApp— build an App (bounded context with container + plugins + wires)definePlugin— cross-cutting plugindefineResource— public response shape (field allowlist)defineError— typed throwable error
Forge (CQRS battery, opt-in)
defineAction— user-visible command, validated input, emits eventsdefineActor— aggregate root with state, methods, optional state machinedefineWorkflow— reaction + saga unifieddefineProjection— fold events into a read modeldefineQuery— projection-backed read functiondefineSchema— data shape + lifecycle states
Orchestrator
defineCron— scheduled action runnerdefineInbox— inbound message deduplicatordefineOutbox— at-least-once publisherdefineExternalCall— typed outbound HTTP/RPCdefineInboundWebhook— signature-verified webhook receiver
HTTP
- Route bindings —
get/post/put/patch/delfrom@nwire/wires/http endpoint()+ lifecycle — graceful shutdown- K8s probes;
.use(adopter).mount(app).run()
- K8s probes;
@nwire/koaREADME — the canonical HTTP adopter@nwire/expressREADME — Express-backed adopter + foreign mount helpers
Other
- Packages — every
@nwire/*package with a one-liner - CLI —
nwire dev,nwire run,nwire studio,nwire please, … - Runtime API —
runtime.execute,runtime.query,runtime.publish, … - Telemetry kinds — every record the telemetry stream emits
Conventions
- All primitives accept an object literal as their primary argument. Some accept a positional
namestring first. - Names use kebab-case prefixed by the bounded context:
orders.place-order. - Exported symbols use PascalCase:
OrderWasPlaced. - Cross-App events that flow over a bus carry an explicit
versionnumber.