Last years I see the term "Micro Frontends" become more common than before.
In the world of backend developers, it's already more common to split everything into microservices. Thanks to the techniques of Docker it's easier than ever to scale the backend into multiple services and instances of those services.
But in the world of front-end developers, it is not that common yet.
In this post, I want to share my thoughts on why I think it could be good to go from a monolithic front-end application to a micro frontends approach.
For all those frontend developers that build websites or web apps for years in a monolithic architecture, the micro frontends approach feels a bit off. (Well that is my first opinion when I discovered it).
When you think about the challenges we have with a monolithic frontend application:
- Harder to work on with multiple people/teams
- Long build times
- Overrides of styling without knowing it
- When API's have breaking changes, the whole application needs to be deployed
When you first start to build a single website this is not a big problem. But when the organization grows, the number of people that work on it will become a challenge.
Switching to a micro frontends approach could solve some of those problems.
- Easy to deploy in small parts
- Shorter build times
- Easier to work on with multiple people/teams
- Breaking API change will only require 1 small deployment
But it will take a different mindset for the development team. Next to that, it needs some additional work to change the frontend architecture.
Lucky enough we are not the first developers who have experienced these challenges with the monolithic frontend architecture.
Big companies like Spotify, Klarna, Zalando, Upwork, Allegro, HelloFresh, AirBnB, and Facebook have experienced these challenges too.
So they pioneered a lot with this and find some cool approaches to solve the problems.
- Zalando build Mosaic9. Check their talk about it: Mosaic Microservices at Zalando Tech
- Klarna explains on HN how they approach it
- Upwork has written a blogpost: Modernizing Upwork with Micro Frontends
- Allegro has written a blogpost: Managing Frontend in the Microservices Architecture
- HelloFresh has written a blogpost: Front-end Microservices at HelloFresh
If you checked all the posts of the big companies you could see a few techniques on how to approach the micro frontend technically.
- Multiple SPA on different URLs: This is the simplest way of having multiple micro frontends
But the question, "when would it be a good idea to switch to micro frontends?". Well, I think it's relatively simple, when you build a small website, stick with the monolithic approach. When you build a big application, work with a big amount of people/teams and use "microservices" as your backend architecture, you could definitely benefit from the Micro Frontends approach.
Thanks for reading all the way down to here 😅. I hope it gave you some material for your investigation of Micro Frontends.