Project demonstrating microfrontend architecture using Module Federation - industry standard for integrating multiple frameworks into a single application.
apps/
├── host/ # Next.js 15 + React 19 (main application)
├── vue-mars/ # Vue 3 + Vite (remote microfrontend)
└── svelte-moon/ # Svelte 4 + Vite (remote microfrontend)
- Host: Next.js 15 + React 19
- Remotes: Vue 3 + Svelte 4 (both with Vite)
- Module Federation:
@module-federation/vite - Monorepo: pnpm workspaces
# Install dependencies
pnpm installOpen 3 terminals and run:
Terminal 1 - Vue Mars (port 3001):
pnpm dev:marsTerminal 2 - Svelte Moon (port 3002):
pnpm dev:moonTerminal 3 - Host (port 3000):
pnpm devAccess:
http://localhost:3000- Home pagehttp://localhost:3000/mars- Vue microfrontendhttp://localhost:3000/moon- Svelte microfrontend
1. Build all projects:
pnpm build2. Start servers (3 terminals):
Terminal 1 - Vue Mars:
pnpm preview:marsTerminal 2 - Svelte Moon:
pnpm preview:moonTerminal 3 - Host:
pnpm startAccess: http://localhost:3000
- Remotes (Vue Mars and Svelte Moon) expose components via
remoteEntry.jsusing Module Federation - Host (Next.js) loads
remoteEntry.jsdynamically at runtime - Vue/Svelte components are mounted inside the React host
- Automatic fallback to iframe if Module Federation fails
Host renders → Loads iframe (fallback) → Tries Module Federation →
Loads remoteEntry.js → Gets bootstrap → Mounts component → Removes iframe
- ✅ Module Federation - Industry standard for microfrontends
- ✅ Multi-framework - React, Vue and Svelte in the same application
- ✅ Dynamic Loading - Runtime module loading
- ✅ Shared Dependencies - Library sharing (singleton)
- ✅ Fallback Strategy - Iframe as fallback if MF fails
To better understand Module Federation configurations, see:
apps/host/lib/microfrontends/README.md- Detailed explanation of configurations
Built with Module Federation
