

Tools and Practices for Microfrontends
source link: https://blog.bitsrc.io/tools-and-practices-for-microfrontends-dab0283393f2
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Today, Microfrontends are no longer a proof of concept. If we search on the internet, we can find many case studies of adopting Microfrontends. Besides, most of these web apps are already in production, proving its robustness.
However, it is essential to follow the best practices and choose the right tools to succeed with Microfrontends. Otherwise, Microfrontends could quickly become an overhead for your teams, risking the overall growth of the project.
In this article, I’m going to share some of the best practices around Microfrontends and recommend several tools to establish these practices in your projects.
1. Code Structure and Components
When adopting Microfrontends, one of the critical decisions you have to make is to choose the approach used to structure the code.
The two conventional methods used out there are the Distributedrepo and the Monorepo. Other than these two are hybrid approaches that fall somewhere in between.
In the Distributedrepo approach, the Microfrontends are divided into multiple repositories with their lifecycle managed separately. In the Monorepo, all the Microfrontends will reside in a single repository.
Distributed Repo Approach
The Distributed Repo approach is the more flexible one but it has the great challenge of sharing UI components, to maintain a consistent UI across MFs (which usually means maintaining UI components as NPM libraries, which creates the overhead of maintaining different build pipelines, different repositories, and version mismatches).
One good example of both implementing this Micro Frontends approach and solving the problem of sharing UI components between them, can be seen in Bit.dev .
The Bit.dev marketing website is composed using two groups of React components published and managed by the Bit platform. The two groups were built and delivered separately. The “moment of integration” happens on build time, in a codebase that consumes components from both collections. Whenever a new component version is delivered, a new integration happens.
Hover over different components on Bit’s landing page to see each component’s “scope” or “collection”. Click on the component name (on top) to inspect the component and/or to install it in your project.

As mentioned earlier, the above page is built from components developed in two different codebases, on two different GitHub repositories. Components of each codebase are published to their respective Bit collections.
- base-ui: Github | Collection on Bit
- evangelist: Github | Collection on Bit
Recommend
-
41
Developing web applications using Microservices is becoming a popular architectural style these days. When it comes to Microservices, we generally talk about the backend of the web application. Only considering t...
-
36
README.md
-
38
An overview of microfrontend patterns: advantages, drawbacks and implementation.
-
49
Microfrontends — should I care?
-
9
Are Microfrontends worth the complexity? An overview of Microfrontends pros and cons.
-
18
MicroFrontends With Blazor WebAssemblyI recently embarked on a mission to uncover the details behind the implementation of MicroFrontends under Blazor WebAssembly applications. This post represents a summary of m...
-
7
React Microfrontends and Monorepos: A Perfect MatchIn this article, we will use a monorepo when implementing a microfrontend architecture. We will explore how this approach mitigates problem...
-
6
single-spa Join the chat on Slack Donate to this project A javascri...
-
5
Webpack 5 introduced support for module federation. This is the ability to load modules at runtime instead of compiling them into your JavaScript application. However...
-
4
Why Microfrontends Need Zero-TrustShould we implement Zero-Trust in Microfrontends?
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK