Monolith to Micro-Frontends

Rate this content
Bookmark

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.

FAQ

Common problems with aging React applications include exponential growth in code, slow CI processes, duplication of code, unclear ownership, and complex dependency graphs. These problems generally arise as the application and the organization grow, making scalability and maintenance challenging.

Microfrontends are an architectural style where a frontend app is decomposed into individual, semi-independent 'micro' frontends. This approach is important because it allows for independent deployments and scalability, which can solve issues like entangled dependencies and deployment bottlenecks in monolithic systems.

The key benefits include increased scalability, improved maintainability, and the ability to deploy parts of the application independently. This transition allows for better distribution of development tasks across teams and reduces the risk of deploying large-scale changes that might impact the entire application.

Transitioning to microfrontends involves decoupling the monolith into smaller, manageable pieces. Strategies like the Strangler pattern can be effective, where new features are gradually built as microfrontends and old features are slowly replaced. This allows for a gradual shift without the need for a complete rewrite.

The Strangler pattern is a gradual method to transform legacy systems by building new features as microfrontends around the existing monolithic application. Over time, these new features replace the old ones, effectively 'strangling' the old application and minimizing the risks associated with big bang rewrites.

When choosing a composition model for microfrontends, factors like the deployment strategy, the degree of isolation required, and the complexity of integration should be considered. Options include client-side, server-side, or edge-side rendering with tools like Webpack Module Federation to manage dependencies.

Ruben Casas
Ruben Casas
22 min
21 Oct, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

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.

Available in Español: De Monolito a Micro-Frontends

1. Introduction to Microfrontends

Short description:

We're going to talk about how to transform monoliths to micro-frontends. React has been here for a long time and applications that are a bit old now start growing and breaking. The problems are usually about the organization and the complications that come with growth. Exponential growth, duplication of code, and unclear ownership are some of the issues. Microfrontends have been considered as a solution by many people and companies.

So, my name is Ruben and I'm a staff engineer at Postman. And the topic today is cool. We're going to talk about how to transform monoliths to micro-frontends.

Now, this is our React conference, right? Well, React has been here for a long time, right? Next year, React will be how old? Ten years old, right? So, recruiters will probably be like, oh, finally, we're going to be asking for ten years React experience.

React has been here for a long time. If you have applications that are a bit old now. Well, technically, not old, old, but in the long scheme of things of technology, they're probably getting on a bit. And the problem with that is applications get old and they start growing and growing and growing. And what's the problem with growth? Well, it probably starts to break at some point. And we'll probably be experiencing.

Now, if you think, if you've been working with React, think the problems you have right now, you probably will probably have a long session of people just complaining about the issues that you have. But mostly it's not about React itself, it's usually about the organization. It's about how as your company and the application grows, things start getting really more complicated and difficult to scale. So, you start getting things like exponential growth, like you have a lot of lines of code. You have more developers, you know, when you started that project it was only two or three. Now you have many groups of developers, especially for companies that are quite big.

CI takes a long time to complete. We all hate that. We want things to be quick. Duplication of code. There is no clear ownership. Who owns what? Et cetera, et cetera. So, we have a lot of problems. That dependency graph is the worst one. I hate it. Like we have a lot of dependencies and we don't know where they're coming from or what is using what. So, there are a lot of problems. You're probably familiar with this.

So, all of these problems have led a lot of people to think about microfrontends. Shall we use microfrontends to solve this problem? And people and a lot of companies are either implementing microfrontends or are trying to implement microfrontends.

2. Transitioning from Monolith to Microfrontends

Short description:

How do we go from a monolith to microfrontends? The main goal of going from the monolith to micro frontends is to remove coupling and accidental coupling. People want to go to micro frontends, but they don't understand why. If you want to go to a distributed architecture, if you want to solve those problems that you have with scaling a large monolithic application, you need to decouple it first.

And there's only one issue with that. How do we do it? Where do we start? I have this big problem, this monolith, this massive application. How do we go from a monolith to microfrontends?

Okay. But, first, what are microfrontends? This is a joke. I'm not going to be explaining what a microfrontends is. Every single talk about microfrontends starts with that slide. If you're not familiar, you can watch some talks about what they are. I'm going to be focused a bit more on how to go there, rather than what they are. And I can touch on a couple of concepts. But that's the main goal of this... Actually, I'm going to tell you what's the main goal of this presentation. Do you want to know what's the main goal of this presentation? I'm going to make you smart. I'm going to make you look good. When you go to the next meeting, right, if you want to impress everybody in that room, right, I will show you. I will give you the key. Are you ready for the key? Once you're in that meeting, you just have to say, well, I think we need to find an opportunity to decouple these pieces. All right. Immediately. So that will make you sound like the smartest person in that room. So decoupling the pieces, and that's Ryan Florence, by the way. Great quote. That's not me. So coupling is a big problem. And, actually, the biggest than coupling is accidental coupling. That's the worst of all. So the main goal of, well, not this talk, but the main goal of going from the monolith to micro frontends is to remove coupling and accidental coupling. That is the main goal, right? How do we achieve that goal? Well, I will show you in a minute, but the thing I like to say, this is my quote, by the way, I think, so I came up with it. People want to go to micro frontends, but they don't understand why. And this is a really good enough reason. If you want to go to a distributed architecture, if you want to, you know, solve those problems that you have with scaling a large monolithic application, you need to decouple it first, otherwise, you will end up in a, you know, the worst place from when you started.

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.
A Framework for Managing Technical Debt
TechLead Conference 2023TechLead Conference 2023
35 min
A Framework for Managing Technical Debt
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt.In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.

Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
As developers, we spend much of our time debugging apps - often code we didn't even write. Sadly, few developers have ever been taught how to approach debugging - it's something most of us learn through painful experience.  The good news is you _can_ learn how to debug effectively, and there's several key techniques and tools you can use for debugging JS and React apps.
Fighting Technical Debt With Continuous Refactoring
React Day Berlin 2022React Day Berlin 2022
29 min
Fighting Technical Debt With Continuous Refactoring
Top Content
Let’s face it: technical debt is inevitable and rewriting your code every 6 months is not an option. Refactoring is a complex topic that doesn't have a one-size-fits-all solution. Frontend applications are particularly sensitive because of frequent requirements and user flows changes. New abstractions, updated patterns and cleaning up those old functions - it all sounds great on paper, but it often fails in practice: todos accumulate, tickets end up rotting in the backlog and legacy code crops up in every corner of your codebase. So a process of continuous refactoring is the only weapon you have against tech debt. In the past three years, I’ve been exploring different strategies and processes for refactoring code. In this talk I will describe the key components of a framework for tackling refactoring and I will share some of the learnings accumulated along the way. Hopefully, this will help you in your quest of improving the code quality of your codebases.
Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
In this talk, we'll build our own Jarvis using Web APIs and langchain. There will be live coding.
Power Fixing React Performance Woes
React Advanced Conference 2023React Advanced Conference 2023
22 min
Power Fixing React Performance Woes
Top Content
Next.js and other wrapping React frameworks provide great power in building larger applications. But with great power comes great performance responsibility - and if you don’t pay attention, it’s easy to add multiple seconds of loading penalty on all of your pages. Eek! Let’s walk through a case study of how a few hours of performance debugging improved both load and parse times for the Centered app by several hundred percent each. We’ll learn not just why those performance problems happen, but how to diagnose and fix them. Hooray, performance! ⚡️

Workshops on related topic

Building a Shopify App with React & Node
React Summit Remote Edition 2021React Summit Remote Edition 2021
87 min
Building a Shopify App with React & Node
Top Content
WorkshopFree
Jennifer Gray
Hanna Chen
2 authors
Shopify merchants have a diverse set of needs, and developers have a unique opportunity to meet those needs building apps. Building an app can be tough work but Shopify has created a set of tools and resources to help you build out a seamless app experience as quickly as possible. Get hands on experience building an embedded Shopify app using the Shopify App CLI, Polaris and Shopify App Bridge.We’ll show you how to create an app that accesses information from a development store and can run in your local environment.
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.
Build a chat room with Appwrite and React
JSNation 2022JSNation 2022
41 min
Build a chat room with Appwrite and React
WorkshopFree
Wess Cope
Wess Cope
API's/Backends are difficult and we need websockets. You will be using VS Code as your editor, Parcel.js, Chakra-ui, React, React Icons, and Appwrite. By the end of this workshop, you will have the knowledge to build a real-time app using Appwrite and zero API development. Follow along and you'll have an awesome chat app to show off!
Hard GraphQL Problems at Shopify
GraphQL Galaxy 2021GraphQL Galaxy 2021
164 min
Hard GraphQL Problems at Shopify
WorkshopFree
Rebecca Friedman
Jonathan Baker
Alex Ackerman
Théo Ben Hassen
 Greg MacWilliam
5 authors
At Shopify scale, we solve some pretty hard problems. In this workshop, five different speakers will outline some of the challenges we’ve faced, and how we’ve overcome them.

Table of contents:
1 - The infamous "N+1" problem: Jonathan Baker - Let's talk about what it is, why it is a problem, and how Shopify handles it at scale across several GraphQL APIs.
2 - Contextualizing GraphQL APIs: Alex Ackerman - How and why we decided to use directives. I’ll share what directives are, which directives are available out of the box, and how to create custom directives.
3 - Faster GraphQL queries for mobile clients: Theo Ben Hassen - As your mobile app grows, so will your GraphQL queries. In this talk, I will go over diverse strategies to make your queries faster and more effective.
4 - Building tomorrow’s product today: Greg MacWilliam - How Shopify adopts future features in today’s code.
5 - Managing large APIs effectively: Rebecca Friedman - We have thousands of developers at Shopify. Let’s take a look at how we’re ensuring the quality and consistency of our GraphQL APIs with so many contributors.
0 To Auth In An Hour For Your JavaScript App
JSNation 2023JSNation 2023
57 min
0 To Auth In An Hour For Your JavaScript App
WorkshopFree
Asaf Shen
Asaf Shen
Passwordless authentication may seem complex, but it is simple to add it to any app using the right tool.
We will enhance a full-stack JS application (Node.js backend + Vanilla JS frontend) to authenticate users with One Time Passwords (email) and OAuth, including:
- User authentication – Managing user interactions, returning session / refresh JWTs- Session management and validation – Storing the session securely for subsequent client requests, validating / refreshing sessions
At the end of the workshop, we will also touch on another approach to code authentication using frontend Descope Flows (drag-and-drop workflows), while keeping only session validation in the backend. With this, we will also show how easy it is to enable biometrics and other passwordless authentication methods.