In the last blog, we discussed the role of Micro frontend architecture (MFA) in extending Domain-Driven Design to frontend development. We learned how Single Page Applications (SPAs) dynamically render specific portions of HTML pages every time client data is altered. The modern-day applications are complex and do not fly well with the frontend monoliths. Microfrontends are the silver bullet we need. Therefore, in continuation of our previous blog, let us now take the conversation towards the guiding principles of the Micro frontend architecture (MFA). In this article, we will try to understand the principles that govern the architecture for its numerous benefits.
- Decentralized Architecture: Decentralization allows each Microfrontend unit to be treated solely for the objective it is meant to fulfill. This principle essentially paves way for vertical cuts. Centralized architecture is bound to be built on the same technology stack and similar level of expertise. That is why the decentralization principle is necessary for Microfrontend’s development, governance, data management, and performance.
- Scalable Performance: The decentralized Microfrontend units can be easily planned for scalability levels. Scalability and performance go hand in hand. This principle allows MFA to plan its performance based on change in number of users. Scalable frontend promises:
- Smart Capacity planning
- Adaptiveness towards the traffic patterns i.e. number of application users at different points in a day
- Quick identification of resource bottlenecks
- Reusability: By definition itself, Microfrontends are independently deployable frontends. The principle of reusability is necessary to ensure that these frontends are small enough to be reused in more than one applications. This is like Microservices architecture but for the presentation layer.
- Agility: There’s no point of introducing a whole new architecture for modern day application if it doesn’t follow the agility principle. Microfrontends units need to be developed and deployed faster without any compromise with their quality. This is of course achievable keeping in mind that the decentralization and reusability principle.
- Flexible Ecosystem: The principle of flexibility can be deemed as the backbone of this architecture. Different teams work on different microfrontend units. Integration of these units will require them to adapt each other seamlessly. This is essential for intercommunications of the services they are meant for. This will also affect the overall performance of the frontend as a whole. Furthermore, any functional changes in a single unit should not bring down the whole frontend. In short, the MFA needs to be flexible for internal as well as external changes.
- Failure Isolation: Here we take the principle of flexibility a step further. MFA should be capable of isolating the failure in one of the units with the rest of the system. This ensures what is called ‘Graceful Service Degradation’. The principle of failure isolation makes the architecture fault tolerant. This is Domain Driven Design being fool-proof.
The principles guiding the micro frontend architecture allow it to be – Agile for Development, easily maintainable, flexible in performance and cross functional. They are synonymous with the ones governing the microservices architecture; hence, domain driven. Microfrontends are meant to encourage the autonomy of development and flexibility of performance. In the next article, we will discuss in detail the benefits of this architecture that would in turn help how necessary they are for our applications.