Part VI β The Blueprint Β· Lesson 11.13
Microfrontend
In one lineSplit the frontend by team ownership, compose at runtime, and pay for it in shared-dependency discipline.
Where you've seen itA retail site where the search team ships twice a day and the checkout team ships twice a month, independently.
Diagram
1β2 Β· WHEN THIS IS THE RIGHT ANSWER
in scope independent deploys Β· team autonomy Β· gradual migration
out "it sounds modern" β that is not a reason
scale the honest threshold: 4+ teams, or a legacy app being
strangled route by route
Under 3 teams, a well-structured monorepo beats microfrontends
on every axis. Say this out loud β it's a senior signal.3 Β· RUNTIME COMPOSITION β shell plus remotes
βββββββββββββββββββββ Shell (host) ββββββββββββββββββββββ
β routing Β· auth Β· design tokens Β· shared layout β
β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββββββ β
β β search β β cart β β checkout β β
β β remote β β remote β β remote β β
β β team A β β team B β β team C β β
β ββββββββββββββ ββββββββββββββ ββββββββββββββββββ β
β own repo own repo own repo β
β own deploy own deploy own deploy β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Module Federation loads remotes at RUNTIME from their own URLs β
the shell never rebuilds when a remote ships.6a Β· DEEP DIVE β THE SHARED DEPENDENCY PROBLEM
β each remote bundles its own React
3 remotes Γ 45KB = 135KB, plus TWO React instances
β hooks break, context doesn't cross boundaries
β shared singletons declared by the shell
shared: { react: { singleton: true, requiredVersion: '^18' } }
β one instance, one copy, context works
version skew is the recurring cost: team A wants React 19,
teams B and C are on 18 β a coordinated upgrade, i.e. exactly
the coupling microfrontends were supposed to remove.6b Β· DEEP DIVE β COMMUNICATION BETWEEN REMOTES
β URL the best channel β shareable, debuggable
β custom events / event bus loose coupling, typed contract
β shell-provided context auth, locale, theme (one owner)
β shared global store recreates the coupling you removed
β direct imports remote A importing from remote B
destroys independent deployabilityHow it works
- Split by business domain and team, never by technical layer β "the checkout team", not "the components team".
- Shell owns routing, authentication, design tokens, and shared singletons.
- Remotes are independently built and deployed, loaded at runtime by URL.
- Contract-test the boundary so a remote's breaking change fails its own CI, not production.
- Budget performance centrally (4.5): three teams each adding "just 40KB" is how these sites get slow.
Trade-offs
| Gain | Cost |
|---|---|
| Independent deploys | Runtime integration failures |
| Team autonomy | Duplicate dependencies, version skew |
| Gradual legacy migration | More infra: registry, versioning, CI per remote |
| Tech-stack freedom per team | Inconsistent UX unless tokens are enforced |
Interview angle
"Would you use microfrontends here?"
- Only above roughly four teams, or to strangle a legacy app route by route β otherwise a monorepo with clear module boundaries gives the same isolation with none of the runtime risk.
- If yes: shell owns routing, auth, and shared singletons; remotes deploy independently; communication goes through the URL and events, never a shared store.
- The recurring cost is shared-dependency version skew, and I'd plan an upgrade cadence for it upfront.
Recap
- Split by team and domain; compose at runtime through a shell.
- Shared singletons are mandatory, and their versioning is the ongoing tax.
- Recommending against microfrontends for a small team is the stronger answer.