Advertisement
Intermediate Angular, Micro Frontends with Angular

What are the main strategies for composing multiple micro frontends together into one user experience?

Short answer

Common strategies include a shell application that dynamically loads other applications at runtime, often using Module Federation, using web components like Angular Elements to embed independently built pieces, or server side composition, where a server assembles pieces from…

Save Angular mock interview
Advertisement
AModel answer
Common strategies include a shell application that dynamically loads other applications at runtime, often using Module Federation, using web components like Angular Elements to embed independently built pieces, or server side composition, where a server assembles pieces from different applications before sending the final page to the browser.
// A shell app's routing configuration loading different micro frontends per route
const routes = [
  { path: 'catalog', loadChildren: () => loadRemoteModule('catalog', './Module') },
  { path: 'checkout', loadChildren: () => loadRemoteModule('checkout', './Module') }
];
Real-world example
A shell application routes users to a completely separate checkout micro frontend when they visit the checkout section, and to a separately built catalog micro frontend for browsing products, composing them seamlessly through routing.
Likely follow-ups
  • Which composition strategy generally provides the smoothest experience for end users?
  • How do you keep a consistent visual style across micro frontends built by different teams?
Related topics