Scope
What Busly is and what it is not
Busly exists to pass messages between parts of an application that would otherwise have no way of communicating. It is not a shared state solution. If you find yourself needing to share large pieces of state between incompatible parts of your application, that's usually a sign the architecture deserves a second look.
Architecture decisions
A couple of design decisions are worth knowing about before you use Busly, because they become an implicit part of its contract.
Busly doesn't validate payloads
Busly checks that every message has the shape of a Busly envelope, but it has no way of knowing whether the payload application A sent matches what application B expects.
That responsibility is left to you, on purpose. It lets you decide how, and how strictly, payloads should be validated, while the event bus itself stays lean and focused on delivery. If you need validation, you can add it to your own event handlers, or extend an adapter to validate payloads before they reach them.
Busly events are untrusted data
The bus carries messages from one part of the frontend to another, and like any other frontend code, it can be tampered with if a malicious script gets into the page. The bus itself, its events, and their payloads are all exposed in that case.
Any script that can read your application's memory can also read the events and their payloads. So treat events as untrusted data, validate payloads as far as you consider necessary, and avoid sending sensitive data through the bus, just as you would avoid storing it in localStorage or sessionStorage.
Browser only
Busly is built for the browser. On the server, every official adapter does nothing, because @busly/core keeps a single listener registry per JavaScript process, and a server rendering several requests at once would leak events between them. See Server-side rendering for details.