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

Sustainable Client Architectures with Micro Apps

Sustainable Client Architectures with Micro Apps

15934fa2aa7b2ce21f091e9b7cffa856?s=128

Manfred Steyer
PRO

December 03, 2018
Tweet

Transcript

  1. @ManfredSteyer Sustainable Client Architectures with Micro Apps Manfred Steyer SOFTWAREarchitect.io

    ManfredSteyer
  2. @ManfredSteyer About me… • Manfred Steyer • SOFTWAREarchitect.io • Angular

    Trainings and Consultancy • Google Developer Expert (GDE) Page ▪ 4 Manfred Steyer Public and In-House http://softwarearchitect.io/workshops
  3. @ManfredSteyer ✓ Commodore 64 ✓ 1982 ✓ ~ 1 MHz

    ✓ 64 KB RAM ✓ Disks with 170 KB
  4. @ManfredSteyer Version with two cores ;-) Challenge: Resources!

  5. @ManfredSteyer Challenges today: Complexity

  6. @ManfredSteyer Coordination b/w teams

  7. @ManfredSteyer Long Time Maintain- ability Maintain + Extend for 10+

    yrs
  8. @ManfredSteyer There are milk products lasting longer than some JavaScript

    frameworks
  9. @ManfredSteyer Contents 1) Micro Apps with JavaScript 2) DEMO 3)

    Recipes 4) Evaluation
  10. @ManfredSteyer 1) Micro Apps with JavaScript

  11. @ManfredSteyer Idea System Team A Team B Framework Architecture Maintainability?

    Hard to change!
  12. @ManfredSteyer Idea µService µService µService

  13. @ManfredSteyer Idea µApp µApp µApp

  14. @ManfredSteyer Folie▪ 16 Pro Contra

  15. @ManfredSteyer UI Composition w/ Hyperlinks µApp SPA µApp SPA µApp

    SPA <a href="…>…</a> <a href="…>…</a>
  16. @ManfredSteyer ✓ Simple  Loosing State  Load a new

    Application  Consistent Look and Feel
  17. @ManfredSteyer

  18. @ManfredSteyer Web Components for Shared Widgets?

  19. @ManfredSteyer Framework independent Components

  20. @ManfredSteyer Can be pollyfilled down to IE11

  21. @ManfredSteyer µService Providing a (SPA based) Shell µApp µApp µApp

    Shell ▪ iframes ▪ Bootstrapping several SPAs ▪ Consider Lazy Loading!
  22. @ManfredSteyer Common Interface for µApps • Shell should not know

    details of µApp and used Frameworks! • µApp provides events • µApp consumes events • Wrap µApp as Web Component?
  23. @ManfredSteyer 2) DEMO

  24. @ManfredSteyer µService µApp3 µApp2 µApp1 Shell Web Components for Shell-Architecture

    Shared Widget Shared Widget Shared Widget Web Components for shared Widgets
  25. @ManfredSteyer 3) Recipes

  26. @ManfredSteyer Communication

  27. @ManfredSteyer Communication b/w Web Components <client-a state="appState" message="handle(event)"></client-a> <client-b state="appState"

    message="handle(event)"></client-b> JavaScript in Shell
  28. @ManfredSteyer Routing

  29. @ManfredSteyer Routing /client-a/this/that /client-b/this/that /client-c/this/that :

  30. @ManfredSteyer Routing /client-a/this/that /client-b/this/that /client-c/this/that :

  31. @ManfredSteyer Lazy Loading

  32. @ManfredSteyer Lazy Loading const content = document.getElementById('content');

  33. @ManfredSteyer Lazy Loading const content = document.getElementById('content'); // Add script-Tag

    const script = document.createElement('script'); script.src = [...]; content.appendChild(script);
  34. @ManfredSteyer Lazy Loading const content = document.getElementById('content'); // Add script-Tag

    const script = document.createElement('script'); script.src = [...]; content.appendChild(script); // Add Element const element: HTMLElement = document.createElement('client-a'); element.addEventListener('message', (event) => [...]); element.setAttribute('appState', [...]); content.appendChild(element);
  35. @ManfredSteyer Bundling

  36. @ManfredSteyer Bundles Custom Element 1 Custom Element 2 Custom Element

    3 Libraries: Angular, Bootstrap, … Libraries: Angular, Bootstrap, …
  37. @ManfredSteyer Compiling down to JavaScript (more or less) e. g.

    w/ Stencil, Angular Ivy Custom Element 1 Custom Element 2 Custom Element 3
  38. @ManfredSteyer Sharing Libs Custom Element 1 Custom Element 2 Custom

    Element 3 Libraries: Angular, Bootstrap, … UMD Drawbacks: Complexity, no isolation
  39. @ManfredSteyer 4) Choosing a Solution

  40. @ManfredSteyer Some General Advice Shared state, navigation b/w apps Hyperlinks

    Legacy Apps or *very very* strong isolation? iframes Separate Deployment/ mix Technologies? Bootstrap several SPAs Monorepo little much yes no yes no Not a good fit for public web sites Wrap as Web Component?
  41. @ManfredSteyer Blog > SOFTWAREarchitect.io • 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
  42. @ManfredSteyer Conclusion Micro App: Decoupling b/w Teams & Projects Best

    Technology for your current project Web Components + Micro App = ❤️ You need to evaluate!
  43. @ManfredSteyer Contact and Downloads [mail] manfred.steyer@SOFTWAREarchitect.io [web] SOFTWAREarchitect.io [twitter] ManfredSteyer

    d Slides & Examples