How gmurtaza786/module-federation-plugin-example works
What this project is (type + purpose)
This repo is an Angular workspace (monorepo) demonstrating Micro Frontends using Webpack 5 Module Federation via @angular-architects/module-federation.
Purpose (from README + structure):
• A Shell/Host SPA (projects/shell) runs as the main Angular app.
• A Remote Microfrontend (projects/mfe1) is built/served separately and lazy-loaded at runtime into the shell through Module Federation.
• There are also Angular libraries (projects/shared-lib, projects/auth-lib) intended to be consumed by one or more apps (shell/mfe1), representing shared UI/services/auth concerns.
So the “system” is primarily a front-end runtime composition architecture (no backend in this repo), where the shell dynamically loads code from a separately deployed microfrontend.
Top-level workspace
• angular.json, tsconfig.json, package.json: Angular workspace configuration and dependency graph.
Applications (deployable units)
• projects/shell/
Host application, includes:
• src/app/app.routes.ts: key for lazy route to remote
• src/assets/mf.manifest.json: indicates manifest-based remote URL mapping (important runtime discovery)
• webpack.config.js / webpack.prod.config.js: Module Federation host configuration
• src/decl.d.ts: typing for mapped remote modules
• projects/mfe1/
Remote application, includes:
• src/bootstrap.ts: typical MF setup where bootstrap is separated for federation
• src/app/.../flights/*: a feature domain exposed/used by shell (the README mentions “flights” link)
• webpack.config.js / webpack.prod.config.js: Module Federation remote configuration
Libraries (build artifacts; not deployed standalone)
• projects/shared-lib/: shared components/services module
• projects/auth-lib/: authentication-related module/service/component
These are likely statically bundled dependencies of shell/mfe1 at build time (unless configured to be shared as federated singletons; that detail lives in webpack configs).
Runtime / Container view (most important here)
What runs in the browser and what it fetches over the network at runtime.
Nodes to include:
• End User Browser
• Shell (Host) Angular SPA (served from its own origin)
• MFE1 (Remote) Angular build artifacts (served from its own origin)
• mf.manifest.json (as runtime config lookup, typically fetched by shell)
Remote code executes inside shell page (in-browser integration)
This view answers: “How does the shell load and render the microfrontend?”
Build-time / Dependency view (module federation + libs)
How code is produced and what depends on what during build.
Nodes to include:
• Angular CLI build (workspace)
• Webpack 5 Module Federation configuration:
• projects/shell/webpack*.config.js (host)
• projects/mfe1/webpack*.config.js (remote)
• shared-lib and auth-lib (as workspace libraries)
Key relationships:
• Shell build depends on: shell source + libs + MF host config
• MFE1 build depends on: mfe1 source + libs + MF remote config
• Both produce separate deployable artifacts
• Federation contract: shell expects remote exposes (e.g., a module/route) and remote provides them
This view answers: “What are the deployables and how are they wired?”
Deployment / Environment view (CI/CD + hosting)
Nodes to include:
• GitHub repo → GitHub Actions workflow
• Azure Static Web Apps (likely 2 apps or 2 deployments/paths):
• Shell static site (host)
• MFE1 static site (remote)
• Optional: CDN/front door (if applicable; can be shown as “Static hosting/CDN”)
Key relationships:
• CI builds shell and mfe1 separately
• Publishes artifacts to their hosting endpoints
• Shell runtime points to remote endpoint (direct URL or via manifest)
This view answers: “Where do these artifacts live and how are they updated?”
Browser Runtime Lane
• Browser
• Shell SPA (router + MF loader)
• Remote MFE1 module executing in shell DOM
Static Hosting Lane
• Shell hosting endpoint (serves shell bundles)
• MFE1 hosting endpoint (serves remoteEntry + chunks)
• Manifest location (often on shell host)
Build/CI Lane
• GitHub Actions
• ng build shell + ng build mfe1
• Outputs published to hosting
This captures the essential architecture without overthinking, while still separating the system into many components (host, remote, manifest, router, federation runtime, shared libs, CI/CD, hosting).
Checklist to ensure you didn’t miss anything important
• [ ] Shell and MFE1 shown as independently deployed apps
• [ ] remoteEntry.js shown explicitly as the remote “entry point”
• [ ] mf.manifest.json shown if used for remote URL mapping
• [ ] Lazy route (/flights) shown as the trigger
• [ ] Shared libs (shared-lib, auth-lib) shown as build-time dependencies
• [ ] Shared Angular dependencies shown (conceptually) as “shared singletons”
• [ ] CI/CD pipeline + hosting endpoints included (Azure Static Web Apps workflow)