Skip to main content

What does the "Micro-frontend" approach do with React?

What Micro-frontend is

Micro-frontend is an architectural approach in which a frontend application is split into many small, autonomous parts - each implementing its own feature, built and deployed independently, and in the browser these parts are "assembled" into a single whole.

Analogy:

Backend world: Microservices Frontend world: Micro-frontends


The main idea

An ordinary SPA becomes a "monolith" over time:

  • complex, hard to update;
  • multiple teams get in each other's way;
  • one deploy breaks everything.

Micro-frontend solves this by:

  • Each team owns its own fragment of the interface (feature / domain);
  • These fragments integrate into a shared shell (Shell / Container App);
  • Each fragment can be deployed independently.

Structure of a Micro-frontend system

javascript
┌──────────────────────────┐ Shell / Host │ ← the React container app │ ┌──────────────────────┐ │ │ │ Micro-app #1 │ │ ← independent React (or Vue, Svelte) │ ├──────────────────────┤ │ │ │ Micro-app #2 │ │ │ ├──────────────────────┤ │ │ │ Micro-app #3 │ │ │ └──────────────────────┘ │ └──────────────────────────┘

Each Micro-app can have:

  • its own React and dependencies,
  • a separate CI/CD pipeline,
  • its own repository,
  • an independent release cycle.

How this works in React

1. Host (the container app)

The main React app, which:

  • renders the "shell" (layout, navbar, router),
  • dynamically loads micro-frontends,
  • ties them together (navigation, shared context).

2. Remote (micro-apps)

Each micro-app exports its own components (for example, a page or a widget).

3. Module Federation (Webpack 5)

A technical mechanism that lets one application load modules from another right at runtime.


Example: structure with Webpack Module Federation

javascript
/shell-app webpack.config.js src/App.jsx /profile-app webpack.config.js src/Profile.jsx /dashboard-app webpack.config.js src/Dashboard.jsx

Shell (host)

javascript
// shell/webpack.config.js new ModuleFederationPlugin({ name: 'shell', remotes: { profile: 'profileApp@http://localhost:3001/remoteEntry.js', dashboard: 'dashboardApp@http://localhost:3002/remoteEntry.js', }, });
javascript
// shell/src/App.jsx import Profile from "profile/Profile"; import Dashboard from "dashboard/Dashboard"; export default function App() { return ( <div> <h1>Main shell</h1> <Profile /> <Dashboard /> </div> ); }

Now Profile and Dashboard are separate React applications, loaded by URL but running within one UI.


Advantages of the micro-frontend architecture

AdvantageDescription
Independent developmentTeams can work and ship autonomously
Different technologiesReact, Vue, and Svelte can be used in different zones
Independent deploymentUpdating one micro-frontend does not require releasing the whole system
Faster CI/CDSmall builds, separate pipelines
IsolationA bug in one module does not break the whole UI
Simplified scalabilityTeams can own their domains (auth, billing, dashboard, and so on)

Disadvantages and complexities

ProblemWhat needs to be considered
IntegrationShared styles, design system, routing, event buses
Shared stateSharing Redux/Zustand between micro-frontends is hard
Bundle sizeDuplicated dependencies (React, libs) without optimization
Deployment orchestrationYou need to manage module versions and compatibility
Security and isolationControlling access, sandboxing, CORS
PerformanceMany separate loads mean more requests

Ways to integrate micro-frontends

ApproachHow it worksExample
Module Federation (Webpack 5)Dynamic loading of JS modules on the clientshell + remoteEntry.js
Single-SPAA meta-framework for registering sub-applicationsregisterApplication()
iframe-basedEach micro-frontend in an iframe (simple isolation, but weak integration)<iframe src="...">
Runtime Composition (Import Maps)Using native ES module importsimportmap.json
Server-Side CompositionThe server "stitches together" HTML fragmentsEdge-composition, Tailor.js

Examples in real projects

CompanyWhere it is usedFeatures
NetflixThe home page, "Rows", and "Player" are separate micro-frontendsFast independent releases
SpotifyThe Library, Search, and Player sectionsDifferent teams, a shared shell
AmazonProduct, Cart, ReviewsSeparate JS bundles for each domain
GitHubPages and Settings are independent micro-frontendsTeams can transition without a monolith

Summary

WhatDescription
IdeaSplit the frontend into independent, autonomous modules
StructureShell (Host) + Remotes (Micro-apps)
IntegrationThrough Module Federation / Single-SPA / iframes
GoalScalability, independence, team flexibility
ProsIsolation, fast releases, mixed technology
ConsShared state, routing, versions, integration

Main idea: Micro-frontend is a way to build a React ecosystem as a set of independent microservices, where each piece of UI is a separate application with its own life, but to the user it looks like one whole.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.