postaljs/postal.js

JavaScript pub/sub library supporting advanced subscription features, and several helpful add-ons.

TypeScript

2,835

429 commits

updated Jun 30, 2026

See the code

README

postal

Pub/Sub message bus for JavaScript and TypeScript.

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

npm install postal

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

PackagenpmDescription
postalpostalCore message bus
postal-transport-messageportpostal-transport-messageportMessagePort transport for iframes and workers
postal-transport-broadcastchannelpostal-transport-broadcastchannelBroadcastChannel transport for cross-tab messaging
postal-transport-serviceworkerpostal-transport-serviceworkerServiceWorker transport — dedicated MessagePort per tab, presence tracking, SW restart resilience
postal-transport-childprocesspostal-transport-childprocesschild_process/cluster IPC transport for Node.js
postal-transport-udspostal-transport-udsUnix domain socket transport for independent Node.js processes

Development

pnpm install       # Install dependencies
pnpm build         # Build all packages
pnpm test          # Run all tests
pnpm lint          # Lint all packages
pnpm run checks    # lint + test + build (CI gate)

License

MIT

postaljs/postal.js

JavaScript pub/sub library supporting advanced subscription features, and several helpful add-ons.

TypeScript

2,835

429 commits

updated Jun 30, 2026

See the code

README

postal

Pub/Sub message bus for JavaScript and TypeScript.

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

npm install postal

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

PackagenpmDescription
postalpostalCore message bus
postal-transport-messageportpostal-transport-messageportMessagePort transport for iframes and workers
postal-transport-broadcastchannelpostal-transport-broadcastchannelBroadcastChannel transport for cross-tab messaging
postal-transport-serviceworkerpostal-transport-serviceworkerServiceWorker transport — dedicated MessagePort per tab, presence tracking, SW restart resilience
postal-transport-childprocesspostal-transport-childprocesschild_process/cluster IPC transport for Node.js
postal-transport-udspostal-transport-udsUnix domain socket transport for independent Node.js processes

Development

pnpm install       # Install dependencies
pnpm build         # Build all packages
pnpm test          # Run all tests
pnpm lint          # Lint all packages
pnpm run checks    # lint + test + build (CI gate)

License

MIT

Project health

Overall

2.8/10

Maintained

0/10

Code review

0/10
OpenSSF Scorecard

Latest release

3.2.0 · Mar 21, 2026

Releases this year

3

Significant stargazers

Nicholas Bollweg

253 followers · starred Oct 2011

James M. Greene

719 followers · starred Oct 2011

Sergio Campamá

107 followers · starred Apr 2013

Matthias Kestenholz

362 followers · starred Jan 2014