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

Angular, React, Vue and Co. peacefully united thanks to Web Components and Microfrontends @Voxxed Days Ticino 2019, Switzerland

Angular, React, Vue and Co. peacefully united thanks to Web Components and Microfrontends @Voxxed Days Ticino 2019, Switzerland

Manfred Steyer

October 05, 2019
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @ManfredSteyer Angular, React, Vue and Co. peacefully united thanks to

    Web Components and Microfrontends Manfred Steyer SOFTWAREarchitekt.at ManfredSteyer
  2. @ManfredSteyer ✓ Commodore 64 ✓ 1982 ✓ ~ 1 MHz

    ✓ 64 KB RAM ✓ Disks with 170 KB
  3. @ManfredSteyer About me… • Manfred Steyer SOFTWAREarchitekt.at • Angular Trainings

    and Consultancy • Google Developer Expert (GDE) • Trusted Collaborator for Angular Page ▪ 9 Manfred Steyer Public: Frankfurt, Munich, Vienna In-House: everywhere http://www.softwarearchitekt.at/workshops
  4. @ManfredSteyer API class CustomerSelector extends HTMLElement { constructor() { super();

    this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<div>[…]</div>'; } […] }
  5. @ManfredSteyer API class CustomerSelector extends HTMLElement { constructor() { super();

    this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<div>[…]</div>'; } […] } customElements.define('customer-selector', CustomerSelector);
  6. @ManfredSteyer Deployment Monolith µService µService µService Client Fragment Client Fragment

    Client Fragment ✓ Easy (toling) ✓ One optimized bundle ✓ Consistent  No separate deployment  Mixing technologies: difficult  No real microfrontend architecture
  7. @ManfredSteyer ✓ Simple  Loosing State  Load a new

    Application  Consistent Look and Feel
  8. @ManfredSteyer µService Composing on Server-Side µFrontend µFrontend µFrontend Server-side process

    ▪ Works well for traditional web applications ▪ Optimized payload sizes ▪ Does not work well for SPAs
  9. @ManfredSteyer µService Providing a (SPA based) Shell µFrontend µFrontend µFrontend

    Client-side Shell ▪ iframes ▪ Bootstrapping several SPAs
  10. @ManfredSteyer µService µFrontend3 µFrontend 2 µFrontend1 Shell Web Components for

    Macro-Architecture Shared Widget Shared Widget Shared Widget Web Components for shared Widgets
  11. @ManfredSteyer Lazy Loading const script = document.createElement('script'); script.src = 'assets/micro-frontend-a.bundle.js';

    document.body.appendChild(script); const clientA = document.createElement('micro-frontend-a'); clientA['visible'] = true; document.body.appendChild(clientA);
  12. @ManfredSteyer Some General Advice Shared state, navigation b/w apps Hyperlinks

    Legacy Apps or *very very* strong isolation? iframes Separate Deployment/ mix Technologies? Web Components Monolith w/ Libs and Monorepo little much yes no yes no Not a good fit for public web sites
  13. @ManfredSteyer Blog > SOFTWAREarchitekt.at • A Software Architect's Approach Towards

    Using Angular (And SPAs In General) For Microservices Aka Microfrontends • Micro Apps With Web Components Using Angular Elements • Angular Elements: A dynamic Dashboard … • Angular, React, Vue.Js And Co. Peacefully United Thanks To Micro Apps And Web Components
  14. @ManfredSteyer Conclusion Web Components: Decoupling from your Framework Microfrontends: Decoupling

    b/w Teams & Projects Web Components + Micro App = ❤️ You have to evaluate!
  15. @ManfredSteyer Contact and Downloads [mail] [email protected] [web] SOFTWAREarchitekt.at [twitter] ManfredSteyer

    d Slides & Examples Public: Frankfurt, Munich, Vienna In-House: Everywhere http://www.softwarearchitekt.at/workshops