A production-grade Micro-Frontend architecture using Webpack 5 Module Federation. Built for learning, experimenting, and mastering MFE concepts.
A complete, working Micro-Frontend platform featuring:
- β Shell (Host) application orchestrating multiple MFEs
- β Analytics MFE with real-time metrics
- β Dashboard MFE with task management
- β Shared SDK for communication and utilities
- β Error Boundaries for fault isolation
- β Performance Tracking built-in
- β Event Bus for cross-MFE communication
Micro-Frontend (MFE) architecture isn't just a technical upgradeβit fundamentally changes how software teams deliver value to the business:
- π Ship Features Faster: Different teams can build, test, and deploy their specific parts of the application (like a checkout flow vs. a user dashboard) completely independently. No more waiting for the "monthly release."
- π‘οΈ Zero Platform-Wide Downtime: If one specific feature crashes (e.g., the analytics graph fails to load), the rest of the application stays perfectly alive. Your core business operations are never halted by a single bug.
- π Infinite Scalability: As your company grows, you can seamlessly add new business units or products into the existing platform without rewriting code or accumulating technical debt.
- π€ Technology Independence: Different teams can use the best tools for their specific problems without forcing a single technology choice on the entire company.
- Node.js 18+
- npm 9+
# Clone or navigate to the project
cd FederatedHub
# Run automated setup
chmod +x setup.sh
./setup.sh
# Start all applications
npm run devThen open http://localhost:3000 in your browser!
- Shell running on port 3000
- Analytics MFE with live metrics (port 3001)
- Dashboard MFE with task management (port 3002)
- Toggle controls to show/hide MFEs
- Event log showing real-time communication
- Performance metrics in console
ββββββββββββββββββββββββββββββββββββββββ
β Shell (Host) - localhost:3000 β
β ββββββββββββββββββββββββββββββββββ β
β β Module Federation Container β β
β β - Loads remotes dynamically β β
β β - Shares React (singleton) β β
β β - Error Boundaries β β
β ββββββββββββββββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ
β Analytics MFE β β Dashboard MFE β
β Port 3001 β β Port 3002 β
β - Live metrics β β - Task mgmt β
β - Charts β β - Real-time β
βββββββββββββββββββ βββββββββββββββββββ
β β
ββββββββββ¬ββββββββββββ
βΌ
ββββββββββββββββββ
β Shared SDK β
β - Event Bus β
β - Perf Track β
ββββββββββββββββββ
FederatedHub/
βββ apps/
β βββ shell/ # Host application (3000)
β βββ analytics/ # Remote MFE #1 (3001)
β βββ dashboard/ # Remote MFE #2 (3002)
βββ packages/
β βββ shared-sdk/ # Event Bus + utilities
βββ setup.sh # Automated setup script
βββ GETTING_STARTED.md # Step-by-step guide
βββ ARCHITECTURE.md # Deep dive into design
βββ LEARNING_GUIDE.md # 30-day mastery plan
βββ README.md # This file
Choose your path:
β Read GETTING_STARTED.md
- Installation guide
- Running the platform
- Testing features
- Common issues
β Read ARCHITECTURE.md
- System design
- Module Federation explained
- Design decisions
- Loading flow
- Performance strategies
β Follow LEARNING_GUIDE.md
- 30-day learning plan
- Hands-on exercises
- Quiz checkpoints
- Advanced topics
Load code from other apps at runtime (not build time)
- Host (Shell) loads other apps
- Remote (Analytics, Dashboard) expose components
Only ONE React instance shared across all MFEs
The manifest file that makes it all work
Isolate failures - one MFE crash won't kill others
Communicate between MFEs without tight coupling
Monitor load times and optimize
| Technology | Version | Purpose |
|---|---|---|
| React | 18.2.0 | UI framework (singleton) |
| Webpack | 5.89.0 | Module Federation |
| TypeScript | 5.3.3 | Type safety |
| Babel | 7.23.7 | JSX/TS compilation |
- Open
apps/analytics/src/App.tsx - Add
throw new Error('Test');in useEffect - Analytics crashes, but Dashboard still works! β
- Click "Refresh Data" in Analytics
- Watch the Event Log update
- See console logs in DevTools
- Stop Analytics (Ctrl+C in terminal)
- Shell and Dashboard keep working
- Restart Analytics - reconnects seamlessly
Visit MFEs directly:
- http://localhost:3001 (Analytics)
- http://localhost:3002 (Dashboard)
They work independently!
npm run dev # Run all apps concurrently
npm run dev:shell # Shell only (3000)
npm run dev:analytics # Analytics only (3001)
npm run dev:dashboard # Dashboard only (3002)npm run build # Build all apps
npm run build:shell # Build Shell
npm run build:analytics # Build Analytics
npm run build:dashboard # Build Dashboard./setup.sh # Fresh install
npm run clean # Clean all dist foldersAfter exploring this project, you will:
β
Understand Webpack Module Federation deeply
β
Configure hosts and remotes confidently
β
Implement error boundaries properly
β
Design event-based communication
β
Track and optimize performance
β
Make architectural decisions
β
Explain MFE concepts in interviews
- Dynamic MFE loading with React.lazy
- Toggle MFEs on/off
- Real-time event log
- Performance metrics viewer
- Error boundary protection
- Real-time metrics dashboard
- Auto-updating data (every 3s)
- Animated metric cards
- Event publishing
- Standalone mode
- Task management system
- Interactive status updates
- Statistics overview
- Event-driven updates
- Responsive design
- Event Bus (Pub-Sub pattern)
- Performance tracker
- TypeScript definitions
- Singleton pattern
# Kill process on port 3000
lsof -ti:3000 | xargs kill -9cd packages/shared-sdk && npm run buildEnsure all package.json files use "react": "^18.2.0"
Make sure all MFEs are running on their ports
Want to extend this? Try:
- Add routing with react-router
- Add authentication flow
- Add theming system
- Add state management (Redux/Zustand)
- Add more MFEs (Notifications, Settings)
- Add E2E tests
- Add CI/CD pipeline
Use this project to answer:
- "How does Module Federation work?"
- "Why use Micro-Frontends?"
- "How do you share dependencies?"
- "How do you handle errors?"
- "How do MFEs communicate?"
Pro tip: Run this locally during interviews and demo it!
This is a learning platform. For production, add:
- Environment-specific configs
- CDN deployment
- Versioning strategy
- Monitoring/logging
- Security headers
- Performance budgets
- E2E testing
- CI/CD pipelines
MIT - Feel free to use for learning and projects!
Built for developers who want to:
- Master Micro-Frontend architecture
- Understand Module Federation
- Build production-ready MFE platforms
- Ace technical interviews
Ready to become a Micro-Frontend expert? Start with GETTING_STARTED.md! π