@jorvel/events
A tiny, dependency-free package that holds the event contract — the typed map of event names → payloads shared across every micro-frontend. Because @jorvel/event-bus is a Module Federation singleton, an event a host emits is received by handlers a remote registered, and vice-versa. Keeping the contract in one package gives both sides the same types.
MfAppEvents
ts
import { getEventBus } from '@jorvel/event-bus';
import type { MfAppEvents } from '@jorvel/events';
const bus = getEventBus<MfAppEvents>();
bus.emit('shell:ready', { timestamp: Date.now() }); // host
const off = bus.on('shell:ready', ({ timestamp }) => {}); // remote — fully typed payloadExtending the contract
Own your app's events by defining your own map (this package is a starter). Any Record<string, unknown> works with getEventBus<T>().
ts
export interface AppEvents {
'cart:add': { sku: string; qty: number };
'auth:login': { userId: string };
'shell:ready': { timestamp: number };
}
// share this type across host + remotes (a workspace package or a federated contract)See @jorvel/event-bus for the runtime (emit/on/once, wildcard, replay, schema validation, cross-tab broadcast).
