| name | Turborepo + Rspack Module Federation | ||
|---|---|---|---|
| slug | build-systems/turborepo-rspack-mf | ||
| description | Turborepo monorepo with Rspack and Module Federation, deployed with Zephyr Cloud | ||
| framework | react | ||
| bundler | rspack | ||
| features |
|
||
| complexity | advanced |
A comprehensive Turborepo demonstrating Module Federation architecture with Rspack bundler and multiple micro-frontend applications.
- Framework: React 18 with TypeScript
- Architecture: Module Federation
- Build System: Turborepo
- Bundler: Rspack
- Language: TypeScript
- Styling: Tailwind CSS
- Deployment: Zephyr Cloud
- Development: Rspack Dev Server
- Node.js (version 16 or higher)
- pnpm (required for Turborepo)
Run the following command:
npx create-turbo@latest --example https://github.com/swalker326/ze-starter-turbo-
Install dependencies
pnpm install
-
Development mode
pnpm dev
This starts all applications concurrently:
- Host: http://localhost:3000 (main application)
- Home: http://localhost:3001 (remote micro-frontend)
- Settings: http://localhost:3002 (remote micro-frontend)
-
Build for production
pnpm build
Or using Turbo directly:
turbo build
-
Other commands
pnpm lint # Lint all packages pnpm check # Run Biome checks pnpm format # Format code
This Turborepo includes the following packages/apps:
Rspack Applications with Module Federation:
host- Main host application that consumes remote micro-frontendshome- Remote micro-frontend with home page functionalitysettings- Remote micro-frontend with settings and routing (React Router)
Shared Packages:
@repo/tailwind-config- Global Tailwind CSS configurations@repo/typescript-config- Shared TypeScript configurations
Each package/app is 100% TypeScript.
This Turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- Biomejs for formatting and linting
This example demonstrates a complete micro-frontend setup:
- Host Application: Orchestrates and consumes all remote micro-frontends
- Remote Applications: Independent micro-frontends that can be deployed separately
- Build Dependencies: Remotes must be built before host for proper module mapping
- Runtime Loading: Host loads remotes dynamically at runtime
For Zephyr Cloud deployment, remote applications need to be built first:
# Build order is handled automatically by Turbo
turbo buildThis ensures Zephyr Cloud can properly map remote applications before the host consumes them.
This example shows enterprise-scale micro-frontend deployment:
- Git Integration: Publish project to any git provider (public or private)
- Automatic Building: Turbo handles build order dependencies
- Deployment: Each build triggers Zephyr Cloud deployment
- Runtime Composition: Host loads deployed remotes at runtime
- Task Pipeline: Efficient task orchestration across packages
- Incremental Builds: Only rebuild what changed
- Remote Caching: Share build cache across team and CI
- Parallel Execution: Run tasks across packages in parallel
Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:
cd my-turborepo
npx turbo login
This will authenticate the Turborepo CLI with your Vercel account.
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
npx turbo link
Module Federation enables:
- Independent deployment: Each micro-frontend can deploy separately
- Runtime composition: Applications compose at runtime, not build time
- Team autonomy: Different teams can own different remotes
- Technology diversity: Mix different bundlers and framework versions
- Shared dependencies: Efficient sharing of common libraries
Zephyr Cloud is a micro-frontend deployment platform that provides:
- Auto-deployment: Seamless deployment from your build process
- Live preview links: Instant preview URLs for your applications
- SemVer versioning: Semantic versioning for your frontend modules
- Rollback capabilities: Easy rollback to previous versions
- Enterprise-scale orchestration: Built for composable frontend systems
Turborepo:
Module Federation & Zephyr: