Chuyển đến nội dung chính

Lesson 10: What is Micro Frontend? — Benefits, Trade-offs & Decision Framework

Definition of Micro Frontend. Why do we need Micro Frontend when we already have Microservices? Benefits: independent deployment, team autonomy, tech diversity. Trade-offs: complexity, performance, UX consistency. Decision framework.

🏗️ Architecture — Lesson 10 Lesson 10: What is Micro Frontend? — Benefits, Trade-offs & Decision Framework

Microservices & Micro Frontend system design — From basics to Production

Part 4: Micro Frontend — Architecture & Principles

xdev.asia

Introduction

Micro Frontend extends the idea of Microservices to frontend: dividing the web application into small parts, each part is owned, developed and deployed independently by a team. This article explains why Micro Frontend is needed and when it should (or should not) be used.

Micro Frontend Overview — each team owns a vertical slice


1. What is Micro Frontend?

1.1 Definition

"An architectural style where independently deliverable frontend applications are composed into a greater whole." — Cam Jackson, Martin Fowler Blog

Monolith Frontend:                   Micro Frontend:
┌─────────────────────────┐         ┌─────────────────────────┐
│     Single SPA          │         │    Shell Application    │
│ ┌─────────────────────┐ │         │ ┌──────┐ ┌──────┐ ┌──┐ │
│ │ Header              │ │         │ │Shared│ │Shared│ │  │ │
│ ├──────┬──────┬───────┤ │         │ │Header│ │Footer│ │  │ │
│ │Produ-│ Cart │ Order │ │         │ └──────┘ └──────┘ │  │ │
│ │cts   │      │       │ │         │ ┌──────┐ ┌──────┐ │  │ │
│ │      │      │       │ │    ──►  │ │Produc│ │ Cart │ │Or│ │
│ │      │      │       │ │         │ │t MFE │ │ MFE  │ │de│ │
│ │      │      │       │ │         │ │Team A│ │Team B│ │rC│ │
│ ├──────┴──────┴───────┤ │         │ └──────┘ └──────┘ └──┘ │
│ │ Footer              │ │         │   Deploy   Deploy  De  │
│ └─────────────────────┘ │         │   riêng    riêng  ploy │
└─────────────────────────┘         └─────────────────────────┘
1 team, 1 repo, 1 deploy            N teams, N repos, N deploys

1.2 Micro Frontend vs Component Library

Component LibraryMicro Frontend
DeploySame app hostIndependent
Team ownershipSharedDedicated team
Tech stackSimilarCan differ
Runtime loadingBuild-timeRuntime
Data/stateShared in memoryIsolated

2. Why do we need Micro Frontend?

2.1 Practical problem

You have 5 teams working on 1 monolith SPA:

  • Continuous PR conflicts (500+ components, shared state)
  • Long Merge Queue → deploy once/week
  • A team wants to upgrade React 18, but needs the entire app to migrate
  • Bug on product page → rollback the whole app (cart, order are also affected)

→ Micro Frontend solves the organizational scaling problem.

2.2 Main benefits

BenefitsDescription
Independent DeploymentShip product page without affecting cart
Team AutonomyEach team owns end-to-end (UI → BFF → Service)
Tech FlexibilityTeam A uses React, Team B uses Vue (if necessary)
Incremental UpgradeUpgrade each MFE, no need for big bang
Fault IsolationBug in MFE A does not crash MFE B
Faster DevelopmentSmaller codebase = faster build, test, deploy

3. Trade-offs & Challenges

3.1 When Micro Frontend is NOT suitable

  • Small team (< 5 devs): overhead is too large compared to the benefits
  • Simple app: landing page, blog, simple dashboard
  • Tight UX coupling: the application needs seamless UX between parts
  • Performance-critical: add runtime overhead (loading, bootstrapping)

3.2 Complexity costs

Micro Frontend thêm complexity:
├── Infrastructure: CI/CD cho nhiều apps
├── Shared dependencies: versioning hell
├── UX Consistency: design system bắt buộc
├── Communication: cross-MFE events
├── Performance: bundle size, load time
├── Testing: integration testing across MFEs
└── Developer Experience: local dev setup phức tạp

4. Decision Framework

Bạn nên dùng Micro Frontend khi:

✅ Team size: 15+ frontend developers
✅ Multiple teams working on same app
✅ Deploy frequency: team muốn deploy độc lập
✅ App complexity: 10+ distinct features/pages
✅ Tech migration: cần incremental migration

❌ Skip Micro Frontend khi:
❌ Team < 5 developers
❌ Single team, shared ownership
❌ App chưa đủ phức tạp
❌ Performance là yếu tố quyết định
❌ Team chưa có experience với Microservices

Summary

Micro Frontend is not a silver bullet — it solves the organizational scaling problem. If you don't have that problem, don't create unnecessary complexity.


Next article: Lesson 11: Micro Frontend Integration Strategies — Build-time vs Run-time