How do you migrate a monolithic React app to micro-frontends without breaking production?

AdvancedMicro-frontends interview questionBy , updated 21 November 2026

Short answer

You migrate incrementally, never with a rewrite. Put a thin layer in front of the monolith that decides who renders each route, extract one well-bounded area into its own app, release it behind a flag to a small share of users, and delete the old code only after the new app has run cleanly in production. The monolith keeps serving everything you have not moved yet, so there is always a working fallback.

Start with the reason and the boundaries

Before touching code, write down what the migration is for. "Team A cannot release without waiting for team B" is a reason. "Micro-frontends are modern" is not, and Micro-frontends: when do they help and when do they hurt? covers when the split costs more than it saves.

Then draw boundaries along business domains and team ownership, not along technical layers. Good candidates are areas that already have their own URLs and little shared state: account settings, checkout, search, an admin section. A "shared components" micro-frontend or a "data layer" micro-frontend is a sign the cut is in the wrong place.

The strangler pattern for frontends

The safe shape is the strangler fig: new code grows around the old system and takes over one route at a time until the old system can be removed. There are two common ways to put that "around" layer in place.

Split at the edge. A CDN rule, reverse proxy or edge function sends /account/* to the new app and everything else to the monolith. Each app is a separate page load. This is the lowest-risk first step, because the two apps share nothing at runtime, and rollback is a routing change.

location /account/ { proxy_pass http://account-app; }
location /         { proxy_pass http://monolith; }

Make the monolith the first host. Add Module Federation or an import-map loader to the monolith so it can mount a remote inside its own layout. Users get in-page navigation with no full reload, at the price of sharing React, the router and the session across bundles. Over time the monolith shrinks until it is just a shell. The mechanics are in What is Module Federation? and What are the ways to integrate micro-frontends?.

Extract one slice end to end

Pick the first slice for low risk, not high value. A settings page with few dependencies teaches you the whole pipeline (build, deploy, routing, auth, monitoring) without putting revenue on the line.

For that slice:

  1. Copy or move its code into a new app with its own repository or workspace package and its own pipeline.
  2. Replace direct imports of monolith internals with explicit inputs: props or a mount function that receives the user, a base path and a navigate callback.
  3. Move shared UI into a versioned design system package rather than reaching back into the monolith.
  4. Give the new app its own error boundary and loading state, so a failure stays inside its area.

The hardest part is usually not the code but the hidden coupling: a global Redux store that other screens read, a CSS file that styles everything, or a utility that quietly reads window state. Build the slice in isolation early: every compile error is a dependency you have to turn into a contract.

Release behind a flag and run both versions

Do not switch traffic in one go. Keep the old implementation in the monolith and decide per request which one renders:

function AccountRoute() {
  const useNewAccount = useFlag("account-mfe");
  return useNewAccount ? <RemoteAccount /> : <LegacyAccount />;
}

Roll out to internal users first, then a small percentage, then everyone, watching error rates, Web Vitals and business metrics for that route at each step. If anything regresses, flip the flag back. Evaluate the flag before first render so users do not see the old page flash into the new one; designing feature flags without flicker covers that.

Only when the new app has carried full traffic for a while do you delete the legacy code. Deleting it is the step people skip, and skipping it leaves you maintaining two versions forever.

Shared concerns to settle early

Common follow-up questions

How long should the migration take?

As long as it needs, with no feature freeze. Each slice ships on its own, so product work continues in both the monolith and the new apps. The webpack migration question uses the same incremental thinking for a bundler change.

Should the first micro-frontend use a new framework?

Usually not. Changing the architecture and the framework at once doubles the unknowns. Migrate the architecture on the framework you have, then upgrade frameworks per app later if there is a reason.

What if the monolith and the new app need the same data?

Have both fetch it from the same API rather than sharing an in-memory store. A shared client cache package is fine if it is versioned; a shared mutable global is not.

How do you know the migration is working?

Track deploy frequency and lead time for the teams that moved, plus error rate and performance of migrated routes. If teams still wait on each other, the boundaries are wrong.

Mistakes to avoid

  • A big-bang rewrite that ships nothing until every area is moved

  • Extracting the riskiest, most coupled area first

  • Switching traffic without a flag or routing rule that can switch it back

  • Leaving the legacy implementation in place long after the new one is live

  • Splitting by layer (UI, data, utilities) instead of by domain and team

Practise it in code

Interviewers rarely stop at the definition. These questions open in an editor with tests.

  1. Design a large enterprise React application with micro-frontends, permissions, and deployment strategiesHard60 min
  2. Build a micro-frontend orchestrator: app lifecycles, route matching, queued navigations and broken appsHard60 min
  3. Design a micro-frontend shell with independent deployment and shared dependency versioningHard60 minFree
  4. Migrate a large webpack app to Vite or Next.js without a feature freezeHard50 min
  5. Design feature flags and A/B tests that cause no flicker or layout shiftHard60 min