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! 🚀