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

Architectures for you big Angular applications: npm-Packages, Monorepos, and Microfrontends @DevWeek 2019 in Nuremberg

Architectures for you big Angular applications: npm-Packages, Monorepos, and Microfrontends @DevWeek 2019 in Nuremberg

Manfred Steyer

June 25, 2019
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @ManfredSteyer Architectures for you big Angular applications: npm-Packages, Monorepos, and

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

    and Consultancy • Google Developer Expert (GDE) • Trusted Collaborator for Angular Team Page ▪ 4 Manfred Steyer In-House: everywhere! Public: Wien - München - Frankfurt http://softwarearchitekt.at/workshops
  3. @ManfredSteyer Why Packages? Sub Project Sub Project Sub Project Sub

    Project Sub Project Sub Project Sub Project Sub Project
  4. @ManfredSteyer Create Packages with CLI >= 6 npm install -g

    @angular/cli ng new lib-project cd lib-project ng generate library flight-booking-lib ng generate application playground-app ng serve --project playground-app ng build --project flight-booking-lib
  5. @ManfredSteyer Publishing to npm Registry • Increment version in package.json

    • ng build --project flight-booking-lib • npm publish --registry http://localhost:4873 • npm install --registry http://localhost:4873
  6. @ManfredSteyer Alternatives for setting the Registry • Global: npm set

    registry http://localhost:4873 • Project: .npmrc in project root
  7. @ManfredSteyer Disadvantages Distribution • Annoying within project • Prevents gritting

    further libs Versioning • Old versions • Conflicts • How to force devs to use latest version?
  8. @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, …
  9. @ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature UI

    UI UI UI UI UI UI UI UI Domain Domain Domain Domain Domain Domain Util Util Util Util Util Util Enterprise Monorepo Patterns, Nrwl 2018: https://tinyurl.com/y2jjxld7 @ManfredSteyer Shared Kernel (if really needed) & other libs
  10. @ManfredSteyer Booking Boarding Shared Feature API Feature Feature Feature Feature

    UI UI UI UI UI UI UI UI UI Domain Domain Domain Domain Domain Domain Util Util Util Util Util Util @ManfredSteyer
  11. @ManfredSteyer Finegrained Libraries • Unit of recompilation • Unit of

    retesting • Access restrictions • Prevent Cycles • Information Hiding • Future replacement for NgModules?
  12. @ManfredSteyer Advantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project
  13. @ManfredSteyer Disadvantages Sub Project Sub Project Sub Project Sub Project

    Sub Project Sub Project Sub Project Sub Project Team A Team B Contract Maintainability? One Architecture/ One Framework
  14. @ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …

    … … … … … … … … @ManfredSteyer Booking App Boarding App Option 1: One App per Domain
  15. @ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …

    … … … … … … … … @ManfredSteyer Booking App Boarding App Option 2: One Monorepo per Domain Publish shared libs seperately via npm
  16. @ManfredSteyer UI Composition w/ Hyperlinks µApp SPA µApp SPA µApp

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

    Application  Consistent Look and Feel
  18. @ManfredSteyer µService Providing a (SPA based) Shell µApp µApp µApp

    Shell ▪ iframes ▪ Bootstrapping several SPAs ▪ Consider Lazy Loading!
  19. @ManfredSteyer Advantages • Several small and decoupled Projects • Autarkic

    Teams • Seperate development/ deployment • Own decisions (technology, architecture)
  20. @ManfredSteyer Disadvantages ;-) • Several small and decoupled Projects •

    Autarkic Teams • Seperate development/ deployment • Own decisions (technology, architecture)
  21. @ManfredSteyer Macro Architecture 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
  22. @ManfredSteyer Blog > SOFTWAREarchitekt.at • Sustainable Angular Architectures With Strategic

    Design And Monorepos • 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
  23. @ManfredSteyer Contact and Downloads [mail] [email protected] [web] SOFTWAREarchitekt.at [twitter] ManfredSteyer

    d http://softwarearchitekt.at/workshops In-House: Everywhere Public: Wien - München - Frankfurt Slides & Examples