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

Sustainable Architectures with Angular, Monorepos and DDD @wjax 2019 in Munich

Sustainable Architectures with Angular, Monorepos and DDD @wjax 2019 in Munich

Manfred Steyer

November 06, 2019
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @ManfredSteyer Contents 1) Strategic DDD in a Nutshell 2) Angular

    Monorepos 3) Monorepos & DDD 4) DDD & Micro Frontends
  2. @ManfredSteyer About me… • Manfred Steyer SOFTWAREarchitekt.at • Angular Trainings

    and Consultancy • Google Developer Expert (GDE) • Trusted Collaborator in the Angular Team Page ▪ 9 Manfred Steyer Public: Frankfurt, Munich, Vienna In-House: everywhere http://softwarearchitekt.at/workshops
  3. @ManfredSteyer Creating a Workspace npm install -g @angular/cli ng new

    workspace cd workspace ng generate app my-app ng generate lib my-lib ng serve --project my-app ng build --project my-app
  4. @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, …
  5. @ManfredSteyer Catalog Ordering 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 Smart Comp. Dumb Comp.
  6. @ManfredSteyer Catalog Ordering 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
  7. @ManfredSteyer Catalog Ordering 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
  8. @ManfredSteyer Application Domain Infrastructure Isolate your domain! Domain Domain Infrastructure

    e. g. data access Application Use case specific facades, state management Entities, biz logic
  9. @ManfredSteyer Alternatives to layering • e. g. Hexagonal Architecture, Clean

    Architecture • Anyway: We need to restrict access b/w libraries
  10. @ManfredSteyer Finegrained Libraries • Unit of recompilation • Unit of

    retesting • Access restrictions • Prevent Cycles • Information Hiding • Future replacement for NgModules?
  11. @ManfredSteyer Facade (Application Service) @Injectable({ providedIn: 'root' }) export class

    ProductFacade { public products: Product[] = []; […] } State!
  12. @ManfredSteyer Facade (Application Service) @Injectable({ providedIn: 'root' }) export class

    ProductFacade { public products: Product[] = []; constructor(private productService: ProductService) { } […] }
  13. @ManfredSteyer Facade (Application Service) @Injectable({ providedIn: 'root' }) export class

    ProductsFacade { public products: Product[] = []; constructor(private productService: ProductService) { } search(category: string): void { […] } }
  14. @ManfredSteyer Facade (Application Service) @Injectable({ providedIn: 'root' }) export class

    ProductFacade { public products: Product[] = []; constructor(private productService: ProductService) { } search(category: string): void { […] } } Angular has to pull :-(
  15. @ManfredSteyer Facade (Application Service) @Injectable({ providedIn: 'root' }) export class

    ProductFacade { public products: Observable<Product[]>; constructor(private productService: ProductService) { } search(category: string): void { […] } } Also key for messaging
  16. @ManfredSteyer Catalog Ordering Shared Feature Feature Feature Feature Feature …

    … … … … … … … … @ManfredSteyer e-Procurement App Deployment Monolith
  17. @ManfredSteyer Catalog Ordering Shared Feature Feature Feature Feature Feature …

    … … … … … … … … @ManfredSteyer Catalog App Ordering App Option 1: One App per Domain
  18. @ManfredSteyer Catalog Ordering Shared Feature Feature Feature Feature Feature …

    … … … … … … … … @ManfredSteyer Catalog App Ordering App Option 2: One Monorepo per Domain Publish shared libs seperately via npm Different Versions
  19. @ManfredSteyer Summary Slicing into sub-domains Slicing into layers Relaxed layering

    Finegrained libraries Enforce restrictions Fits to micro frontends
  20. @ManfredSteyer Contact and Downloads [mail] [email protected] [web] SOFTWAREarchitekt.at [twitter] ManfredSteyer

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