Your company's main web product is a large single-page app (a B2B operations suite: dashboards, billing, inventory, user admin, reporting). About 15 teams commit to one front-end repository and one deploy pipeline. Releases happen twice a week, a single broken test blocks everyone, and the build takes 25 minutes.
The CTO wants teams to ship independently. Design a micro-frontend platform: how the product is split, how pieces are composed at runtime, how they share dependencies, routing, auth and design, how they are deployed and rolled back, and how the platform is governed.
The interviewer may add:
The stated pain is coupled delivery: one pipeline, one test suite, one release train. Micro-frontends are one fix for that, but not the only one, and a lead-level answer says so before drawing boxes. Many of the symptoms (slow build, flaky shared tests, everyone blocked) can be solved inside a monolith with a well-structured monorepo, affected-only builds and ownership boundaries. Micro-frontends are justified when you also need independent deployment and heterogeneous stacks, which this brief has (two acquired apps in Vue and Angular).
The goal is therefore: independently deployable vertical slices, composed by a thin shell, with a small number of strictly versioned contracts between them, and a platform team that keeps the whole thing feeling like one product.
Split vertically by business domain and route, not horizontally by UI layer. Billing owns /billing/*, Inventory
owns /inventory/*. Each team owns its slice end to end: UI, BFF calls, tests, deploy. Horizontal splits ("the header
team", "the table team") create exactly the coordination you are trying to remove.
A handful of shared widgets (global search, notifications bell) are exposed by their owning team as federated modules and mounted by the shell.
mount, unmount) and is loaded from the CDN at an immutable,
content-hashed URL.Server-side composition (fragments stitched at the edge or with something like Podium, or ESI) shines for SEO and first paint of content-heavy sites. This product is authenticated and app-like, so client-side composition with a manifest is simpler and gives instant per-MFE rollback. If first load became a problem, the shell's HTML could be server-rendered while MFEs remain client-rendered.
The registry stores every published version; the manifest service resolves which version each user gets.
{
"schemaVersion": 2,
"generatedAt": "2025-06-02T10:15:00Z",
"shared": {
"react": { "version": "19.1.0", "url": "https://cdn.acme.com/shared/react@19.1.0/index.js" },
"@acme/design-system": { "version": "6.4.2", "url": "https://cdn.acme.com/shared/ds@6.4.2/index.js" }
},
"mfes": {
"billing": {
"version": "2025.06.02-1312-a1b2c3",
"entry": "https://cdn.acme.com/mfe/billing/a1b2c3/remoteEntry.js",
"routes": ["/billing"],
"framework": "react",
"contract": "mfe-lifecycle@2",
"integrity": "sha384-..."
},
"reports": {
"version": "4.8.0",
"entry": "https://cdn.acme.com/mfe/reports/9f8e7d/main.js",
"routes": ["/reports"],
"framework": "angular",
"contract": "mfe-lifecycle@2"
}
}
}
Resolution rules (most specific wins): tenant pin, then canary cohort, then default "production" channel. Pins give compliance customers an auditable, reproducible composition.
Cross-MFE events are versioned, typed and documented in a shared package. Keep the list short; every event is a coupling point.
type PlatformEvent =
| { type: 'billing.plan-changed@1'; payload: { tenantId: string; planId: string } }
| { type: 'session.expired@1'; payload: {} }
| { type: 'nav.request@1'; payload: { path: string; replace?: boolean } };
Framework-agnostic so React, Vue and Angular all implement it:
export interface MfeContext {
basePath: string; // e.g. "/billing"
container: HTMLElement; // region the MFE owns
auth: { getAccessToken(): Promise<string>; user: Readonly<User> };
flags: { isEnabled(key: string): boolean; onChange(cb: () => void): () => void };
telemetry: { track(name: string, props?: Record<string, unknown>): void; captureError(e: unknown): void };
i18n: { locale: string; onLocaleChange(cb: (l: string) => void): () => void };
events: {
emit<E extends PlatformEvent>(e: E): void;
on<T extends PlatformEvent['type']>(type: T, cb: (e: Extract<PlatformEvent, { type: T }>) => void): () => void;
};
navigate(path: string, opts?: { replace?: boolean }): void;
}
export interface MicroFrontend {
contract: 'mfe-lifecycle@2';
mount(ctx: MfeContext): Promise<void> | void;
unmount(): Promise<void> | void;
onRouteChange?(path: string): void;
}
The shell wraps every mount in an error boundary equivalent: a timeout, try/catch, and a fallback panel ("Billing
is temporarily unavailable, retry") with the error reported tagged by MFE name and version.
npx @acme/mfe create billing --framework react # scaffold from the paved-road template
npx @acme/mfe dev --shell=staging # run this MFE locally inside the deployed staging shell
npx @acme/mfe publish --channel canary # upload to CDN, register version, start canary
npx @acme/mfe promote billing@2025.06.02-1312 --to production
npx @acme/mfe rollback billing # repoint channel to previous version, no rebuild
CI checks per MFE: contract test against the shell's MfeContext type, bundle-size budget, shared-dependency
compatibility check (does it require a React major the shell does not provide?), and a smoke test that mounts the MFE
in a headless shell.
| Option | Strengths | Weaknesses | Use it for |
|---|---|---|---|
Module Federation (webpack 5, Rspack, @module-federation/enhanced, Vite plugin) | Runtime sharing of dependencies with version negotiation; type hints via MF 2.0; mature ecosystem | Couples to bundler support; shared singleton mismatches fail at runtime; debugging is harder | React MFEs on the paved road |
| Native ES modules + import maps (optionally with single-spa) | Standards-based, bundler-agnostic, simple mental model; import maps now supported in all evergreen browsers | Sharing must be designed by hand (one URL per shared lib); no automatic version negotiation | Mixed-framework estates; teams on different bundlers |
| iframes | Strongest isolation: CSS, JS globals, crashes, even different CSP | Poor UX integration (sizing, focus, modals, deep links), duplicated framework downloads, cross-frame messaging | Untrusted or legacy apps; the Angular acquisition in phase 1 |
| Web components as the boundary | Framework-neutral mount points; Shadow DOM style isolation | Still need a loader; SSR and theming complexity | Shared widgets across frameworks |
| Build-time composition (npm packages) | Simplest, best performance and type safety | No independent deploy; this is a modular monolith | Shared libraries, not MFEs |
Recommendation: Module Federation for the React MFEs (most of the estate), the same lifecycle contract on top so the shell does not care how an MFE was built, an iframe as a transitional host for the acquired Angular app, and a web-component wrapper for the Vue app's two embeddable widgets. Re-evaluate import maps if teams diverge on bundlers.
The biggest technical risk is dependency drift. Rules:
The shell owns the top-level segment and maps it to an MFE; each MFE owns everything under its base path with its own
router configured with basename. Cross-MFE navigation goes through ctx.navigate so there is one history stack.
Links between domains use plain URLs, which keeps deep links working even if an MFE is rewritten.
No shared global store. Each MFE fetches its own data through its BFF and caches it with its own query layer. Shared facts (current user, tenant, entitlements, locale) come from the platform SDK as read-only values with change subscriptions. A shared Redux store across MFEs re-creates the monolith with worse tooling.
Design-system tokens as CSS custom properties defined by the shell; each MFE's own CSS is scoped (CSS Modules or a build-time prefix). Global resets live only in the shell. Shadow DOM is used only for widgets embedded in foreign frameworks, because it complicates portals, modals and focus management.
modulepreload the likely next MFE based on navigation hover or idle time.Deploy = upload immutable assets + register a version. Release = move a channel pointer in the registry. Because the manifest is resolved at runtime (cache TTL around 60 seconds), rollback is a pointer flip with no rebuild. Canary cohorts are defined by percentage or tenant, and automated rollback triggers on error-rate or LCP regression for the canary cohort compared to control.
Handle version skew: a user's open tab may hold the old manifest when a new MFE version ships. MFE entries are immutable and kept for at least 30 days, so stale tabs keep working; the shell re-fetches the manifest on navigation and on focus.
MfeContext).One CSP for the shell document listing CDN origins; Subresource Integrity on MFE entries where possible; tokens held by
the shell and handed out via getAccessToken rather than read by every MFE from storage; iframes for anything with
lower trust, with sandbox and origin-checked postMessage.
mfe-lifecycle@3) supported in parallel for two quarters.When would you not use micro-frontends? Fewer than about 5 teams, one framework, and no hard need for independent deploys. A modular monolith in an Nx or Turborepo monorepo with enforced module boundaries, affected-only CI and code owners gives most of the benefits with none of the runtime complexity.
Two MFEs need the same user list with live updates. Shared store? No. Either one domain owns it and exposes it via an event or a federated hook, or both read from the same API with their own caches. If it happens often, the boundary is probably wrong.
How do you upgrade React from 18 to 19 across 20 MFEs? Make the shell capable of providing both versions (shared scope per major), let MFEs migrate on their own schedule within a deadline, track progress in the registry, then drop 18. Budget it as a program, with a codemod and office hours.
How do you debug a production issue that spans two MFEs?
Every telemetry event and error carries MFE name, version and a trace ID propagated through the platform SDK and into
BFF calls. The manifest version the user had is attached too, so you can reproduce the exact composition locally with
mfe dev --manifest <id>.
How do you stop the shell from becoming a new monolith? Strict charter (no domain features), a size budget, and an architecture review for anything added to the SDK.
Spotted a mistake or a rights concern? Report an issue