Should you be using micro frontends for mobile?
In today's growing mobile development market, it’s more important than ever to seize on opportunities ahead of our competitors. What is the biggest obstacle to that?
The leading mobile apps are huge and complex and the development costs have similarly risen. Pain points for big mobile apps include the following:
Big effort of release: stability and quality verification without rollback possibility
Inability to scale: axis of change orthogonal to Axis of architectural scale
High cognitive load: monolithic - no business boundaries, conflating platform capability and features
Mobile-specific issues: any minor exception can cause the entire application to crash.
Therefore, in order to build a mobile application development platform that supports multi-team rapid delivery and stable and rapid online application, we should consider the micro frontends for mobile strategy.
What are micro frontends for mobile?
Micro frontends for mobile was introduced at the 2020 Thoughtworks Tech Radar and is now in the trial phase. Based on Cam Jackson’s definition of micro frontends, here is our definition micro frontends for mobile:
Multiple modules that can be developed, tested & deployed independently, but appear as a single cohesive application.
MFEs (micro frontends) are an essential business segmentation part in modular architecture, componentized architecture and even super apps. They usually exist in the form of a module or repository, or integrated into the app shell with monorepo strategy. Micro frontends for mobile usually have the following characteristics:
Business oriented: MFEs are built on the platform layer and strongly related to an independent business. The scope is generally one or multiple screens
Module isolation: MFEs are built, tested and deployed independently and generally has an independent sandbox application for integration testing
Library based: MFEs are generally a OS platform’s library module or a binary package, depending on the ways of creation and publication
What are the benefits of Micro Frontends for Mobile?
Capture new markets quickly
The MFE strategy can provide maximum reusability, reduce costs, improve efficiency, avoid resource waste, improve business operation efficiency, quickly and stably support company expansion or even multinational business while providing consistent user experience. For example, the Chinese company Meituan Takeout releases its business model in several channels, including Meituan app and Meituan Takeout app.
Flexible technology stack
MFEs can achieve technical autonomy for the team. The team can choose the most suitable tech stack to realize the business requirements, such as iOS/Android, Flutter, React Native, or HTML5, which reduces the labor cost to a certain extent, and can realize some low PV pages with low cost. But it is also worth mentioning that we need to build a complete platform layer to reduce the complexity of MFE introducing cross-platform technology.
Low cognitive load
As mentioned in the article on team cognitive load, team interaction is a key concept when redesigning an organization for business agility and speed. In the world of micro frontends for mobile, where each MFE has a clear business boundary, the business team can focus on building business functionality to deliver value to end users without having to work in Monolith, endure lengthy compilation speeds, or solve problems introduced by other teams. In the Micro Frontends for Mobile architecture mode, each feature team has its own product independently, and the maintenance cost is limited within the MFE, which reduces the internal cognitive load across teams (including construction, testing and maintenance), thus maximizing cost reduction and improving the delivery efficiency of the team. Meanwhile, the platform team treats the platform as product, aiming to provide reusable capabilities to feature teams, to help them build features based on the enterprise platform.
Different from the monolith application, MFEs enable isolating the business functions inside the team, which can provide a more comprehensive test structure. The stable version can be deployed in the app shell through version iteration, ensuring the stability of complex applications.
When to use Micro Frontends for Mobile
Even though mobile MFE can solve most engineering practices, they are not a silver bullet that can be successfully introduced in all scenarios. They can also bring more issues, for example:
Communication cost: extra inter-team cooperation, communication cost and context dispersion
Maintenance cost: multi-repo and multi-pipeline
Complexity cost: dependencies conflict across MFEs and app shell, effort to set up new business module
Platform support: The platform evolves gradually. During this process, MFE may need to build basic capabilities on its own. This will cause repetitive capabilities to exist in multiple MFEs, which will bring a certain amount of technical debt when the capabilities are sinked in the later stage.
When do enterprises take this approach?
Micro Frontends for Mobile is not only a kind of technical architecture, but also an adjustment of business organizational architecture. Based on Conway's law:
Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure.
The enterprise needs to adjust its organization to adopt MFE for mobile strategy. The main decision point for this approach is enabling multiple lines of business delivery features on mobile platforms in parallel, independently. When companies want to improve user experience, scale mobile business, have plans for business cooperation with other third parties, while leveraging the already made investments in their technology ecosystem and big team size, involving MFEs is a good idea.
Key decision points
Here are a few key decision points to consider when considering investing in a micro-frontend strategy:
if you have a requirement to support multiple lines of business in one single application
if product owner requires to rollout features as planned
if your have a strong requirement to have consistent native user experience
if there is an MVP stage for mobile product
if there is a simple business requirement, small mobile team
In the next part of this article, we’ll explain the four principles of micro frontends for mobile that we have distilled from experience.
Disclaimer: The statements and opinions expressed in this article are those of the author(s) and do not necessarily reflect the positions of Thoughtworks.