What’s With Micro Frontends

This ad is not shown to multipass and full ticket holders
React Advanced
React Advanced 2026
October 23 - 26, 2026
London, UK & Online
Upcoming event
React Advanced 2026
React Advanced 2026
October 23 - 26, 2026. London, UK & Online
Bookmark
Rate this content
Sentry
Promoted
Code breaks, fix it faster

Crashes, slowdowns, regressions in prod. Seer by Sentry unifies traces, replays, errors, profiles to find root causes fast.

Get started

Reusing front-end features built by different teams can be challenging depending on the chosen approach. If we use a library, what about versioning and maintenance? If we use a monolith, what about build times? We can find a pragmatic solution in Module Federation, not only for sharing features but also for dividing and conquering. Join me in this talk to discuss the latest updates of Module Federation, type safety, analyze its challenges, and check a real-world case where we applied this solution to share providers, hooks, features, and interesting issues we faced on the way.

This talk has been presented at JSNation US 2024, check out the latest edition of this JavaScript Conference.

FAQ

A micro-frontend is an architecture that breaks down a large frontend into smaller, independently deployable pieces, allowing for improved scalability, team autonomy, and code maintenance.

Micro-frontends are gaining popularity because they enable independent deployment of frontend modules, improving scalability, team autonomy, and code maintenance.

Module federation allows for the dynamic real-time updates of modules in a micro-frontend architecture, enabling them to be loaded independently during run time.

Micro-frontends can be implemented through build time, where modules are compiled together, and run time, where modules are loaded independently.

Module federation enhances micro-frontend implementation by allowing modules like functions and components to be exposed and loaded at run time, facilitating independent deployment.

The strangle pattern involves building new application features from an existing app that is slated for deprecation, allowing for independent development and future app swapping.

Type safety can be maintained by using module federation 2.0, which allows for automatic extraction of types from federated models, making them part of the exposed manifest assets.

Full site federation allows developers to view and test the entire application as a whole by exporting the host and creating a circular dependency, rather than only working on isolated modules.

Teams should consider using micro-frontends if they face challenges with scalability and independent deployments, as these benefits are central to the micro-frontend approach.

Challenges in implementing micro-frontends include maintaining performance, styling, stage management, testing runtime consumption, and ensuring decoupled testing responsibilities.

Nataly Rocha
Nataly Rocha
7 min
18 Nov, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Micro-frontends break down a large frontend into smaller, independently deployable pieces. This approach improves scalability, team autonomy, and code maintenance. Two primary ways to implement micro-frontends are build time and run time. Module federation, introduced in Webpack 5, allows for dynamic real-time updates across teams. Challenges in implementing micro-frontends include getting type safety with TypeScript and testing at runtime. Module federation 2.0 introduced type extraction and manifest updates. Full site federation allows testing the whole app. Micro frontends involve trade-offs, so choose what benefits you the most.
Available in Español: ¿Qué pasa con Micro Frontends

1. Micro-frontends and Module Federation

Short description:

Micro-frontends break down a large frontend into smaller, independently deployable pieces. This approach improves scalability, team autonomy, and code maintenance. Two primary ways to implement micro-frontends are build time and run time. Module federation, introduced in Webpack 5, allows for dynamic real-time updates across teams.

♪♪♪ Hello, everyone. Welcome to this lightning talk. First of all, thank you JS Nation for this space. It's really great to be here. My name is Natalia Rocha. I'm from Ecuador, a small, beautiful country where politics has more bugs than legacy code. I work at Stack Builders as a software developer, and I also play the guitar.

But let's get into the topic, micro-frontends. So I have the feeling that this topic, when it is mentioned, it creates a lot of buzz and discussion. So let's talk a little bit about it and what role module federation plays in their implementation.

So simply put, micro-frontend is an architecture that breaks down a large frontend like this one into smaller pieces that are independently deployable. Here's the key, independently deployable. It's probably the core idea of micro-frontends. But why the buzz? Because this approach is gaining a lot of traction because it can improve scalability, team autonomy, and code maintenance. So instead of waiting for one team to finish the feature to be able to deploy the entire app, each model is isolated, flexible, and it can be rolled out independently.

So we have two primary ways to implement micro-frontends, build time and run time. Build time, where models are compiled together at build time, libraries for example, and run time, where models are loaded independently during run time. Module federation is an example of this implementation, which is great for dynamic real-time updates across teams.

So are micro-frontends new? Let's see. Has anyone used iframes before? Yeah? Has anyone used libraries before? Yeah? So maybe you have implemented a micro-frontend architecture. But when would you call a library or an iframe a micro-frontend? Because on a daily basis, we all use libraries to add functionalities, utilities, even entire frameworks to our applications. So I like to think that the architecture or mental model that you define for your project and the use case of how you intend to separate the application into a library or an iframe or a federated model is what makes it a micro-frontend. For example, on a movie theater application, teams separately develop a seat beaker and user profile models. So this gives them the possibility to work independently, having the chance to move faster, for better or worse. Right?

Now let's jump a little bit into implementation. Module federation is one way to implement this architecture. So it allows you to expose modules like functions, components, hooks, and use them as remotes that will be loaded on run time. It was introduced on Webpack 5. Zach Jackson, the creator, should be around here. And the 2.0 version was released this year.

2. Challenges, Testing, and Wrap-up

Short description:

We had a use case called the strangle pattern, where we built a new application using features from another app. Challenges included getting type safety with TypeScript and testing at runtime. Module federation 2.0 introduced type extraction and manifest updates. Full site federation allows testing the whole app. Micro frontends involve trade-offs, so choose what benefits you the most.

A real use case that we had, which I would like to call the strangle pattern, allowed us to build a new application user features from another app that was slated for deprecation. So this helped us to move independently while retaining the option to swap apps in the future. And that is the use case where we found it really valuable.

But we did face several challenges. We used TypeScript. So as models are loaded on run time from a manifest, how do we get type safety on development? Well, we removed the TypeScript. No, just kidding. We extracted the types. And also module federation 2.0 introduced the possibility to extract the types from the federated models. It does it automatically. And now they can be part of the assets that are exposed on the manifest. So when you declare a model as remote, the plug-in automatically downloads the types and you can use them as a fallback path and you will have all the TypeScript benefits on your project.

Also tests. How do you test something that is consuming at run time? It can become challenging. So, the same. We deleted the tests. There are several approaches that we can use for this. And, for example, the testing responsibilities should be kept for each micro front-end, avoiding overlap, and also keeping them as decoupled as possible to make your life easier. Also having A-B testing, which is something kind of that we did. For example, having a module that has only the basic stuff that is needed to test cross-functionality and have another one that is full feature for Prov. The developer tools that module federation 2.0 included and also the manifest updates help a lot here because you can load different manifests immediately to change and try several approaches with no time.

Also there is this concept of full site federation where you can actually see the application as a whole. For example, when you were developing only the seed picker, it is uncomfortable to only see that experience. So what you do is export the host as well and create a circular dependency so you are able to see the whole application. So you can test the functionality of the whole app. We also face more challenges. For example, performance, styling, stage management, and others. So I'm going to be doing a full talk about this on the remote date. I'd invite you to join if you can.

But for today, to wrap up, I would like to leave you with this message. Should you jump into micro frontends immediately? If the challenges of scalability and independent deployments resonate to you, I think it is worth exploring. And it is also pretty useful to find the use case or the solution that you need in all these different approaches that micro frontends give you. Also, while finding the micro frontend approach to use, you will find that everything is a trade-off. And you will have to choose the one that benefits you the most. This is a phrase that came up a lot in our team discussions. And by the way, I would like to give a huge shout out to my team, the range vendors. I can't thank them enough for all their shared knowledge and professionalism. And that's pretty much it. I hope that you keep enjoying the conference, and see you around.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Monolith to Micro-Frontends
React Advanced 2022React Advanced 2022
22 min
Monolith to Micro-Frontends
Top Content
Microfrontends are considered as a solution to the problems of exponential growth, code duplication, and unclear ownership in older applications. Transitioning from a monolith to microfrontends involves decoupling the system and exploring options like a modular monolith. Microfrontends enable independent deployments and runtime composition, but there is a discussion about the alternative of keeping an integrated application composed at runtime. Choosing a composition model and a router are crucial decisions in the technical plan. The Strangler pattern and the reverse Strangler pattern are used to gradually replace parts of the monolith with the new application.
Micro-Frontends With React & Vite Module Federation
React Advanced 2023React Advanced 2023
20 min
Micro-Frontends With React & Vite Module Federation
Top Content
Microfrontends is an architecture used by big companies to split monolithic frontend applications into manageable parts. Maintaining a consistent look and feel across different microfrontends is a challenge. Sharing styles can be done through Vanilla CSS, CSS modules, or CSS in JS. JavaScript variables can be used in styles, but readability and runtime overhead are considerations. Sharing state in microfrontends can be achieved through custom events, broadcast channels, shared state managers, or custom PubSub implementations. Module federation with Vite allows for client composition and sharing dependencies. Configuration is similar to Webpack, and future work includes working on the QUIC framework.
“Microfrontends” for Mobile in React Native
React Advanced 2023React Advanced 2023
24 min
“Microfrontends” for Mobile in React Native
Top Content
Micro frontends are an architectural style where independent deliverable frontend applications compose a greater application. They allow for independent development and deployment, breaking down teams into feature verticals. React Native's architecture enables updating the JavaScript layer without going through the app store. Code Push can be used to deploy separate JavaScript bundles for each micro frontend. However, there are challenges with managing native code and dependencies in a micro frontend ecosystem for mobile apps.
Federated Microfrontends at Scale
React Summit 2023React Summit 2023
31 min
Federated Microfrontends at Scale
Top Content
This Talk discusses the transition from a PHP monolith to a federated micro-frontend setup at Personio. They implemented orchestration and federation using Next.js as a module host and router. The use of federated modules and the integration library allowed for a single runtime while building and deploying independently. The Talk also highlights the importance of early adopters and the challenges of building an internal open source system.
Sharing is Caring: (How) Should Micro Frontends Share State?
React Summit 2022React Summit 2022
23 min
Sharing is Caring: (How) Should Micro Frontends Share State?
Top Content
Micro-frontends allow development teams to work autonomously and with less friction and limitations. Organizing teams around business concerns, in alignment with subdomains, rather than technical concerns, can lead to software that is split nicely and user stories falling under the responsibility of a single team. Having a logical backup or reference point is important for implementing microfrontends without breaking their isolation. Microfrontends can communicate with each other using the window object and custom events. Microfrontends should be kept isolated while maintaining communication through various approaches.

Workshops on related topic

Micro Frontends with Module Federation and React
JSNation Live 2021JSNation Live 2021
113 min
Micro Frontends with Module Federation and React
Top Content
Workshop
Alex Lobera
Alex Lobera
Did you ever work in a monolithic Next.js app? I did and scaling a large React app so that many teams can work simultaneously is not easy. With micro frontends you can break up a frontend monolith into smaller pieces so that each team can build and deploy independently. In this workshop you'll learn how to build large React apps that scale using micro frontends.
Micro-Frontends with Module Federation and Angular
JSNation Live 2021JSNation Live 2021
113 min
Micro-Frontends with Module Federation and Angular
Workshop
Manfred Steyer
Manfred Steyer
Ever more companies are choosing Micro-Frontends. However, they are anything but easy to implement. Fortunately, Module Federation introduced with webpack 5 has initiated a crucial change of direction.
In this interactive workshop, you will learn from Manfred Steyer -- Angular GDE and Trusted Collaborator in the Angular team -- how to plan and implement Micro-Frontend architectures with Angular and the brand new webpack Module Federation. We talk about sharing libraries and advanced concepts like dealing with version mismatches, dynamic Module Federation, and integration into monorepos.
After the individual exercises, you will have a case study you can use as a template for your projects. This workshop helps you evaluate the individual options for your projects.
Prerequisites:You should have some experience with Angular.