Skip to main content
XenonStack

Enterprise Digital Platform

XenonStack Insights Micro Frontend Architecture: Best Practices and Trade-offs

and | Published | Updated

Micro Frontend Architecture: Best Practices and Trade-offs
14:28
Micro frontend architecture: integration methods, principles and trade-offs, shown as a four-layer stack from vertical business slices to independent team releases

Key takeaway

  • Micro frontend architecture explained: integration methods, design principles, trade-offs and when to use it, with a step-by-step adoption path for teams.

Micro frontend architecture splits a large web front end into smaller applications that separate teams build, test and deploy on their own, then compose into one experience for the user. Cam Jackson's article on martinfowler.com defines it as "an architectural style where independently deliverable frontend applications are composed into a greater whole." The single-spa documentation puts it more briefly: "a microservice that exists within a browser."

It pays off when a front end has grown too large for one team and release cycle, and it costs you in payload size, shared-library discipline and operating effort when it is applied to a small application. This guide covers the integration methods, design principles, trade-offs and an adoption sequence. It builds on our guides to microservices architecture and design patterns and microservice vs monolithic architecture.

What is micro frontend architecture?

A typical single-page application starts small and grows until every team commits to one codebase and one release train. That is a frontend monolith. Micro frontends apply the microservice idea to the browser: each team owns a vertical slice of business functionality, from the user interface down to the services behind it, rather than a technical layer such as "the CSS team". According to Cam Jackson, the benefits are incremental upgrades (legacy code can be replaced piece by piece), simpler decoupled codebases, independent deployment and autonomous teams.

The single-spa documentation adds that each micro frontend has its own repository, build configuration and deployment process, and that lazy loading and a gradual migration path from a monolith are part of the appeal. For teams planning a wider legacy rework, our application modernization services page describes how this fits a modernization programme. The principles in scalable frontend project principles apply to each fragment.

1. Confirm need: Check for several teams blocked by one release train, or a legacy front end to retire.
2. Choose method: Choose the simplest integration method that meets your isolation needs.
3. Define shell: Define a thin shell that handles routing and composition.
4. Agree rules: Agree a design system, shared library versions, team prefixes and an event contract.
5. Peel off slice: Peel off one vertical slice with its own pipeline, then measure release frequency and payload.
6. Test: Test in production-like environments early, so integration issues surface before release.
Diagram: how a team adopts micro frontends step by step (flow view)

When should an enterprise use micro frontends, and when not?

Cam Jackson advises assessing "the technical and organisational maturity required to adopt such an approach without creating chaos". Use the table as a first filter.

SituationFitWhy
Several teams ship to one product and block each other's releasesStrongIndependent pipelines remove the shared release train.
Legacy front end being replaced graduallyStrongUpgrades can go one micro frontend at a time.
One small team, one product, simple UIWeakYou pay for composition, shared libraries and more pipelines with little gain.
Mostly static, document-like sitePartialServer-side composition of HTML fragments can be enough (micro-frontends.org).
No automation or platform support for many pipelinesWeakCam Jackson notes more repositories, pipelines and servers need strong automation and governance.

How do teams integrate micro frontends?

There is no single correct method. Cam Jackson's article on martinfowler.com describes five, and the table adds the trade-off to weigh for each.

Two-column diagram: left lists server-side composition, iframes, run-time JavaScript and web components; right lists the trade-off for each: static-leaning pages, routing and deep links, shared libraries, less control.
MethodHow it worksTrade-off
Server-side template compositionThe server assembles HTML from fragments (for example with server-side includes) before the page reaches the browser.Suits mostly static pages; interactive apps need client code as well.
Build-time integrationEach micro frontend is published as a package and the container bundles them.The article recommends against it because it forces a lockstep release process.
Run-time via iframesEach fragment is a separate document embedded in the page.Strong isolation of styles and globals, but routing, history, deep links and responsiveness get harder.
Run-time via JavaScriptEach fragment loads through a script tag and exposes an entry-point function that the container calls.The article makes this its default choice for control and flexibility.
Run-time via web componentsEach fragment defines a custom element that the container instantiates.Uses browser-native features; the JavaScript route gives more control over the interface.

What does Module Federation add?

According to the webpack Module Federation documentation, Module Federation lets separately built applications share modules at runtime so that they behave as one application. Each build is a container that exposes modules and can consume other builds as remotes. A "shared" configuration lets builds reuse one copy of a library: a consumer gets the highest version in the share scope that satisfies its required range, so builds that need different major versions can coexist. The documentation also warns that every host and remote needs a distinct output.uniqueName, and that loading a remote is asynchronous.

new ModuleFederationPlugin({
  name: "host",
  remotes: {
    app1: "app1@http://localhost:3001/remoteEntry.js",
  },
});

This configuration is the example given in the webpack documentation: the host application shell loads the remote "app1" from its remoteEntry.js at runtime.

What does single-spa add?

The single-spa documentation describes three types: applications, which render components for a set of routes; parcels, which render components without controlling routes; and utility modules, which export shared JavaScript logic without rendering. It recommends one framework in practice, with several frameworks mainly for migrations or experiments, and encourages sharing a single instance of large libraries such as React, Vue or Angular, because duplicate copies hurt performance.

What are the design principles for micro frontends?

micro-frontends.org sets out five principles. Each one maps to a decision your architects can write into a team charter.

PrincipleWhat it means in practice
Be technology agnosticTeams choose and upgrade their own stack without coordinating; custom elements give a neutral interface.
Isolate team codeDo not share a runtime, shared state or global variables, even when teams use the same framework.
Establish team prefixesNamespace CSS, events, local storage and cookies to avoid collisions and show ownership.
Favour native browser featuresUse browser events for communication rather than a global publish-subscribe system; keep any cross-team API simple.
Build a resilient siteFeatures should stay useful if JavaScript fails or has not run yet, using universal rendering and progressive enhancement.

How do web components fit micro frontends?

The MDN web components overview names three technologies: custom elements, shadow DOM and HTML templates. Custom elements let a team register its own tag with customElements.define(); the name must contain a hyphen. Shadow DOM attaches an encapsulated tree to an element so that styles and IDs do not collide with the rest of the document. For lifecycle behaviour, MDN documents connectedCallback, disconnectedCallback, adoptedCallback and attributeChangedCallback, the last of which fires only for attributes listed in static observedAttributes.

class CheckoutBasket extends HTMLElement {
  static observedAttributes = ["currency"];
  connectedCallback() { /* element added to the page: render and subscribe */ }
  disconnectedCallback() { /* element removed: clean up listeners */ }
  attributeChangedCallback(name, oldValue, newValue) { /* react to changes */ }
}
customElements.define("checkout-basket", CheckoutBasket);

The container then treats the fragment as an ordinary HTML tag, and communication between fragments goes through browser events, in line with the principle above. The lifecycle callbacks shown here follow the MDN documentation.

How should teams and codebases be split?

Split by vertical slices of business functionality, not by technical capability. Each team then owns one business domain end to end, which builds domain expertise and keeps releases independent. This is the same reasoning that applies to back-end services, so the same team often owns the micro frontend and its service. Where fragments need to talk to services or each other, see our guide to inter-process communication in microservices, and for delivery pipelines see CI/CD pipeline stages, tools and best practices. If your main concern is installable, offline-capable web apps, choosing a progressive web app framework is the better starting point.

 

Video: micro frontend architecture and best practices.

What are the governance, security and cost trade-offs?

Cam Jackson's article on martinfowler.com lists the costs directly. Treat them as a checklist before approving the programme.

Trade-offWhat happensControl
Payload sizeIndependent bundles can duplicate dependencies such as React and increase downloads.Share large libraries through Module Federation or single-spa, and agree versions.
Team fragmentationAutonomy can fragment how teams work and how the product looks.Shared design system and a style guide; shared component libraries hold UI logic only, not domain logic.
Coupling through communicationHeavy cross-fragment messaging reintroduces coupling.Keep communication minimal and use browser events.
Environment differencesStandalone development can hide production issues such as global style conflicts.Integrate regularly in production-like environments.
Operational complexityMore repositories, pipelines and servers to run.Automation, platform support and clear ownership per fragment.
Isolation vs convenienceIframes isolate best but complicate routing and deep links.Choose the integration method per fragment, not once for everything.

Where do AI agents fit in a micro frontend estate?

Micro frontends do not need agents, and most estates will not change shape because of them. Where a team does add an assistant or an agent-driven action to a fragment, the same boundaries apply: a named owner, a versioned contract to the service behind it, and logging of what the agent was allowed to do. AI-driven micro frontends covers where AI belongs and how to govern it, and agentic workflows covers the patterns behind agent-driven journeys. For governed delivery, ElixirClaw is an agentic OS platform to build, orchestrate and govern AI agents and automation workflows while keeping humans in control, and the Elixir Govern agent (formerly AgentGRC) keeps autonomous agent actions inside policy, with the audit trail risk teams need. ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents.

How do you adopt micro frontends step by step?

  1. Confirm the need. Several teams blocked by one release train, or a legacy front end to retire.

  2. Choose the integration method from the table above, starting with the simplest that meets your isolation needs.

  3. Define the shell that handles routing and composition, and keep it thin.

  4. Agree shared rules: design system, shared library versions, team prefixes and an event contract.

  5. Peel off one vertical slice with its own pipeline, then measure release frequency and payload before moving the next.

  6. Test in production-like environments early, so integration issues surface before release.

To map one frontend decision your agents should make, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.

Frequently asked questions

What is micro frontend architecture?

An architectural style where independently deliverable frontend applications are composed into a greater whole (Cam Jackson, martinfowler.com). The single-spa documentation calls a microfrontend a microservice that exists within a browser.

When should we use micro frontends?

When several teams share one large front end and block each other's releases, or when you are replacing a legacy front end gradually. For a small application with one team, the extra pipelines and shared-library discipline usually cost more than they return.

How are micro frontends integrated?

Through server-side composition, build-time packages, iframes, JavaScript entry points or web components. Cam Jackson recommends against build-time integration because of lockstep releases and makes run-time integration via JavaScript his default.

Do micro frontends hurt performance?

They can, because independent bundles may duplicate dependencies such as React. Module Federation's shared scope and the single-spa advice to share one instance of large libraries are the documented ways to limit this.

Can each team use a different framework?

Technically yes, and the principle is to be technology agnostic. The single-spa documentation says one framework is practical and suggested, with multiple frameworks mainly for migrations or experiments.

What are the main design principles?

Be technology agnostic, isolate team code, establish team prefixes, favour native browser features over custom APIs and build a resilient site (micro-frontends.org).

Next Steps for Implementing Micro Frontend

Talk to our experts about implementing Micro Frontend architecture. Learn how industries and teams can leverage modular development, achieve deployment independence, and enhance cross-team collaboration. Utilize technology independence and continuous integration (CI/CD) to optimize front-end development, improve scalability, and boost overall application performance.

 

Table of Contents

Navdeep Singh Gill

Navdeep Singh Gill

Founder and CEO, XenonStack

LinkedIn profile

Navdeep Singh Gill is the Founder and Global CEO of XenonStack. With more than 20 years in network and cloud transformation, he leads the company’s strategy and product development in private cloud and agentic AI, including the ElixirData, ElixirClaw and NexaStack platforms. He writes about enterprise AI, data platforms and the architecture decisions that help large organisations run AI safely at scale.

Get the latest articles in your inbox

Subscribe Now

Interested in solving your challenges with the XenonStack team?
Get Started

Tell us about you and your priorities so we can prepare the right conversation. It takes about 2 minutes.

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Continue