Publishing Guide
This guide covers publishing MFE Forge and your MFE applications.
Publishing MFE Forge Framework
Prerequisites
- NPM account with 2FA enabled
- Organization scope configured (e.g.,
@mfe-forge) - Changesets configured
Versioning
bash
# Add a changeset
bun changeset
# Version packages
bun version-packages
# Publish to NPM
bun releasePublishing Individual Packages
bash
cd packages/cli
npm publish --access public
cd packages/core
npm publish --access publicPublishing Your MFE Applications
Docker Deployment
Build Docker images for each MFE:
bash
# Generate Dockerfiles
mfe-forge generate docker --scope appname
# Build images
docker-compose build
# Push to registry
docker-compose pushStatic Hosting
For static hosting (Vercel, Netlify, AWS S3):
bash
# Build all apps
mfe-forge build
# Each app's dist folder can be deployed independently
# apps/appname/auth/dist -> auth.yourdomain.com
# apps/appname/dashboard/dist -> dashboard.yourdomain.comCDN Deployment
For production Module Federation, host remotes on a CDN:
ts
// vite.config.ts (host)
federation({
remotes: {
authApp: 'https://cdn.yourdomain.com/auth/assets/remoteEntry.js',
dashboardApp: 'https://cdn.yourdomain.com/dashboard/assets/remoteEntry.js',
},
})Environment Configuration
Create .env files for each environment:
bash
# .env.development
VITE_AUTH_URL=http://localhost:3001
VITE_API_URL=http://localhost:8080
# .env.production
VITE_AUTH_URL=https://auth.yourdomain.com
VITE_API_URL=https://api.yourdomain.comCI/CD Pipeline
MFE Forge generates GitHub Actions workflows for:
- Lint & Type Check — On every PR
- Unit Tests — On every PR
- Build — On merge to main
- Deploy — On release
Manual Deployment
bash
# Build specific scope
mfe-forge build --scope appname
# Deploy to staging
mfe-forge deploy --scope appname --env staging
# Deploy to production
mfe-forge deploy --scope appname --env productionRegistry Configuration
For private registries, configure mfeforge.config.ts:
ts
export default {
registry: {
url: 'https://npm.yourcompany.com',
auth: process.env.NPM_AUTH_TOKEN,
},
}