Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Angular Summit: How to build Micro Frontends wi...

Marcell Kiss
March 31, 2022
130

Angular Summit: How to build Micro Frontends with @angular/elements

This is a presentation I hold at Angular Summit '22

The presentation contains:
- A case-study for using Micro Frontends
- The concept of Micro Frontends, with benefits & drawbacks
- An open-source example for using @angular/elements, generating a framework-agnostic web-component from a regular Angular component:
https://github.com/marcellkiss/angular-web-component-example

More about me:
https://marcell.tech

Marcell Kiss

March 31, 2022
Tweet

Transcript

  1. Who am I? Marcell Kiss, MSc 
 Senior Software Engineer

    @marcelltech @marcellkiss @marcellkiss marcell.tech Contractor #EnterpriseArchitecture Organizer of Angular Hungary since 2015 🇩🇪 🇭🇺
  2. Frontend Structure Monorepo with nx workspace - apps - change

    portal - libs - address - payment - search - shared @change-portal/search Change portal Address Payment Search Shared @marcelltech
  3. UX Flow Change Address Change Payment Method Change Search Settings

    Enter your Address… Continue Change Portal Edit Save Continue Con f irm Feedback ZIP City Address: Universitätspl. 3, ZIP: 8010 City: Graz Back Changes are saved address lib /address/edit /address/con f irm /address/feedback
  4. Change Portal after Product Scrum Business UI/UX Fullstack @marcelltech Product

    Scrum Business UI/UX Fullstack Product Scrum Business UI/UX Fullstack Address Service Payment Service Search Service after…
  5. Architecture after… Frontend Interaction Service Address Service Payment Service Search

    Service Frontend Frontend Interaction Service Interaction Service @marcelltech
  6. Team responsibilities Product Scrum Business UI/UX Fullstack @marcelltech Product Scrum

    Business UI/UX Fullstack Product Scrum Business UI/UX Fullstack
  7. Implementation approaches to evaluate • Build Time Integration • URL

    • Iframe • Web Components • … Server Side Template Composition, etc. @marcelltech
  8. Motivations • Scalability • Robustness • Framework agnostic • Smaller,

    less complex codebase • Independent, specialized teams • Independent 
 development / tests / deployment …faster development… @marcelltech
  9. Challenges to overcome • Test Environment • Communication 
 Fragments

    <-> Host • Performance • Payload Size • Versioning @marcelltech
  10. What’s this? Angular Component @angular/ elements Web Component bundle.js <html>

    
 … 
 <angular-component></angular-component> 
 … 
 </html> ConsumerApp Selector: ‘angular-component’ @marcelltech
  11. Build Process ng update ngx-build-plus --force Ng build before Ng

    build after angular.json Credits: Manfred Steyer
  12. Resources - [Book] Micro Frontends in Action by Michael Geers

    
 https://micro-frontends.org/ 
 - [Article] Micro Frontends by Martin Fowler 
 https://martinfowler.com/articles/micro-frontends.html 
 - [Docs] Web Components by MDN 
 https://developer.mozilla.org/en-US/docs/Web/Web_Components - [Docs] @angular/elements 
 https://angular.io/guide/elements 
 - [OSS] ngx-build-plus 
 https://github.com/manfredsteyer/ngx-build-plus#readme 
 - [OSS] Angular Elements Example with nx workspace 
 https://github.com/marcellkiss/angular-web-component-example 
 - [OSS] Angular Module Federation 
 https://github.com/angular-architects/module-federation-plugin - [Presentation] Frontend Monoliths: 
 https://www.slideshare.net/JonasBandi/frontend-monoliths-run-if-you-can-137391467 @marcelltech