The problem it solves
Microfrontends solve an organisational problem, not a technical one. The symptom is always the same: several teams share one frontend repository, and shipping has become a negotiation.
- A release train, because nobody can deploy without everyone else's work being ready.
- A merge queue that is permanently full.
- One team's failing test blocking four teams' features.
- An upgrade nobody performs because it would touch every page at once.
If none of those describe you, stop here. A single well-structured frontend with clear module boundaries and lazy-loaded routes gives you most of the benefit and none of the cost. I have seen more projects damaged by premature splitting than by a monolith that got slightly large.
Four ways to compose a UI
"Microfrontend" covers several very different architectures. They are not interchangeable.
| Approach | Composed at | Independent deploy? | Reality |
|---|---|---|---|
| Packages | Build time | No | Each team publishes a library; the shell rebuilds to pick it up. Simple and safe, but a release still needs a shell build, so it does not solve the deployment problem. |
| iframes | Run time | Yes | Total isolation, which is both the feature and the problem. Routing, modals, sizing and shared auth all become work. Genuinely good for embedding something foreign. |
| Web components | Run time | Yes | Framework-neutral, real style encapsulation via shadow DOM. Awkward when you need rich data across the boundary, since attributes are strings. |
| Module federation | Run time | Yes | The shell loads code from another deployed bundle at run time, sharing framework instances. The most capable, and the one with the sharpest edges. |
Shell and remotes
The run-time model that most teams land on: a thin shell owns the frame — the layout, navigation, authentication and routing — and loads remotes on demand. Each remote is a separately built, separately deployed application.
The shell should stay boring and almost empty. Every piece of business logic that creeps into it becomes a thing all teams must coordinate on, which is precisely what you split up to avoid.
Shared dependencies and version skew
This is where the real difficulty lives. Three remotes each built with their own copy of a framework means the user downloads it three times, and — worse — you get three separate framework instances, each with its own injection context and its own idea of global state.
So the framework is declared shared: loaded once, by whichever part loads first, and reused. Which immediately raises the question nobody enjoys: what if the versions differ?
Practical rules that keep this manageable:
- Mark the framework and the router as singletons. Two routers fighting over the same URL is a genuinely baffling bug to debug.
- Agree a version window, and enforce it in CI. Not "everyone upgrades on the same day" — that recreates the release train — but "everyone is within one minor version", checked automatically.
- Decide loudly what happens on a mismatch. Silently loading two copies produces symptoms that look like anything but a version problem. Warning at startup saves days.
- Do not share your own code across remotes. A shared utility package is a shared deploy dependency wearing a disguise.
Who owns the URL
Two routers now exist: the shell's, and each remote's. The split that works is simple and worth stating explicitly:
/orders/* // shell: this prefix belongs to the orders remote
/orders/42 // remote: everything after the prefix is mine
/orders/new
The shell matches a prefix and hands over. It must not know that /orders/42/refund
exists — the moment it does, adding a page requires a shell deploy.
Looking like one product
Users do not know or care that four teams built the page. If the buttons are three different blues, the architecture has leaked into the product.
- Design tokens, not a component library, are the hard dependency. Colours,
spacing and type as CSS custom properties published centrally. A remote reads
var(--brand)and cannot drift. - Scope styles, always. Shadow DOM, CSS modules, or a per-remote class prefix. Global selectors from one remote reaching into another is the worst class of bug here: it appears only when both are on screen, which no single team's test suite covers.
- Own the shared chrome in the shell. Header, navigation, toasts, modals. Three implementations of a toast is how you end up with three stacking contexts fighting.
- Version the design system, do not pin it. Remotes should be able to take a token update without a coordinated release.
The honest costs
Everything above is manageable. The costs below are real and permanent, and worth stating before a team commits:
- Local development is harder. Working on one remote means running the shell too, against either local or deployed versions of the others.
- End-to-end tests have no natural home. A journey crossing three remotes belongs to no team, so it rots unless someone is explicitly assigned it.
- Payload goes up, not down. Shared dependencies help, but a shell plus three remotes is more bytes and more requests than one optimally bundled app.
- Debugging crosses repositories. A stack trace from a federated bundle points at code that lives somewhere else, built by a pipeline you may not have access to.
- Upgrades need coordination anyway. A major framework upgrade touches every remote. You bought independent deploys, not independent dependencies.