Getting Started
Installation
Section titled “Installation”postal ships as ESM and CJS with full TypeScript declarations. No peer dependencies.
Basic pub/sub
Section titled “Basic pub/sub”getChannel is a singleton factory — calling it with the same name always returns the same channel instance. Subscribers receive the full Envelope, not just the payload.
Wildcard subscriptions
Section titled “Wildcard subscriptions”See Concepts for the full wildcard matching rules.
Typed channels
Section titled “Typed channels”postal supports compile-time payload inference so publish, subscribe, and request know your payload types. There are two approaches — pick whichever fits your project.
Explicit type map
Section titled “Explicit type map”Pass your topic map as a generic to getChannel:
This is the simplest approach — define a type, pass it where you need it.
Registry augmentation
Section titled “Registry augmentation”If the same channel is used across many files, you can register the type map globally via module augmentation. Every getChannel("orders") call infers the map automatically — no generic required:
Request / Handle
Section titled “Request / Handle”postal includes correlation-based RPC. Define RPC topics with { request, response } payloads:
Next steps
Section titled “Next steps”- Concepts — channels, topics, wildcards, and envelopes in depth
- Subscriptions — the full subscribe API
- Wire Taps — global bus observers