Skip to content

PubSub MFEBrowser-native Pub/Sub for Microfrontends

Zero dependencies, MQTT-style wildcards, production-ready

PubSub MFE

Quick Example

typescript
import { createPubSub } from '@belyas/pubsub-mfe';

// Create a bus instance
const bus = createPubSub({ app: 'my-app' });

// Subscribe with wildcards
bus.subscribe('cart.#', (msg) => {
  console.log('Cart event:', msg.topic, msg.payload);
});

// Publish messages
bus.publish('cart.item.add', { sku: 'ABC123', qty: 1 });
bus.publish('cart.checkout', { total: 99.99 });

Why PubSub MFE?

Built specifically for microfrontend architectures, PubSub MFE solves common communication challenges:

  • Decoupled Communication: Teams work independently without tight coupling
  • Event-Driven Architecture: Build reactive, scalable applications
  • Cross-Tab Coordination: Keep multiple tabs/windows synchronized
  • Historical Context: New components can catch up with past events
  • Production-Ready: Battle-tested with comprehensive error handling

Architecture Overview

PubSub MFE Architecture Diagram - Shows core bus with adapters for cross-tab, history, and iframe communication

Architecture: Core bus with pluggable adapters

What's Next?

New to PubSub MFE?

Start with the Getting Started Guide to learn the basics.

Looking for specific features?

Check out the Core Concepts to understand the architecture.

Migrating from another solution?

See Best Practices for migration patterns.

Released under the Apache-2.0 License.