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

A Software Architect's Approach towards SPA-based Micro-Apps @voxxed days Microservices, Paris 2018

A Software Architect's Approach towards SPA-based Micro-Apps @voxxed days Microservices, Paris 2018

Angular and Micro Apps: Maintainable Client Architectures @IJS in Munich, October 2018

- npm Packages
- Monorepo
- Micro Apps w/ Hyperlinks
- Micro Apps w/ Shell

# Monorepo Example

# Micro Apps Example

# More Blog-Articles & Angular Trainings


Manfred Steyer

October 28, 2018


  1. @ManfredSteyer A Software Architect's Approach towards SPA-based Micro-Apps Manfred Steyer

    SOFTWAREarchitekt.at ManfredSteyer
  2. @ManfredSteyer About me… • Manfred Steyer • SOFTWAREarchitekt.at • Angular

    Trainings and Consultancy • Google Developer Expert (GDE) Page ▪ 2 Manfred Steyer Public: Vienna, München, Zürich In-House: everywhere http://softwarearchitekt.at/workshops
  3. @ManfredSteyer Ever build a client from the scratch? Kick-off After

    some weeks After some years
  4. @ManfredSteyer Idea System

  5. @ManfredSteyer Idea µService µService µService

  6. @ManfredSteyer Idea µService µService µService Single Page Application ??

  7. @ManfredSteyer Contents 1) Deployment Monolith 2) Hyperlinks 3) Shell 4)

    How to choose?
  8. @ManfredSteyer Deployment Monolith

  9. @ManfredSteyer Idea µService µService µService Client Fragment Client Fragment Client

    Fragment ✓ Easy (Tooling) ✓ One optimized Bundle ✓ Consistent  No separate deployment  Mixing Technologies: Difficult npm Packages ?
  10. @ManfredSteyer Structure of an npm-Package • /node_modules • your-stuff •

  11. @ManfredSteyer Publish Library npm publish --registry http://localhost:4873 Alternative: .npmrc file

    in project root
  12. @ManfredSteyer npm Registries Nexus Artifactory Team Foundation Server Verdaccio npm

    i -g verdaccio verdaccio
  13. @ManfredSteyer Advantages • Distribution • Versioning

  14. @ManfredSteyer Disadvantages • Distribution • Versioning ;-)

  15. @ManfredSteyer Disadvantages Distribution • Annoying within project Versioning • Old

    versions • Conflicts • How to force devs to use latest version?
  16. @ManfredSteyer Monorepo

  17. @ManfredSteyer Workspace

  18. @ManfredSteyer Advantages Everyone uses the latest versions No version conflicts

    No burden with distributing libs Creating new libs: Adding folder Experience: Successfully used at Google, Facebook, …
  19. @ManfredSteyer Moving back and forth Npm Registry

  20. @ManfredSteyer DEMO

  21. @ManfredSteyer Advantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project
  22. @ManfredSteyer Disadvantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project
  23. @ManfredSteyer Disadvantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project Team A Team B Contract
  24. @ManfredSteyer Disadvantages One Architecture One Technology Stack Hard to change

    No self- contained teams One size fits all?
  25. @ManfredSteyer 2) Hyperlinks

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

  27. @ManfredSteyer

  28. @ManfredSteyer

  29. @ManfredSteyer ✓ Simple  Loosing State  Load a new

  30. @ManfredSteyer Web Components for Shared Widgets?

  31. @ManfredSteyer Framework independent Components

  32. @ManfredSteyer

  33. @ManfredSteyer Can be pollyfilled down to IE11

  34. @ManfredSteyer 3) Shell

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

    Shell ▪ iframes ▪ Bootstrapping several SPAs ▪ + Lazy Loading
  36. @ManfredSteyer Wrap µApps into Web Components • Not a typical

    web component! • But: Unified API for Shell • Nesting
  37. @ManfredSteyer Loading MicroApps <script src="micro-app.bundle.js"></script> <micro-app></micro-app>

  38. @ManfredSteyer Communication between Micro Apps <client-a [state]="appState" (message)="handle($event)"></client-a> <client-b [state]="appState"

    (message)="handle($event)"></client-b> JavaScript in Shell
  39. @ManfredSteyer DEMO

  40. @ManfredSteyer Advantage • Several small and decoupled Projects

  41. @ManfredSteyer Disadvantages • Several small and decoupled Projects ;-) •

    More Bundles • Less optimized Bundles/ duplicate Code? • UI Consistency
  42. @ManfredSteyer 4) Choosing a Solution

  43. @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
  44. @ManfredSteyer Architecture within Micro-Apps Packages Web Components Monorepo Inner Sourcing

  45. @ManfredSteyer Blog > SOFTWAREarchitekt.at • A Software Architect's Approach Towards

    Using Angular (And SPAs In General) For Microservices Aka Microfrontends • A Lightweight And Solid Approach Towards Micro Frontends (Micro Service Clients) With Angular And/Or Other Frameworks • Micro Apps With Web Components Using Angular Elements
  46. @ManfredSteyer Conclusion Monorepo Hyper Links Shell You need to evaluate

  47. @ManfredSteyer Beware the Frankenstein- Monster on the client too!

  48. @ManfredSteyer Contact and Downloads [mail] manfred.steyer@SOFTWAREarchitekt.at [web] SOFTWAREarchitekt.at [twitter] ManfredSteyer

    d http://softwarearchitekt.at/workshops Slides & Examples