Micro Frontends are without question one of the most popular yet controversial topics of web application development today. “Should you split your application?” is that question pursed on everyone’s lips, as they wonder if the hype is real or if it’s just another way for consultants to charge more money by tricking their clients. Today, I hope to provide some clarity on just that.
What are Micro Frontends?
Before you can understand Micro Frontends, you first need to understand Microservices. Microservices architecture is a well-known framework where we split large backend systems into smaller primitives, i.e. services. Micro Frontends come from the same school of thought and try to bring similar benefits to applications frontend engineering.
Different Approaches to Application Architecture
There is a stark contrast between where we were and where we are, when it comes to web application development. No longer limited to any one way, today, developers can choose to architect their applications in various manners – with no one-way holding clear dominance over the others. However, with such variety available comes the inherent pros and cons of each, making the right selection often a question of the specific project at hand.
Here is a graphical representation of some of the ways to architect web applications, including Micro Frontends.
Why you should consider Micro Frontends?
Micro Frontends are popular, and like most important things, has some clear advantages associated with it, driving that popularity. That isn’t to suggest that Micro Frontends aren’t without its unique disadvantages. Instead, it is to say that those “cons” are dwarfed by the genuine benefits and advantages associated with them. And in case that glowing endorsement wasn’t enough, here are a few tangible reasons you should consider Micro Frontends for your next application’s architecture.
Develop, test, and deploy applications independently: Teams can be broken down into smaller tribes and squads, focusing only on a particular area or piece of functionality. They can easily develop, test, deploy, and reiterate on those small applications without inter-dependency. This advantage is at the heart of Micro Frontends. Simple as it may sound at first, this advantage brings with it a liberating feeling.
Develop different pieces of frontend using different technologies: Frontend technologies are evolving daily, and new frameworks are continually knocking on the door. And while some are promising and show potential for your application, you are limited to just one unless you want a giant monolith.
Micro Frontends solve this problem by allowing individual teams to choose whatever technology they want to use for their micro-applications and develop complete isolation, yet maintaining more profound synchronicity with the project and teams.
Update individual pieces without rebuilds: For most, large frontend applications inherent characteristic was the need to rebuild it with each new version release. Although there are ways through which the build system can produce hashed versions of the final bundles, they’re prone to error. Fortunately, webpack 5 is on the horizon with a new deterministic algorithm to handle this problem.
Micro Frontends are an ideal solution and one that doesn’t interfere with the bundler itself. As a micro-application is being bundled, the rest of the packages’ bundles remain the same and are cached, resulting in faster bundling and more persistent caching.
Different teams can choose different tooling: In a giant frontend monorepo, tooling and infrastructure are primarily centric, and all sub-modules rely on the same set of tooling. However, in Micro Frontends, different applications could potentially use different tooling and bundlers. The value in this stems from facilitating the use of new and improved tools for a single micro-application without a significant overhaul.
- Governance can become a lot easier: As mentioned before, large teams can be divided, bringing not only freedom in terms of building software in isolation but also in choosing the tools to do it with, but agility and easier governance as teams are divided, mostly independent, and easier to manage.
With their ability to develop, test, and deploy applications independently using different technologies and tools for different components, all while negating the need for version rebuilds, it should be clear to you that yes, Micro Frontends do live up to the hype. However, I mentioned earlier, there isn’t just one way of doing things. You should always account for and let the project dictate and influence your selection. After all, while undoubtedly a game-changer, Micro Frontends still have their time and place.