postaljs/postal.js
JavaScript pub/sub library supporting advanced subscription features, and several helpful add-ons.
{ "createdAt": "2011-10-27T04:40:05Z", "defaultBranch": "master", "description": "JavaScript pub/sub library supporting advanced subscription features, and several helpful add-ons.", "fullName": "postaljs/postal.js", "homepage": "http://ifandelse.com", "language": "TypeScript", "name": "postal.js", "pushedAt": "2026-03-21T19:59:11Z", "stargazersCount": 2835, "topics": [], "updatedAt": "2026-03-21T19:59:13Z", "url": "https://github.com/postaljs/postal.js"}postal
Section titled “postal”Pub/Sub message bus for JavaScript and TypeScript.
Features
Section titled “Features”- TypeScript-first — full type inference on channels, topics, and message data
- AMQP-style wildcards —
*matches a single topic segment,#matches zero or more - Channel-scoped messaging — isolate message domains with named channels
- Request/handle RPC — built-in request/response pattern
- Wire taps — global observers that see every message on the bus
- Transport system — bridge pub/sub across iframes, workers, and browser tabs
- Zero dependencies — no lodash, no nothing
Install
Section titled “Install”npm install postalQuick Example
Section titled “Quick Example”import { getChannel } from "postal";
const orders = getChannel("orders");
orders.subscribe("order.created", envelope => { console.log("New order:", envelope.payload.orderId);});
orders.publish("order.created", { orderId: "abc-123" });For the full API — wildcards, RPC, wire taps, transports — see the docs.
Upgrading from v2? postal v3 is a ground-up rewrite with breaking changes to the module system, subscriber callbacks, envelope shape, and more. See the v2 → v3 migration guide before upgrading.
Packages
Section titled “Packages”| Package | npm | Description |
|---|---|---|
| [postal]!(packages/postal/) | postal | Core message bus |
| [postal-transport-messageport]!(packages/postal-transport-messageport/) | postal-transport-messageport | MessagePort transport for iframes and workers |
| [postal-transport-broadcastchannel]!(packages/postal-transport-broadcastchannel/) | postal-transport-broadcastchannel | BroadcastChannel transport for cross-tab messaging |
| [postal-transport-serviceworker]!(packages/postal-transport-serviceworker/) | postal-transport-serviceworker | ServiceWorker transport — dedicated MessagePort per tab, presence tracking, SW restart resilience |
| [postal-transport-childprocess]!(packages/postal-transport-childprocess/) | postal-transport-childprocess | child_process/cluster IPC transport for Node.js |
Development
Section titled “Development”pnpm install # Install dependenciespnpm build # Build all packagespnpm test # Run all testspnpm lint # Lint all packagespnpm run checks # lint + test + build (CI gate)License
Section titled “License”MIT