Adopting Micro-Frontends Without Micro-Frontends

Rate this content
Bookmark

Micro-frontends help break up monolithic front-end applications into independently deployable loosely-coupled apps. This architecture helps us scale projects as an organisation scales, however it's also an increase in complexity. How can we leverage this architecture without having to face its upfront cost? In this talk, I'll show some of the risks associated with micro-frontends, and what patterns and libraries we can use to benefit from this architectural style without going full-on micro-frontends.

FAQ

A microfrontend is an architectural style where independently deliverable frontend applications are composed into a greater whole, allowing for increased scalability and flexibility in development.

The main benefit of microfrontends is business scalability. They allow organizations to add more streams and teams to a project, potentially doubling output with increased manpower, due to their independent nature.

Common challenges include performance issues due to code duplication and multiple executions, consistency problems from too much independence among components, and potential reliability issues when integrating multiple versions or components.

Microfrontends can impact UI consistency by allowing different versions of a design system across components. Performance can be affected due to the duplication of code and data requests, which may occur when different teams work independently.

A composable app is a construct that allows apps to be embedded and hosted within each other, enabling flexibility in where and how components are displayed without caring about their hosting environment. This concept supports stronger boundaries and better encapsulation in microfrontend architectures.

The LEAN principles for microfrontends involve making them loosely coupled with well-defined interfaces, ensuring they are executed independently, aligning them closely with a business domain, and minimizing dependencies to enhance autonomy and reduce coordination overhead.

It is recommended to keep state management minimal and isolated within each microfrontend to prevent dependencies across different components. Shared state should be limited, and the logic for state manipulation should be confined within the boundaries of the respective microfrontend.

Different versions of a microfrontend can work together by ensuring complete independence between them. This involves avoiding shared states and dependencies, which helps in maintaining functionality even when multiple versions are deployed simultaneously.

Alex Lobera
Alex Lobera
30 min
21 Oct, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk explores the adoption of micro frontends without actually implementing them. The main benefits of micro frontends are business scalability and the ability to independently deploy and compose frontend applications. The process of breaking up a monolith into smaller parts can be done using LEAN principles and composable apps. State management and data sharing in micro frontends are complex topics that require careful consideration to avoid coupling and maintain loose coupling.

1. Introduction to Micro Frontends

Short description:

Today I'm going to talk about adopting micro frontends without micro frontends. What is a microfrontend? It's an architectural style where independently deliverable frontend applications are composed into a greater whole. The main benefit of microfrontends is business scalability. However, there are cons such as performance and consistency issues.

Today I'm going to talk about adopting micro frontends without micro frontends. Ruben, the previous speaker, he gave a great talk and I was just there looking at what he was saying. I was like, wow, he actually explained everything. So now I'm going to try to convince you how to maybe not go towards the end of that path.

Who am I? Alex. I was introduced. I currently work for Miro. If you don't know Miro, it's a very complex frontend. Very challenging. It's an infinite realtime collaboration ward. Really challenging. If you want to join the challenge, you can join the company. And today, you know, Ruben didn't give you the definition, so here I am. I'm going to give it to you. What is a microfrontend? And this is the, I would say the canonical definition you will find in any blog post and conference talk which was written a few years ago and basically says that it's an architectural style where independently deliverable frontend applications are composed into a greater whole.

So what's the point of microfrontends? What do you get? The main benefit is business scalability. And it means that you can add more people to your project, and let's say you double the number of people who work there, then you double the outcome. And you do that because they are independent things, right? You can add a new stream, a new value stream, and so on, and so that's why it's scalable. Not to confuse with, like, platform or where your software is running, because your frontend application will run at some point, unless you don't have JavaScript, on a browser, and you're not going to be able to scale that thread. So what are the cons? First is performance. You know, you can effect performance in two different ways. One is your application. You're making things very independent, and so you might or might not duplicate certain code. You know, the classic thing. You download the same framework twice. You also need to execute things, some things you can execute twice, and you also maybe request data twice, but also your teams, maybe because you are making things, if you're really focused on making things very independent, maybe they duplicate work, they create CI pipelines for very different repos, and so on. You can also effect consistency for the same reason, just making things independent. Now, if you read any articles, most talks about micro-frontends, they say don't share any state. You shouldn't do that. The reason is, because you want to make things independent, but if you don't share that state, you keep, if you change the language in one micro-frontend, I guess you want to change the language in the other one, how do you know? How do you fix that? Same with design.

2. Reliability and Micro Frontends

Short description:

You can create a design system with different versions. Reliability is crucial for code execution. Let's use Twitter as an example. Breaking it into micro-frontends, we have a feed and a reply micro-frontend. Different versions can be deployed, but if they are independent, they should work.

You can create a design system, but you can also have different versions of your design system. And then reliability. And by reliability I mean, when you execute some code, it basically should not fail, right? Once the code, it should produce the expected outcome. Those are, you know, you have ways to work around that and to improve those things and mitigate quite a lot of those things. Performance and consistency. But it's not the case with reliability.

Let me give you an example. I'm going to use Twitter as an example here. Let's say we want to break up Twitter into micro-frontends. And so, we have this page contains, this is the home page. It's a feed page and this is, we'll create a feed micro-frontend. When you click on that button, it shows a model and we could create another micro-frontend for that. It's a different team, engaging team, whatever. It's micro-frontend, we'll call it reply micro-frontend.

What's going to happen is, at some point in time, we have these two versions, everything is working. So, the user goes to Twitter, then the user gets an HTML that says, oh, you need to download this JavaScript for the feed. And so, you, that's fine, it works. It's, it's displayed on the browser. But then on the background, version two of that micro-frontend is deployed. You can test that, you can also test that, ensure that journey where the user is on a feed and replying to a tweet, works. You can run some integration tests, works, release. Then a new version is deployed. You can do the same. You can test, release, and so on. This point in time, the user didn't, didn't reply, so didn't execute that action. At the point in time later, the user wants to reply, some tweet, and then it gets the version three of this microfrontend. So the question is, will it work? We never tested that, right? You could test that, but imagine it grows exponentially. The more releases you have and the more microfrontend, it will be like, enormous amount of work, so you probably don't test. Will it work? Well, the answer is, if they are completely independent, they should work. Right? So that's fine.

QnA

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?”.

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
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.