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

Angular Application Architecture for big Enterp...

Angular Application Architecture for big Enterprise Solutions, Talk at ngFranken, Nuremberg, March 2017

Manfred Steyer

March 22, 2018
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. About me… • Manfred Steyer • SOFTWAREarchitekt.at • Angular Trainings

    and Consultancy • Google Developer Expert (GDE) Page ▪ 2 Manfred Steyer
  2. @ManfredSteyer Typical Module Structure Page ▪ 3 AppModule … …

    … SharedModule Root Module Feature Modules Shared Module
  3. @ManfredSteyer Publishing to npm Registry • Increment version in lib/package.json

    • npm version [patch | minor | major | version] • npm run build:lib • cd ../dist/lib • npm publish --registry http://localhost:4873 • npm install --registry http://localhost:4873
  4. @ManfredSteyer Locale npm-Registry • Team Foundation Server • Nexus •

    Artifactory • Verdaccio • Very lightweight • npm i -g verdaccio • Start: verdaccio
  5. @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?
  6. @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, …
  7. @ManfredSteyer Two Flavors • Like Workspaces/Solutions in different IDEs Project

    Monorepo • E. g. used at Google or Facebook Company-wide Monorepo
  8. @ManfredSteyer Usage npm install -g @nrwl/schematics npm install -g @angular/cli

    create-nx-workspace myworkspace ng generate app myapp ng generate lib mymodule ng serve --app=myapp ng generate component myButton --app=mymodule ng build --app=myapp
  9. @ManfredSteyer Reference Library from App/ other Library import {FlightService} from

    '@flight-workspace/flight-api'; Alias; Points to ../lib or to installed node_module
  10. @ManfredSteyer Some Options for Shell iframes • Strong Isolation •

    Straight forward • Overlapping Elements? • Lot's of page requests? Web Components • Standard • Custom Elements • <app-a></app-a> • <app-b></app-b> • Shadow DOM: CSS Isolation • Framework Support? Bootstrapping different SPAs • Similar to Web Components • No Standard
  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 best fit when customer facing Fallback: Bootstrap several frameworks/ Spa Micro-Architecture: Mix and match options: • 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?