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

Slides from jsconf.be 2018 in Belgium: A Software Architect's Approach towards SPA-Based Microfrontends

Slides from jsconf.be 2018 in Belgium: A Software Architect's Approach towards SPA-Based Microfrontends

Manfred Steyer

May 29, 2018
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @BASTAcon & @ManfredSteyer About me… • Manfred Steyer • SOFTWAREarchitekt.at

    • Angular Trainings and Consultancy • Google Developer Expert (GDE) Page ▪ 2 Manfred Steyer Munich: Summer In-House: Every time
  2. @ManfredSteyer Publishing to npm Registry • Increment version in package.json

    • npm version [patch | minor | major | version] • ng build --project logger-lib • npm publish --registry http://localhost:4873 • npm install --registry http://localhost:4873
  3. @ManfredSteyer Alternatives for setting the Registry • Global: npm set

    registry http://localhost:4873 • Default: registry.npmjs.org • npm get registry • Project: .npmrc in project root
  4. @ManfredSteyer Disadvantages Distribution • Annoying within project • Prevents gritting

    further libs Versioning • Old versions • Conflicts • How to force devs to use latest version? Decoupling • What if lib authors == app authors?
  5. @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, …
  6. @ManfredSteyer Advantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project
  7. @ManfredSteyer Disadvantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project Team A Team B Contract
  8. @ManfredSteyer Disadvantages More Coordination Blocking Tasks Complex Overall System One

    Architecture One Technology Stack Hard to change One size fits all?
  9. @ManfredSteyer Some Options for Shells iframes ✓ Strong Isolation ✓

    Straight forward  Overlapping Elements?  Lots of page requests?  SEO? Web Components  Standard  Custom Elements  <app-a></app-a>  <app-b></app-b>  Shadow DOM: CSS Isolation  Nesting  Framework Support? Bootstrapping different SPAs ✓ Similar to Web Components  No Standard  Nesting isn’t possible
  10. @ManfredSteyer Loading MicroApps as Web Components <script src="micro-app-a.bundle.js"></script> <script src="micro-app-b.bundle.js"></script>

    <micro-app-a></micro-app-a> <micro-app-b></micro-app-b> Fallback: Load different Spas here Lazy Loading
  11. @ManfredSteyer Some General Advice for Macro-Architecture Shared state, communication/ navigation

    b/w apps Hyperlinks Legacy Apps or *very very* strong isolation needed? iframes Need separate Deployment/ mix Technologies Web Components "Majestic Monolith" w/ Libs and Monorepo little much yes no yes no Not a good fit for customer facing Micro-Architecture: • Libs/ npm packages • Monorepo • Web Components • …
  12. @ManfredSteyer Blog • 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 • Microservice Clients With Web Components Using Angular Elements: Dreams Of The (Near) Future?