Back to Labs Content
- Software Architecture
- System Design
- Frontend
The concept of splitting a frontend into smaller, manageable pieces.
Wednesday, December 4, 2024 at 11:23:45 AM GMT+8
Micro frontends are an architectural approach that applies the principles of microservices to frontend development. Instead of building a single, monolithic frontend application, the user interface is divided into smaller, independent pieces called micro frontends, each of which is developed, deployed, and maintained independently.
The Problem with Monolithic Frontends
A monolithic frontend refers to a single, large codebase that manages the entire user interface of an application. While this approach works well for small applications, it becomes increasingly challenging to manage and scale as the application and development teams grow. Below are the key problems associated with monolithic frontends:
1. Scaling Teams
- Coordination Overhead: In a large team, multiple developers work on the same codebase. This can lead to frequent merge conflicts, delayed pull requests, and dependency issues.
- Limited Parallel Development: Because the codebase is tightly coupled, teams cannot work independently on different parts of the application without stepping on each other's toes.
2. Slower Development Cycles
- Single Deployment Pipeline: In a monolithic frontend, all changes must pass through the same build and deployment pipeline. This means Small changes (e.g., fixing a typo) require deploying the entire application, also A single bug can block the entire release process.
- Longer Testing Time: The larger the application, the more time and effort it takes to ensure that new changes don’t break existing functionality.
3. High Risk of Changes
- Ripple Effect: Since everything is interconnected, even small changes in one part of the application can have unintended consequences elsewhere.
- Rollback Challenges: If something goes wrong after deployment, rolling back requires reverting the entire application, not just the problematic component.
4. Tech Stack Lock-In
- Difficult to Adopt New Frameworks: In a monolithic frontend, the entire application is built using a single framework or library. Upgrading or switching technologies is a monumental task that may require rewriting the entire application. Example: Migrating from AngularJS to React would involve significant effort and downtime.
- No Flexibility for Teams: Teams must stick to the same tech stack, even if certain parts of the application would benefit from newer or more suitable tools.
How Micro Frontends Work
Micro frontends operate on the principle of divide and conquer. Instead of managing one gigantic codebase, you divide your application into smaller units.
The idea behind micro frontends is simple yet powerful:
1. Divide your application into smaller, self-contained pieces.
2. Conquer by developing, testing, and deploying these pieces independently.
Instead of one massive codebase where every change has the potential to disrupt the entire application, you get a collection of smaller, focused units that can evolve at their own pace. Here is the breakdown of how divide and conquer works in microfrontend.

In a traditional monolithic architecture (left side), all components of a web application are tightly coupled and deployed as a single unit. This includes the web application layer (frontend), integration layer (APIs), and service layer (backend).
Microfrontends (right side) break down a large web application into smaller, independent frontend applications (also called "micro-applications" or "micro-frontends"). Each microfrontend is responsible for a specific feature or section of the application. This approach promotes modularity, scalability, and faster development cycles.
The divide and conquer approach is central to microfrontends. It involves:
Dividing the Application:
- Identify Features: First, break down the application into distinct features or sections. For example, in the image, we have "Cart," "Website," and "Payment" as separate features.
- Assign Teams: Each feature is assigned to an independent team. This allows teams to work autonomously, focusing on their specific feature.
Conquering the Features:
- Independent Development: Each team develops its feature as a standalone frontend application. They can use different technologies (React, JAML, etc.) and frameworks as needed.
- API Integration: Teams define clear APIs for their microfrontends to communicate with each other and with the backend services. This ensures loose coupling and flexibility.
Composition and Orchestration:
- Frameworks and Tools: A framework or library is used to combine the microfrontends into a cohesive user experience. This can be done using techniques like server-side composition (e.g., with a Node.js server) or client-side composition (e.g., with a JavaScript framework like Single-SPA).
- Routing and Navigation: The framework handles routing and navigation between microfrontends, ensuring a seamless user experience.
- Shared Components: If necessary, shared components can be developed and used across multiple microfrontends. This promotes consistency and reduces code duplication.
Conclusion
Micro frontends represent a modern approach to building scalable, resilient, and maintainable frontend applications. By breaking down your application into smaller, independent pieces, you empower your teams to innovate faster and reduce deployment risks.. If you’ve ever felt constrained by the limitations of a monolithic frontend, it might be time to explore the possibilities of micro frontends. They’re not just a technical solution—they’re a way to rethink how we build for the web.
Another Recommended Labs Content
How to Set Up Push Notifications in Expo with Firebase for Android (Production-Ready Guide)
In this guide, you'll learn how to set up Expo push notifications for Android, including the correct use of Firebase Admin SDK credentials, how to upload them securely, and how to properly configure your Expo app.
Understanding Database Partitioning vs Sharding: Concepts, Benefits, and Challenges
When dealing with large volumes of data, efficient database management becomes essential. Two widely used techniques to improve performance and scalability are database partitioning and database sharding. Although often confused, these approaches differ fundamentally in architecture, complexity, and suitable use cases. This article explores these differences in detail, helping you decide which fits your application best.
System Design Simplified: The Trade-Off Triangle You Must Master
Behind every well-architected system is a set of tough decisions. The CAP Theorem simplifies those decisions by showing you what you must give up to keep your system fast, correct, and resilient. Learn how to apply this in real-world architecture.