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

Maintainable Client Architecture w/ Micro-Apps and Angular Elements

Maintainable Client Architecture w/ Micro-Apps and Angular Elements

Manfred Steyer

July 04, 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://www.angular-college.com/landing
  2. @ManfredSteyer ✓ Commodore 64 ✓ 1982 ✓ ~ 1 MHz

    ✓ 64 KB RAM ✓ Disks with 170 KB
  3. @ManfredSteyer µService Providing a (SPA based) Shell µApp µApp µApp

    Shell ✓ iframes ✓ Bootstrapping several SPAs ✓ Web Components
  4. @ManfredSteyer Custom Elements Own HTML-Element, e. g. <date-picker> Behaves like

    build-in ones Write w/ one framework; consume with other ones Can be polyfilled down to IE 11
  5. @ManfredSteyer "Shady" DOM Emulation for older Browsers Parent can influence

    Component's layout Component cannot influence Parent or Siblings
  6. @ManfredSteyer µService µApp3 µApp2 µApp1 Shell Web Components for Macro-Architecture

    Shared Widget Shared Widget Shared Widget Web Components for Micro-Architecture
  7. @ManfredSteyer Shadow DOM • Baked-in • Shady DOM • @Component({

    encapsulation: ViewEncapsulation.Emulated }) • Default • Shadow DOM • @Component({ encapsulation: ViewEncapsulation.Native }) • Can be turned off: • @Component({ encapsulation: ViewEncapsulation.None })
  8. @ManfredSteyer MicroApp as Angular Elements @NgModule({ imports: [BrowserModule], declarations: [MicroAppComponent],

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

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

    bootstrap: [], entryComponents: [MicroAppComponent] }) export class AppModule { constructor(private injector: Injector) { } ngDoBootstrap() { } }
  11. @ManfredSteyer MicroApp as 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); } }
  12. @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