smaple.tr
Backend & APIs

Micro Frontend Architecture: When It Pays Off and How to Build It

Mehmet Kurtipek
November 24, 2025
17 min read
Backend & APIs
Micro frontends
Module Federation
Frontend architecture
React

Micro frontend architecture splits a web application's interface into parts that separate teams build, test and deploy on their own, then joins them so users still see one product. A typical setup has a thin shell application that owns the layout, sign-in and top-level routes, plus one micro frontend per business area (search, checkout, account) that the shell loads by URL or at runtime. It pays off when several teams keep holding up each other's releases on the same frontend. For a single team it mostly adds build configuration, version drift and slower pages.

The parts of a micro frontend architecture

Cam Jackson's 2019 article on martinfowler.com describes micro frontends as frontend applications that can each be delivered independently and are composed into one larger application. In practice that comes down to four parts.

The shell, also called the host or container, renders the frame every page shares, owns the first segment of each URL, holds the user's session and decides which micro frontend to show. Keep it thin. Every feature that lands in the shell becomes something all the teams have to wait for.

Each micro frontend covers one business area from end to end and belongs to one team, with its own repository or folder, its own pipeline and its own release schedule.

Between them sit contracts: what each micro frontend exposes (a component, a mount function, a set of routes), the events it sends and listens for, and the shared libraries it expects the shell to provide. Treat these like a public API, with versions and a deprecation period.

A few things are shared on purpose: the design system, the auth client, logging and error reporting. Almost everything else should stay inside its team's boundary.

Split by business area. A "header team" and a "sidebar team" end up coordinating nearly every change, while a checkout team that owns everything from the cart page to the order confirmation can ship most features without asking anyone.

When micro frontends are worth it

Micro frontends solve a coordination problem between teams. Look for these signs before you take on the cost:

  • Three or more teams commit to the same frontend, and finished work waits because another team's change in the same release isn't ready.
  • The product has areas with clear owners and few shared screens: search, checkout and account in a shop, or the public website and the logged-in app.
  • You are replacing a frontend framework, and the old and new code must run side by side for months.
  • Some areas need to ship several times a day while others move on a slower, reviewed cycle.

And these are signs you shouldn't:

  • There is one team, even a large one. It pays all the costs and gets none of the independence.
  • You can't draw the boundaries yet. In a young product, areas shift every few months, and a wrong split is expensive to undo.
  • The real complaint is slow builds or a tangled codebase. A modular monolith (one application with enforced module boundaries, usually in a monorepo with incremental builds) fixes that for much less.
  • The pages are public and performance-sensitive, and nobody would own the loading strategy across teams.

Five ways to compose micro frontends

Approach

How the pieces meet

Independent releases

First load and SEO

Good fit

Build-time packages

npm packages installed into one app

No, the app is rebuilt for every change

Same as one app

Sharing a component library

Route-level split

A proxy or CDN sends each path to a separate app

Yes

Good, each app is a normal site

Sections users rarely cross, such as the public site and the logged-in app

Server-side composition

A server or CDN stitches HTML fragments into one page

Yes

Good

Content pages with regions owned by different teams

Client-side runtime

The shell loads each part's JavaScript in the browser

Yes

Slower unless tuned; content needs JavaScript

Logged-in apps where several teams share one page

Iframes

Each part runs in its own frame

Yes

Poor

Embedding a legacy or third-party screen

Build-time integration means publishing each part as an npm package and installing them all in one app. It's a sensible way to share a component library, but Jackson's article argues against it for micro frontends: any change means rebuilding and releasing the container, so teams are back to releasing in lockstep.

A route-level split is the simplest real micro frontend architecture, and the one to try first. Each section of the site is a separate application, and a reverse proxy or CDN rule sends each path to the right one. Next.js documents this as Multi-Zones: several apps on one domain, each serving its own set of paths and free to use a different framework. Moving from one zone to another is a full page load, so the docs tell you to link across zones with a plain <a> tag instead of <Link>, and to keep pages users visit together in the same zone.

Server-side composition keeps one page but builds it from fragments. Each team's service returns a piece of HTML, and a composition layer (your own server, or a CDN that supports Edge Side Includes) stitches the pieces together before the response goes out. It suits content-heavy pages where search engines must see the full HTML. The price is that every team needs server rendering, and you have to decide what the page does when one fragment is slow or failing.

Client-side runtime composition is what most people mean by micro frontend architecture: the shell downloads each micro frontend's JavaScript in the browser and mounts it. It is the only option that lets several teams ship UI onto the same page independently. It also has the most moving parts, which is why most of the rest of this post is about it.

Iframes give the strongest isolation and are awkward at almost everything else: deep links, resizing, focus and accessibility, consistent styling. They are a fair way to embed an old admin screen during a migration.

Choosing a micro frontend tool in 2026

  • Module Federation 2.0, for React or Vue apps built with webpack, Rspack or Vite. Webpack has shipped Module Federation since version 5. The 2.0 packages from the module-federation project (@module-federation/enhanced for webpack and Rspack, @module-federation/vite for Vite) add a manifest file per remote, a runtime API for registering remotes after the page loads, type hints across remotes and a Chrome DevTools extension. Unless you're on Angular or Next.js, start here.
  • Native Federation, for Angular. It applies the same host-and-remote model on top of ES modules and import maps, and plugs into the Angular CLI's esbuild-based builder. Its package, @angular-architects/native-federation, follows Angular's version numbers.
  • single-spa, when several frameworks must mount on the same page for a long time, as in a gradual move off AngularJS. Its bootstrap, mount and unmount lifecycle is well understood, and there are adapters for the major frameworks. Development has slowed, though: the latest stable release, 6.0.3, came out in September 2024, and the last 7.0 beta is from September 2025. Module Federation's Bridge packages now also cover mounting a React app inside a Vue one and the reverse.
  • For Next.js, use Multi-Zones. The Module Federation team's own Next.js plugin, @module-federation/nextjs-mf, is in maintenance mode: its maintainers announced in November 2024 that the App Router is not supported and that the plugin should keep working only until mid to late 2026, which is now. In March 2026 its lead maintainer added in the same thread that upgrading to Next.js 16 had broken the webpack plugin again.
  • Web Components, as a framework-neutral mount point. Each team ships a custom element and the shell renders the tag. React 19 sets props on a custom element as properties when the element defines them, which removed most of the old friction. You still need something to load the code, and Shadow DOM isolation makes shared theming harder.

A Module Federation setup you can roll back

Three settings cause most of the trouble: how shared libraries are configured, where the shell finds its remotes, and how remote builds are deployed.

Share React as a single copy

// catalog/webpack.config.js (owned by the catalog team)
const { ModuleFederationPlugin } = require('@module-federation/enhanced/webpack');

const version = process.env.RELEASE_VERSION; // e.g. 1.14.2, set by CI
if (!version) throw new Error('RELEASE_VERSION is not set');

module.exports = {
  output: {
    // every release gets its own folder; nothing is overwritten
    publicPath: `https://cdn.example.com/catalog/${version}/`,
  },
  plugins: [
    new ModuleFederationPlugin({
      name: 'catalog',
      filename: 'remoteEntry.js',
      manifest: true, // also writes mf-manifest.json
      exposes: {
        './ProductList': './src/ProductList.tsx',
      },
      shared: {
        react: { singleton: true },
        'react/': { singleton: true }, // react/jsx-runtime
        'react-dom': { singleton: true },
        'react-dom/': { singleton: true }, // react-dom/client
      },
    }),
  ],
};

With singleton: true, only one copy of React loads. If the shell and a remote were built with different versions, Module Federation loads the higher one and prints a console warning for the side with the lower version. Nothing fails at build time, so a remote built against an older React quietly runs on the shell's newer one. Within one major version that is usually fine. Across major versions, whatever the remote relies on that changed in the new release breaks at runtime, and the first place you see it is production.

The trailing-slash keys matter too. A key of 'react' matches only imports of react itself, and imports of a subpath are bundled into the remote instead of being shared. Every component compiled with the modern JSX transform imports react/jsx-runtime, and a remote that mounts itself imports react-dom/client. Without the 'react/' and 'react-dom/' entries, each remote carries its own copy of those files, and for react-dom/client that means a second React DOM on the page.

@module-federation/enhanced also loads files from inside webpack, so lock both versions and upgrade them together. When this post was last checked, in October 2026, webpack 5.112.0 had moved one of those files, and builds with @module-federation/enhanced 2.9.2 stopped with Cannot find module 'webpack/lib/util/extractUrlAndGlobal'. Webpack 5.111.1 built fine.

Let the shell read its remotes at runtime

If remote URLs are written into the shell's build config, pointing at a different remote version means rebuilding and redeploying the shell, which is exactly the coupling you were trying to remove. Have the shell read a small JSON file at startup and register its remotes from that. The shell keeps the same plugin, with name: 'shell', the same shared block and no remotes.

// shell/src/index.ts
import { registerRemotes } from '@module-federation/enhanced/runtime';

// remotes.json is deployed on its own, separately from the shell's bundle:
// { "catalog": "https://cdn.example.com/catalog/1.14.2/mf-manifest.json" }
async function start() {
  const res = await fetch('/remotes.json', { cache: 'no-store' });
  if (!res.ok) throw new Error(`remotes.json returned ${res.status}`);
  const remotes: Record<string, string> = await res.json();
  registerRemotes(Object.entries(remotes).map(([name, entry]) => ({ name, entry })));
  await import('./bootstrap'); // renders the React app
}

start().catch((err) => {
  console.error(err);
  document.getElementById('root')!.textContent = 'The app could not start. Please reload the page.';
});

Deploy every remote build to its own folder

Each team's pipeline uploads its build to a versioned path such as /catalog/1.14.2/ and never overwrites an earlier one. Releasing a remote becomes a one-line change to remotes.json. Rolling back means reverting that line, and nothing gets rebuilt. Serve the versioned files with a long cache lifetime and remotes.json with no-cache. One pipeline per micro frontend is straightforward in GitHub Actions, and the promotion step can be its own job with an approval.

Keep one broken remote from taking down the app

Module Federation's default shareStrategy, version-first, loads the entry file of every remote during startup so it can pick the highest version of each shared library. If one remote's server is down, startup can fail for every page, including pages that never use that remote. Unless you need strict version negotiation, set shareStrategy: 'loaded-first' in the shell's plugin config so each remote loads only when a page needs it. The trade-off is that a remote then gets whichever copy of React the shell has already loaded, even an older one, which makes the version check further down more important. Wrap every remote in an error boundary as well:

// shell/src/routes/CatalogRoute.tsx
import { lazy, Suspense, type ComponentType } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { loadRemote } from '@module-federation/enhanced/runtime';

const ProductList = lazy(async () => {
  const mod = await loadRemote<{ default: ComponentType }>('catalog/ProductList');
  if (!mod) throw new Error('catalog/ProductList did not load');
  return mod;
});

function CatalogUnavailable() {
  return (
    <p>
      The catalog didn't load.{' '}
      <button onClick={() => window.location.reload()}>Reload the page</button>
    </p>
  );
}

export function CatalogRoute() {
  return (
    <ErrorBoundary fallback={<CatalogUnavailable />}>
      <Suspense fallback={<p>Loading the catalog…</p>}>
        <ProductList />
      </Suspense>
    </ErrorBoundary>
  );
}

React.lazy remembers a failed load, so the component stays broken until the page reloads. That is why the fallback offers a reload instead of asking the user to wait.

Check shared versions before a release goes live

Because a version mismatch only produces a warning, catch it in CI. Each remote's mf-manifest.json lists the shared libraries it was built with and their versions, so the shell's pipeline can compare them before a new remotes.json goes live:

// shell/scripts/check-shared.mjs
// run in CI before promoting: node scripts/check-shared.mjs path/to/remotes.json
import { readFile } from 'node:fs/promises';

const major = (v) => v.split('.')[0];
const shellReact = JSON.parse(await readFile('node_modules/react/package.json', 'utf8')).version;
const remotes = JSON.parse(await readFile(process.argv[2], 'utf8'));

for (const [name, url] of Object.entries(remotes)) {
  const res = await fetch(url);
  if (!res.ok) {
    console.error(`${name}: ${url} returned ${res.status}`);
    process.exitCode = 1;
    continue;
  }
  const manifest = await res.json();
  const react = manifest.shared.find((s) => s.name === 'react');
  if (react && major(react.version) !== major(shellReact)) {
    console.error(`${name} was built with React ${react.version}, the shell has ${shellReact}`);
    process.exitCode = 1;
  }
}

Routing, shared state and CSS across teams

Let the shell own the first segment of the URL and each micro frontend everything below it: the shell maps /account/* to the account team, which defines its own routes inside. Share the router package as a singleton so the whole page uses one router, and never let a remote create its own browser router. Then test every deep link by opening it directly and reloading. A micro frontend that only works when you click into it from the home page will break for bookmarks and shared links.

Share as little state as you can. The shell can hand remotes a getAccessToken() function instead of putting a raw token on window. For cross-team notifications such as "an item was added to the cart", browser CustomEvents with namespaced names (such as cart:item-added) keep teams decoupled. An event fired before a micro frontend mounted is simply missed, though, so anything a micro frontend needs on first render should come from a getter the shell provides. Each micro frontend fetches its own data from the API.

For CSS, let the shell own the only global stylesheet (reset, fonts, base typography) and scope everything else with CSS Modules or a per-team class prefix. Colors, spacing and type scales belong in one versioned design tokens package that every team consumes. Pages stay consistent, and no team imports another team's styles.

Testing, local development and performance

Each team tests its micro frontend on its own, against a mocked shell. The contracts deserve tests as well. Module Federation 2.0 can generate TypeScript types for what a remote exposes, so a breaking change fails the shell's type check before it can leave a blank section in production. On top of that, keep a short list of end-to-end tests against the composed app in staging, including one that runs with a remote switched off.

Day to day, a developer runs only the micro frontend they are changing and loads everything else from staging. The Module Federation Chrome DevTools extension can point a single remote at a local build; single-spa projects use import-map-overrides for the same job.

Measure performance on the composed application. The numbers to watch are the total JavaScript downloaded on the first route, the number of remote entry requests during startup, and Largest Contentful Paint from real users. Our performance engineering post covers setting budgets and catching regressions in CI.

Using micro frontends to replace an old frontend

A migration is often the best reason to adopt micro frontends, even if only for a while. Put a reverse proxy in front of the old app, rebuild one section in the new stack, and route that section's paths to the new app. Both apps live on the same domain, so they can share the session cookie, and users see a full page load only when they cross between an old section and a new one. When the last section has moved, the proxy rule and the old app go away. Our post on legacy system modernization covers how to choose what to move first.

A proxy split only covers the screens. If the backend is being replaced in the same project, plan separate time for moving and checking the data. When we moved Oplist, a client whose hospital shift-scheduling software we build, from Flutter Web and Flask to React and Node.js, the hardest parts were time and data integrity.

Frequently asked questions

Are micro frontends the same as microservices?

They apply the same idea to the browser: small parts with clear owners that ship independently. They don't require microservices. A micro frontend can call a shared API, or its team can also own a backend for it, and many setups mix both.

Do micro frontends hurt SEO?

Route-level splits and server-side composition send complete HTML, so search engines see the pages as before. With client-side runtime composition, the content inside remotes appears only after JavaScript runs. Google does render JavaScript, but its own guide says a page can wait in the rendering queue for longer than a few seconds and that not all bots can run JavaScript. For public pages that need to rank, prefer one of the server-rendered options.

Does each micro frontend need its own repository?

No. What makes a micro frontend independent is its own build and its own deploy. A monorepo makes it easier to upgrade a shared library everywhere at once. Separate repositories draw team boundaries more firmly, but every shared upgrade becomes one pull request per repository. The Next.js Multi-Zones docs say the same about zones: they can live in any repository, and a monorepo is often the more convenient way to share code.

How many micro frontends should one team own?

Usually one, at most two. Each one brings its own pipeline, its own remote entry request and a contract to keep stable. A team that owns three pays that cost three times and gains no independence from it, because all three still move on the same team's schedule.

Where to start

Before you decide, list the releases from the last quarter that waited on another team's work. If the list is short, put the effort into module boundaries inside one app. If it is long, move one section into its own app with a route-level split, run it that way for a couple of months, and add runtime composition only when two teams really do need to ship onto the same page. If you'd like a second opinion on where the boundaries in your product should go, our web development team is happy to take a look.

Related Articles

August 1, 2026

Kong vs Traefik vs AWS API Gateway: How to Choose

Kong, Traefik and AWS API Gateway compared as of October 2026: features, licensing, Kubernetes support and what AWS charges for 100 million requests a month.

Read More: Kong vs Traefik vs AWS API Gateway: How to Choose
July 4, 2026

gRPC vs REST for Microservices: When gRPC Is Worth It

When gRPC beats REST between services, what it adds to your operations (load balancing, deadlines, browser access), and what our own protobuf vs JSON test showed.

Read More: gRPC vs REST for Microservices: When gRPC Is Worth It
March 14, 2026

RPA Implementation: From Process Choice to Bots That Keep Running

Most of an RPA implementation is choosing the process and designing for exceptions. The order we work in, current license prices, and what broke in the n8n and LLM automation we built with an agency.

Read More: RPA Implementation: From Process Choice to Bots That Keep Running