Frontend School
DashboardProblemsLearnPracticeMock InterviewReportsStatsBuy Credits
DashboardProblemsLearnPracticeMock Interview
Frontend System Design Roadmap
  1. 1.HTTP/1.1 vs HTTP/2 vs HTTP/3 (QUIC)
  2. 2.TCP and TLS Handshakes: Connection Setup Costs
  3. 3.Browser Network Stack and Connection Pooling
  4. 4.GET vs POST and Idempotency in HTTP
  5. 5.The Critical Rendering Path (CRP)
  6. 6.DOM, CSSOM and the Render Tree
  7. 7.Layout, Paint and Compositing
  8. 8.Reflows and Repaints Explained
  9. 9.Event Loop: Call Stack, Task and Microtask Queues
  10. 10.Async JavaScript: Promises and async/await
  11. 11.Web Workers: Multi-threading in the Browser
  12. 12.Browser Storage: Cookies, Web Storage, IndexedDB
  13. 13.Client-Side Storage: Limits and Security Risks
  14. 14.Choosing the Right Client-Side Storage
  15. 15.HTTP Caching: Cache-Control, ETag, Last-Modified
  16. 16.Browser-Level Caching Mechanisms
  17. 17.Cache Invalidation for Frontend Apps
  18. 18.Structuring a Large Single-Page App
  19. 19.Component-Based Architecture Principles
  20. 20.Props, State and Component Lifecycle
  21. 21.Module Bundling Basics
  22. 22.Core Web Vitals: LCP, INP and CLS
  23. 23.FCP and Time to Interactive (TTI) Explained
  24. 24.Measuring Performance: Lighthouse and WebPageTest
  25. 25.Asset Compression and Minification Basics
  26. 26.What Is a CDN and How Does It Work?
  27. 27.CDN Benefits: Latency, Availability, Offload
  28. 28.CDN Cache Behavior and Invalidation
  29. 29.Global State vs Local Component State
  30. 30.State Patterns: Redux, Zustand and Context
  31. 31.Data Fetching: React Query and SWR
  32. 32.Immutable Data in Frontend State
  33. 33.SSR vs CSR: Rendering Trade-offs
  34. 34.Hydration and Time to First Byte (TTFB)
  35. 35.Static Site Generation (SSG) for Speed and SEO
  36. 36.Incremental Static Regeneration (ISR)
  37. 37.Micro-Frontends: Core Principles
  38. 38.Micro-Frontend Integration Strategies
  39. 39.Communication Between Micro-Frontends
  40. 40.Micro-Frontends: Pros and Cons for Large Teams
  41. 41.Real-Time: Polling, SSE and WebSockets
  42. 42.Real-Time Use Cases: Chat, Alerts, Live Data
  43. 43.Designing a Real-Time Data Flow
  44. 44.Scaling WebSocket Connections
  45. 45.Responsive Images: srcset, sizes and picture
  46. 46.Modern Image Formats: WebP, AVIF, JPEG XL
  47. 47.Lazy Loading Images and Videos
  48. 48.Video Streaming: HLS, DASH, Adaptive Bitrate
  49. 49.REST and GraphQL for Frontend Engineers
  50. 50.Batching, Throttling and Debouncing API Calls
  51. 51.Handling API Errors in the Frontend
  52. 52.Authentication Flows: OAuth and JWT
  53. 53.Global Error Boundaries in React
  54. 54.Error Reporting: Sentry and LogRocket
  55. 55.Graceful Degradation and Fallback UIs
  56. 56.Real User Monitoring (RUM)
  57. 57.CORS: Cross-Origin Resource Sharing
  58. 58.Preventing XSS (Cross-Site Scripting)
  59. 59.CSRF Protection for Frontend Apps
  60. 60.Content Security Policy (CSP)
  61. 61.Storing Auth Tokens: Cookies vs localStorage
  62. 62.PWA Manifest and Installability
  63. 63.Service Workers: Lifecycle and Caching Strategies
  64. 64.Offline Support and Background Sync
  65. 65.Push Notifications for Web Apps
  66. 66.Webpack vs Vite vs Parcel
  67. 67.Code Splitting, Tree Shaking, Asset Optimization
  68. 68.Module Resolution and Hot Module Replacement
  69. 69.Monorepo Tooling: Nx and Lerna
  70. 70.Atomic Design for Component Libraries
  71. 71.Theming and Customization in Design Systems
  72. 72.Accessibility in Component Libraries
  73. 73.Component Library Docs, Testing and Versioning
  74. 74.Publishing and Consuming a Component Library
  75. 75.Full-Text Search: Levenshtein and Fuzzy Matching
  76. 76.Indexing Large Datasets in the Browser
  77. 77.Search Performance: Debouncing and Web Workers
  78. 78.Integrating Backend Search Services
  79. 79.Choosing a Chart Library: D3, Chart.js, Recharts
  80. 80.Rendering Large Datasets: Canvas vs SVG
  81. 81.Interactive, Responsive Data Visualizations
  82. 82.Data Fetching and Aggregation for Dashboards
  83. 83.A/B Test Design and Rollout Strategies
  84. 84.Client-Side vs Server-Side A/B Testing
  85. 85.Feature Flags and Remote Configuration
  86. 86.Experiment Data Collection and Analytics
Frontend System Design Roadmap
38

Frontend System Design · Lesson 38 of 86 · 4 min

Micro-Frontend Integration Strategies

Your answer here shows if you can balance team autonomy with user experience, a core trade-off in system design.

After you've decided to break up your monolith, you have to put the pieces back together. The integration strategy is the most critical decision in a micro-frontend architecture. It dictates performance, development experience, and how isolated your teams can truly be. In an interview, you need to articulate the trade-offs between the main three options: Module Federation, iframes, and Web Components.

The Core Decision: Isolation vs. Integration

Frame your choice along a single axis: strong isolation versus deep integration. Each strategy represents a point on this spectrum.

Iframes offer maximum isolation. The child application lives in its own world, with its own window object, styles, and framework. This is a hard boundary.

Module Federation offers maximum integration. It allows separate applications, built and deployed independently, to share code at runtime as if they were a single app. This is a soft boundary.

Web Components sit in the middle. They provide component-level encapsulation (Shadow DOM) but live within the host's document and share its global context.

Your job is to pick the right point on the spectrum for the problem at hand.

Module Federation: For a Single, Cohesive App

Module Federation is a Webpack feature that lets you dynamically load code from another, separately deployed application. The "host" app consumes code from a "remote" app.

Its killer feature is sharing dependencies. If the host and remote both use React 18, Module Federation ensures React is only downloaded and initialized once. This avoids the performance penalty of loading multiple frameworks and component libraries, making the final product feel like a single, optimized SPA.

Use it when you want the user experience of a monolith but the development experience of independent teams and deployments. It works best when all teams use a compatible tech stack (e.g., everyone is on React).

The trap: Recommending Module Federation without acknowledging its complexity. It introduces a distributed system at the build/runtime level. Version mismatches in shared dependencies can cause cryptic runtime errors. It's powerful, but it's not free.

Here is a minimal Webpack configuration. One application acts as a remote, exposing a component, while another acts as a host, consuming it.

// products-app (the "remote") webpack.config.js
const { ModuleFederationPlugin } = require('webpack').container;

module.exports = {
  //...
  plugins: [
    new ModuleFederationPlugin({
      name: 'products',
      filename: 'remoteEntry.js',
      exposes: {
        './ProductList': './src/ProductList',
      },
      shared: { react: { singleton: true }, 'react-dom': { singleton: true } },
    }),
  ],
};

// shell-app (the "host") webpack.config.js
const { ModuleFederationPlugin } = require('webpack').container;

module.exports = {
  //...
  plugins: [
    new ModuleFederationPlugin({
      name: 'shell',
      remotes: {
        products: 'products@http://localhost:8081/remoteEntry.js',
      },
      shared: { react: { singleton: true }, 'react-dom': { singleton: true } },
    }),
  ],
};

The host can then import the remote component dynamically, often using React.lazy.

// shell-app/src/App.jsx
import React, { Suspense } from 'react';

const ProductList = React.lazy(() => import('products/ProductList'));

function App() {
  return (
    <div>
      <h1>My Application Shell</h1>
      <Suspense fallback={<div>Loading...</div>}>
        <ProductList />
      </Suspense>
    </div>
  );
}

This diagram shows the core relationship: the host consumes an exposed module from the remote, and both rely on a single, shared instance of their dependencies.

iframes: For Hard Boundaries and Legacy Code

The <iframe> is the oldest and simplest way to compose applications. It embeds a completely separate web page into your own. This creates the strongest possible isolation. The iframe's content cannot affect the parent's CSS or JavaScript, and vice-versa.

This makes iframes the perfect tool for two specific scenarios:

  1. Integrating legacy systems: You can wrap an old Angular.js or jQuery page in an iframe and drop it into a modern React shell without a full rewrite.
  2. Embedding untrusted third-party content: This is how services like Stripe, Google Maps, or embedded social media posts work. The isolation is a critical security feature.

The downsides are significant. Iframes are heavy, can create ugly UX seams (like double scrollbars), and make cross-frame communication cumbersome, relying on postMessage. State management and routing across frames are complex.

Interview angle: When you suggest iframes, immediately mention the security model. You must validate the event.origin in your message listener and specify a targetOrigin when calling postMessage. Saying postMessage(data, '*') in an interview is a red flag.

Web Components: For Universal Building Blocks

Web Components are a set of browser standards for creating framework-agnostic, reusable UI components. Using Custom Elements and the Shadow DOM, you can build something like <my-button> that works in React, Vue, Angular, or plain HTML.

This is not a strategy for integrating entire applications. It's a strategy for creating a shared library of primitive UI elements.

The most powerful use case is for a design system. You can build your company's official button, dropdown, and card components as Web Components. This guarantees visual and functional consistency across projects, even if one team uses Vue and another uses Svelte.

Web Components offer a middle ground on isolation. The Shadow DOM encapsulates the component's styles and markup, preventing global CSS from leaking in. However, the component still lives in the main document and shares the global window object, making integration easier than with an iframe.

Try it

In 15 minutes, sketch out a decision tree for an e-commerce site. The inputs are: the "product recommendations" widget, the "user reviews" section, and the "payment processing" form. The outputs are your chosen integration strategy for each (Module Federation, iframe, or Web Component) with a one-sentence justification.

Next: Now that you know how to assemble micro-frontends, we'll cover how they talk to each other in "Communication Between Micro-Frontends".

Lock it in — apply this lesson under interview conditions.

Try a free mock interviewPractice system design problems
Previous

Micro-Frontends: Core Principles

Next

Communication Between Micro-Frontends