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

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

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

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

# Library Example
https://github.com/manfredsteyer/logger_lib_sample

# Monorepo Example
https://github.com/manfredsteyer/monorepo-demo

# Micro Apps Example
https://github.com/manfredsteyer/Angular_MicroApps_Different_Technologies

# More Blog-Articles & Angular Trainings
https://www.softwarearchitekt.at

Manfred Steyer

October 16, 2018
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. @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
  2. @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 ?
  3. @ManfredSteyer Create npm-Packages with CLI >= 6 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
  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 µService Providing a (SPA based) Shell µApp µApp µApp

    Shell ▪ iframes ▪ Bootstrapping several SPAs ▪ Wrap them into Web Components?
  9. @ManfredSteyer MicroApp with Angular Elements @NgModule({ imports: [BrowserModule], declarations: [MicroAppComponent],

    bootstrap: [], entryComponents: [MicroAppComponent] }) export class AppModule { }
  10. @ManfredSteyer MicroApp with Angular Elements @NgModule({ imports: [BrowserModule], declarations: [MicroAppComponent],

    bootstrap: [], entryComponents: [MicroAppComponent] }) export class AppModule { }
  11. @ManfredSteyer MicroApp with Angular Elements @NgModule({ imports: [BrowserModule], declarations: [MicroAppComponent],

    bootstrap: [], entryComponents: [MicroAppComponent] }) export class AppModule { constructor(private injector: Injector) { } ngDoBootstrap() { } }
  12. @ManfredSteyer MicroApp with Angular Elements @NgModule({ imports: [BrowserModule], declarations: [MicroAppComponent],

    bootstrap: [], entryComponents: [MicroAppComponent] }) export class AppModule { constructor(private injector: Injector) { } ngDoBootstrap() { const MicroAppElement = createCustomElement( MicroAppComponent, { injector: this.injector }); customElements.define('micro-app', MicroAppElement); } }
  13. @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
  14. @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