02

Module 2: Micro Frontend Architecture Explained for Angular Developers

Chapter 2 • Intermediate

25 min

Micro Frontend Architecture Explained for Angular Developers

Micro Frontend architecture splits a large frontend into:

  • Smaller applications - Each handles a business domain
  • Independent codebases - Separate repositories
  • Domain-focused systems - Clear ownership boundaries

Each micro frontend:

  • Owns a business domain - Products, Checkout, Admin, etc.
  • Has its own repository - Independent version control
  • Can be deployed independently - No coordination needed

To users, everything still feels like one application.


The Core Concept

Traditional Monolithic Frontend

code
┌─────────────────────────────────┐
│   Single Angular Application   │
│                                 │
│  ┌──────┐ ┌──────┐ ┌──────┐    │
│  │ Prod │ │ Cart │ │ User │    │
│  └──────┘ └──────┘ └──────┘    │
│                                 │
│  One codebase, one deployment   │
└─────────────────────────────────┘

Micro Frontend Architecture

code
┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│   Products   │  │   Checkout   │  │    Admin     │
│   (Remote)   │  │   (Remote)   │  │   (Remote)   │
└──────┬───────┘  └──────┬───────┘  └──────┬───────┘
       │                 │                 │
       └─────────────────┼─────────────────┘
                         │
              ┌──────────▼──────────┐
              │   Host Application   │
              │   (Shell/Orchestrator)│
              └─────────────────────┘

Key Principles

1. Domain Ownership

Each micro frontend owns a complete business domain:

  • Products App: Product catalog, search, filters
  • Checkout App: Cart, payment, order processing
  • Admin App: User management, analytics, settings

2. Independent Development

  • Separate repositories
  • Separate teams
  • Separate development cycles
  • No shared codebase conflicts

3. Independent Deployment

  • Each app deploys on its own schedule
  • No coordination required
  • Rollback affects only one app
  • Faster release cycles

4. Runtime Integration

  • Apps integrate at runtime (not build time)
  • Host application loads remote modules
  • Users see one seamless application

How It Works

Step 1: Host Application

The Host (or Shell) application:

  • Provides the application shell
  • Handles routing
  • Loads remote modules dynamically
  • Manages shared layout

Step 2: Remote Applications

Remote applications:

  • Are complete Angular applications
  • Expose modules to the Host
  • Run independently
  • Can be accessed standalone

Step 3: Runtime Integration

When a user navigates:

  1. Host detects route change
  2. Host loads appropriate remote module
  3. Remote module renders in Host's container
  4. User sees seamless experience

Real-World Example

E-Commerce Platform

Products Micro Frontend:

  • Team: Product Catalog Team
  • Repository: products-app
  • Deploys: Daily
  • Owns: Product pages, search, filters

Checkout Micro Frontend:

  • Team: Payment Team
  • Repository: checkout-app
  • Deploys: Weekly (more cautious)
  • Owns: Cart, payment, order confirmation

Admin Micro Frontend:

  • Team: Admin Team
  • Repository: admin-app
  • Deploys: As needed
  • Owns: User management, analytics

Host Application:

  • Team: Platform Team
  • Repository: host-app
  • Deploys: Rarely (infrastructure only)
  • Owns: Routing, layout, navigation

Benefits

For Teams

  • ✅ No merge conflicts
  • ✅ Independent release cycles
  • ✅ Clear ownership boundaries
  • ✅ Faster development

For Business

  • ✅ Faster feature delivery
  • ✅ Lower deployment risk
  • ✅ Better scalability
  • ✅ Technology flexibility

For Users

  • ✅ Seamless experience
  • ✅ No difference from monolithic app
  • ✅ Better performance (lazy loading)
  • ✅ More reliable (isolated failures)

The Technical Foundation

Micro Frontends in Angular use Module Federation (Webpack 5 feature) to enable:

  • Runtime code sharing
  • Dynamic module loading
  • Shared dependency management

The next module compares this with monolithic approaches.