Back to projects
Projectadvanced 6 steps ~100 min

Micro-Frontend Shell

Build a shell with a mount/unmount contract, a route registry, a typed event bus, and failure isolation.

What you'll build

A shell app that mounts two micro-frontends, routes between them, passes events, and survives one of them crashing.

  • React
  • module contracts
  • event bus
  • error boundaries
  • routing
Project briefrequirements and design decisions

Requirements

  • Each micro-frontend exposes mount(el, props) and unmount() only
  • The shell owns routing, layout, and auth; remotes own their pages
  • Micro-frontends communicate only through a typed event bus
  • A crash in one micro-frontend shows a fallback without breaking the shell

Architecture decisions

  • Framework-agnostic mount contract keeps teams independent
  • Registry maps routes to remotes, so adding one is configuration
  • Event bus with explicit event names instead of shared stores
  • Error boundaries per remote for failure isolation

Stretch goals

  • Load remotes from separate bundles with dynamic import()
  • Version the contract and handle mismatches
  • Share a design-token package so remotes look consistent

Production checklist

  • Module Federation or import maps for real remote loading
  • Shared dependency strategy (singleton React)
  • Per-remote performance budgets and error monitoring
  • Contract tests between shell and remotes

1What we're building

Micro-frontends let independent teams build, test, and deploy parts of one product separately. The hard part isn't loading code. It's the contracts between the pieces.

You'll build a shell (host app) that:

  1. Loads micro-frontends ("remotes") through a framework-agnostic contract: mount(element, props) returns an unmount() function.
  2. Uses a registry that maps routes to remotes, so adding a remote is configuration, not code.
  3. Gives remotes a typed event bus instead of a shared store.
  4. Isolates failures: if one remote crashes, the shell and other remotes keep working.

In production, remotes come from separate bundles (Module Federation, import maps, or plain import() of a URL). Here they're defined in the same file so you can see everything at once, but they only interact through the contract, exactly as separately deployed code would.

Ownership: the shell team owns routing, layout, auth, and the contract. Each product team owns its remote.

Micro-Frontend Shell project | Bloom