This project demonstrates a micro frontend architecture using React, TypeScript, and Vite Module Federation.
It showcases how independently developed frontend applications can be composed together at runtime.
The system consists of:
- Host (Shell) — responsible for layout, routing, and orchestration
- Catalog (Remote) — product listing domain
- Cart (Remote) — shopping cart domain
Each part is built and deployed independently and integrated at runtime via Module Federation.
- Runtime integration using Module Federation
- Host loads remotes dynamically via
remoteEntry.js - Clear separation of concerns between shell and domain applications
- Cross-app communication via host-managed state and explicit contracts
microfrontends-demo/
apps/
host/
catalog/
cart/
- React
- TypeScript
- Vite
- Module Federation (vite-plugin-federation)
- React Router
- The host application is the main entry point.
- When navigating to
/catalogor/cart, the host dynamically loads the corresponding remote. - Remotes expose modules via
remoteEntry.js. - The host integrates them at runtime.
The demo uses host-mediated communication:
catalogemits events via props (onAddToCart)hostmanages shared state (cartItems)cartreceives data via props
catalog → host → cart
This approach keeps micro frontends loosely coupled and easy to evolve.
Due to limitations of the Vite federation plugin:
- Remotes must be built and served separately
npm run build -w catalog
npm run preview -w catalog
npm run build -w cart
npm run preview -w cart
npm run dev -w host
Each application is deployed independently:
- Host → main application (e.g. app.company.com)
- Catalog → remote bundle (e.g. catalog.company.com)
- Cart → remote bundle (e.g. cart.company.com)
The host dynamically loads remotes at runtime via URLs.
Micro frontends introduce:
- Increased complexity in build and deployment
- Runtime integration challenges
- Dependency version management
- Need for clear contracts between applications
- Micro frontends are about team ownership and independent deployment
- The shell acts as a composition layer
- Communication should be explicit and controlled
- Tooling and deployment strategy are critical
- Runtime remote configuration
- Error boundaries for remote failures
- Shared UI library
- Versioned remote deployments (CDN)
- Observability and logging
This project was built as part of senior-level system design preparation, focusing on:
- frontend architecture
- distributed systems thinking
- runtime composition patterns