Is Module Federation Right for You?

Rate this content
Bookmark

Discover Micro Frontends with Module Federation. Learn about the benefits and pitfalls so you can decide whether Micro Frontends are a good fit for your organization.

FAQ

Micro-frontends are a design approach in which a front-end app is decomposed into individual, semi-independent 'microapps' working loosely together. They promote agile practices, allow for better scalability, and enable teams to deploy features independently, thus improving development speed and testing capabilities.

Module Federation is a feature from Webpack that allows a JavaScript application to dynamically load code from another application at runtime. This facilitates the development of micro-frontends by allowing different teams to build and deploy features independently which can then be combined seamlessly into a single product.

Module Federation allows for decoupling of deployments, enabling teams to update individual micro-frontends without redeploying the entire application. This results in faster updates, reduced risks, and the ability to rollback features independently if issues arise.

Best practices include organizing deployed code into version subfolders to manage different versions efficiently, using semantic versioning, and deploying each micro-frontend independently to a CDN for optimal performance and scalability.

While it's technically possible to use different JavaScript frameworks within micro-frontends, it is generally recommended to avoid this as it can complicate the architecture and lead to performance issues. Instead, ensuring a consistent technology stack across micro-frontends is advisable unless there's a compelling reason for diversity, such as gradual migration from one framework to another.

Organizations can handle versioning by deploying each micro-frontend as a separate entity with unique version numbers, and maintain a history of deployments. Rollbacks are facilitated by simply switching the version of the micro-frontend being served, without impacting other components of the application.

Effective strategies include using an event bus for decoupled communication, shared state management tools like Redux for state synchronization, or leveraging the browser's built-in capabilities such as LocalStorage or URLs for lighter communication needs.

Grgur Grisogono
Grgur Grisogono
191 min
04 Jul, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This workshop on micro-frontends covers topics like dependencies, communication between federated modules, team organizations, and code sharing. It emphasizes the benefits of module federation and micro-frontends in enabling continuous operation and collaboration. The workshop provides practical examples and discusses the challenges of managing breaking changes and handling conflicts. It also explores the use of React as a view rendering library and the importance of sharing data and controlling communication between feature apps.

1. Introduction to Micro-Frontends

Short description:

Thank you all for joining our workshop. We'll start with a primer on micro-frontends and their benefits. Then we'll work through examples and discuss potential system-level architectures. I've worked with Module Federation and Microfurence extensively, delivering them to numerous countries and millions of users. During this workshop, we'll cover topics like dependencies, communication between federated modules, modulation in hybrid apps, team organizations, and code sharing. We'll also have a Q&A session. My goal is for you to leave this workshop feeling knowledgeable and prepared to implement micro-frontends in your projects.

Thank you all for for joining our workshop today. We have about 2 1⁄2 hours to talk about module federation, but we really cannot talk about module federation without talking about micro-frontends. So we're going to do a little primer on what micro-frontends are and why they're helpful, why we are here. And then we're going to work through examples.

When we are done with the examples, if you're still on board with module federation, I'm going to also show you a few slides on potential architectures, the system-level architectures that you can choose. And I'm also going to show you some slides that I've learned to work well when presenting micro-frontends to bosses, businesses, clients, and so on. Things that they like to hear, because usually they don't speak the language of engineers, and I kind of want to share some of that. So you have it. The slideshow is going to be in in the github repository, and I'm going to share with you in just a minute.

But before we do, again, I'm going to take a second to introduce myself. My name is, well, Gregor is the easy way to pronounce it, the official way would be Gergoor, which I know is terrible, lots of rolling R's. But I've been working with Module Federation and Microfurence for a while, and I'm not the inventor of any of this. So if you know people like Zack Jackson, who I think he's the mastermind behind Microfurence and Toby Carver from Webpack, those guys are incredibly smart. I did spend a lot of time with those two in late 2020 when Madoff Federation was out, because we used that extensively with some, I'm not going to mention names, but some of the big companies out there, big in communications, in auto industry, in pharmaceuticals. You're going to see their logos at the end, but I'm not going to mention them. So I've been working with micro-finance for a long time and delivered them to about 200 countries, and I think lots of millions, users are already, have already accessed some of those stuff, some of those micro-finance that I help architect to create. And today, I only want to share that experience with you. I want to share, you know, we've been through a lot of amazing discoveries and difficult times, difficult problems to have. Because these are highly scalable systems. Scalable in terms of infrastructure, scalable in terms of scalable teams, multinational. So if you work with any of those, you know, this is hopefully going to be of use to you.

So during this workshop, we're going to be talking about, again, what microfrontends are and why your business or your client's business should care. We're going to create a very, very simple Module Federation app cluster. It's going to be super simple because this is an intra-level workshop. And there's going to be plenty of stuff to show, plenty of problems and solutions to show through that very small cluster. We're going to show how to deal with some of the most common issues like working with dependencies, how to deal with problems that you get when you work with dependencies, types of dependencies, and strategies for dealing with different types of dependencies. Then one of the most common questions is how we communicate between federated modules. And I think communication is where you make it or break it. I am going to briefly mention or briefly talk about modulation in hybrid apps. So it doesn't have to be web only. It can be hybrid. It can be completely universal whether it's web, PWA, desktop, or mobile. There are some very interesting implications there. Again, we're going to talk about team organizations, a team organization, working with your repositories, code shares. So we're going to blend a lot of that in. Finally, I'm going to set aside some time for questions and answers. One thing that I want you to get out of this is I want you to sound smart when you get back to your jobs, your peers, whoever you talk to, meetups. I want you to sound smart.

2. Sharing Experiences and Simplifying Concepts

Short description:

Interesting thing happened to me today, this morning, I was working with one of those car manufacturers, a team that I'm helping there. We had certain issues with service site rendering of federated modular federation. But that's only issues that happen with huge, huge sites. I created a PR and inside the PR I just added a few flags that I needed to add to this headless Chrome. I'm going to share a few things, hope you get them back to your job. I'm going to try not to use difficult words. So if you have experience, please try to listen. If you have no experience, if you're not technical, I hope that you're going to be able to digest what we're talking about.

Interesting thing happened to me today, this morning, I was working with one of those car manufacturers, a team that I'm helping there, they said, so we had certain issues with service site rendering of federated modular federation. But that's only issues that happen with huge, huge sites, when you have to run a service rendered tenths of thousands of pages at the same time. And I didn't know how to solve the problem. So I said, you know, I'm going to Google it up. I'm going to find it and I'm going to, you know, put it in. So I created a PR. And inside the PR I just added a few flags that I needed to add to this headless Chrome. And they said, oh, I don't know how we get to be so smart. How did you find all those flags? And I said, I'm going to Google it up. So I wasn't smart. I just Googled it up. So this is our time of sharing, you know, it's not googling, but I'm going to share a few things, hope you get them back to your job. Also, I'm going to try not to use difficult words. So you're not going to get smart in a way you're going to use like isomorphic apps, something like that kind of verbiage, I'm going to try to be simple. So if you have experience, like I know some of you have with model iteration, please try to listen. If you have no experience, if you're not technical, I hope that you're going to be able to, this is why I hope you're going to be able to digest what we're talking about.

QnA

Watch more workshops on topic

Micro Frontends with Module Federation and React
JSNation Live 2021JSNation Live 2021
113 min
Micro Frontends with Module Federation and React
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.

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
Do you have a large product built by many teams? Are you struggling to release often? Did your frontend turn into a massive unmaintainable monolith? If, like me, you’ve answered yes to any of those questions, this talk is for you! I’ll show you exactly how you can build a micro frontend architecture with Remix to solve those challenges.
Monolith to Micro-Frontends
React Advanced Conference 2022React Advanced Conference 2022
22 min
Monolith to Micro-Frontends
Top Content
Many companies worldwide are considering adopting Micro-Frontends to improve business agility and scale, however, there are many unknowns when it comes to what the migration path looks like in practice. In this talk, I will discuss the steps required to successfully migrate a monolithic React Application into a more modular decoupled frontend architecture.
Micro-Frontends With React & Vite Module Federation
React Advanced Conference 2023React Advanced Conference 2023
20 min
Micro-Frontends With React & Vite Module Federation
Top Content
From my experience one of the hardest things is to share information between microfrontends, so in this talk I would like to explain various ways on how to share a design system to ensure uniformity to the application. Another difficult thing is sharing dependencies, fortunately with module federation it can be done, but how can I use different versions of the same library and how does it work behind the scenes?
I'm the creator of module-federation/vite library, with React and this library, I'd like to show you how you can achieve these results by configuring everything correctly.
Federated Microfrontends at Scale
React Summit 2023React Summit 2023
31 min
Federated Microfrontends at Scale
Top Content
The talk will be a story of how Personio went from rendering through a Monolithical PHP architecture, to a microfrontend oriented Next JS app, powered by Module Federation and the NX monorepo toolchain.
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?
Micro frontends architecture is extremely powerful when it comes to splitting large frontend monoliths into smaller, individually deployable blocks, each is owned by an autonomous team and is focused on a business domain. But what about State? We are often told that micro frontends shouldn't share state, as this would make them coupled to each other. However, when it comes to complex UIs, it is not rare to encounter scenarios where state management between micro frontends is necessary. This talk is about finding the sweet spot — In which scenarios it is reasonable for micro frontends to share State? and how should micro frontends share State while remaining decoupled of each other? We discuss & compare different solutions in React.
“Microfrontends” for Mobile in React Native
React Advanced Conference 2023React Advanced Conference 2023
24 min
“Microfrontends” for Mobile in React Native
Scaling has always been an issue in software development. Architects have been grappling to solve this problem on many layers. In the early 2000s, a concept of “micro-services” started popping up - a system could be split up by business domain into a number of smaller loosely-coupled services. 
More recently, this concept has started being adopted by the frontend community. An app could be split into multiple sub-apps, each with their own teams, technologies, and codebases. Companies like Spotify, Amazon, and Microsoft have adopted this approach and it has helped them scale even faster.
In the world of mobile development, the question arises: “Can we create Microfrontends for mobile apps?”.