How gagunsarthak/microfrontend_workspace works
Project type and purpose
• This is a front-end-only, micro-frontend architecture built with Angular CLI and Angular Elements.
• It consists of a “shell” or host container and multiple independently developed Angular apps (appone, apptwo, footerApp, headerApp, mainApp, sideApp, statementApp, subApp, tempapp, transferApp, demoapp). Each micro-app is compiled as a web component via Angular Elements.
• The README confirms the goal: “Microfrontends using Angular Elements.”
File structure
• Top-level artifacts:
• angular.json, tsconfig.json, ts lint and webpack.extra.js – indicating an Angular workspace configured for multiple projects.
• build-elements.js – a custom script to bundle each Angular app into an Angular Element (web component).
• projects/… contains one directory per micro-frontend. Each has the standard Angular CLI layout:
• src/app – components, routing, module definition
• src/environments – environment configs
• e2e, karma.conf.js, tsconfig.* – test configurations
• webpack.externals.js – to externalize shared vendor libs (Angular core, zone.js, RxJS)
• No backend code or server; this is strictly client-side.
README for additional insights
• References a tutorial on building and deploying micro-frontends locally.
Main components and their interactions
a. Host Shell Container (mainApp or index.html)
• Loads and instantiates multiple Angular Elements (micro-apps) at runtime.
• Responsible for global layout, shared header/footer, navigation, event bus, and loading child web components.
b. Micro-frontend Web Components
• headerApp, footerApp – the shared page chrome.
• sideApp, statementApp, transferApp, demoapp, appone, apptwo, tempapp, subApp – feature-specific modules packaged as custom elements.
c. Shared Vendor Bundle
• Externalized Angular framework, RxJS, zone.js – loaded once by the shell to minimize duplication.
d. Build Pipeline
• build-elements.js runs builds for each project, generates .js bundles for each Angular Element.
• webpack.extra.js configures externals to keep vendor shared.
Architectural patterns and design principles
• Micro-frontend pattern: each feature as an independent deployable Angular Element.
• Web components (Angular Elements) for framework-agnostic integration.
• Shell-and-spoke: a container app orchestrates and renders micro-frontends.
• Event-driven communication (via CustomEvents or a shared event bus) rather than direct Angular service injection.
• Lazy loading: micro-apps are only fetched and instantiated when needed.
• Shared dependencies externalized to reduce payload and enforce consistency.