Skip to the page

Frontend at organisation scale · senior

Micro-frontends and Module Federation

Micro-frontends let separate teams build and deploy parts of one web app independently; Module Federation loads those parts at runtime and shares libraries like React as singletons, at the cost of more tooling, version coordination and runtime risk.

The notes

What you must know

  • Why: team autonomy, independent deploys, incremental migration. RazorpayX split its merchant dashboard: the split app's build went from 180+ s to 14 s and tests from 8–10 min to about 2 min.
  • Integration options (Martin Fowler): build-time npm packages (lockstep releases, avoid), server-side composition, iframes (strong isolation, poor UX and routing), runtime JavaScript (Module Federation), Web Components.
  • Module Federation: a host (shell) loads modules that remotes expose, at runtime; shared dependencies like react/react-dom are marked singleton so only one copy runs; version ranges per package. Module Federation 2.0 adds a manifest, a runtime plugin system and type hints, for webpack and Rspack.
  • The shell owns routing, auth, layout, the design system, an error boundary and a fallback per remote (a remote can fail to load).
  • Contracts between apps: props, URL, custom events; keep shared state minimal; test the contracts.
  • Costs: duplicated dependencies, version drift, harder local development and testing (RazorpayX needed the shell repo in CI for tests and types), more network requests, inconsistent UX.
  • When not to: one team or one release cadence — a modular monolith in a monorepo is simpler.

The red pen

Common traps: mistake → fix

  • Mistake: Micro-frontends improve performance

    Fix: they usually add cost; the win is organisational.

  • Mistake: Each team can use any framework freely

    Fix: possible, but every extra framework is shipped to users.

  • Mistake: Share one Redux store across remotes

    Fix: that re-couples the teams.

Easy to hard

Questions interviewers ask, easy to hard

  1. What are micro-frontends and when would you use them?
  2. How does Module Federation share React between apps?
  3. A remote fails to load in production. What does the user see?
  4. Would you use micro-frontends for a team of six? Why not?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview