Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Storefront Architecture

How drop-ins coordinate on a page

Multiple drop-ins on one page (for example, Cart and Auth) share a single event busA shared in-memory channel that lets drop-in components on the same page publish and subscribe to events without depending directly on each other. (@dropins/tools/event-bus.js). They publish and listen for small messages so each package can react without importing the others directly. Read this page before you rely on Events alone. Otherwise it is easy to mix up in-page bus messages with analytics data or calls to Commerce services.

Each colored box is a drop-in package on the same page. Solid arrows show events emitted to the bus; dashed arrows show events consumed from the bus. Pink is your custom code alongside those drop-ins.

Loading diagram...
Solid arrows: events emitted. Dashed arrows: events consumed. Your storefront code can emit and listen alongside drop-ins.
  • events.on(name, handler, options) — subscribe. Returns a subscription handle.
  • events.emit(name, payload) — publish an event
  • subscription.off() — unsubscribe (call on the handle returned from events.on)

Each drop-in component documents which events it emits and listens to. See the event bus API reference and the drop-in events overview for details.

Commerce services and backends explains Edge Delivery, the boilerplate, backends, hosted catalog and search services, and prerequisites.