Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Angular-basierte Micro Frontends mit Module Fed...
Search
Manfred Steyer
PRO
June 20, 2022
Programming
0
330
Angular-basierte Micro Frontends mit Module Federation @API Summit
Manfred Steyer
PRO
June 20, 2022
Tweet
Share
More Decks by Manfred Steyer
See All by Manfred Steyer
Effective Signals in Angular 19+: Rules and Helpers
manfredsteyer
PRO
0
700
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
400
Your Architecture as a Crime Scene: Improvements with Forensic Analysis
manfredsteyer
PRO
0
22
Micro Frontends Unmasked Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
410
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
270
Your Architecture as a Crime Scene: Improvements with Forensic Analysis @ijs Munich 2024
manfredsteyer
PRO
0
330
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
170
Micro Frontends Unmasked: Opportunities, Challenges, Alternatives @w-jax 2024 München
manfredsteyer
PRO
0
170
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
170
Other Decks in Programming
See All in Programming
2024年のWebフロントエンドのふりかえりと2025年
sakito
1
230
“あなた” の開発を支援する AI エージェント Bedrock Engineer / introducing-bedrock-engineer
gawa
11
1.8k
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
890
Amazon Bedrock Multi Agentsを試してきた
tm2
1
280
iOSエンジニアから始める visionOS アプリ開発
nao_randd
3
120
バックエンドのためのアプリ内課金入門 (サブスク編)
qnighy
8
1.7k
Spring gRPC について / About Spring gRPC
mackey0225
0
220
CI改善もDatadogとともに
taumu
0
110
お前もAI鬼にならないか?👹Bolt & Cursor & Supabase & Vercelで人間をやめるぞ、ジョジョー!👺
taishiyade
5
3.8k
富山発の個人開発サービスで日本中の学校の業務を改善した話
krpk1900
4
370
SwiftUI Viewの責務分離
elmetal
PRO
0
150
『GO』アプリ バックエンドサーバのコスト削減
mot_techtalk
0
130
Featured
See All Featured
Music & Morning Musume
bryan
46
6.3k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Designing for Performance
lara
604
68k
Raft: Consensus for Rubyists
vanstee
137
6.8k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
8
270
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
4 Signs Your Business is Dying
shpigford
182
22k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7.1k
Product Roadmaps are Hard
iamctodd
PRO
50
11k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
Transcript
@BASTAcon & @ManfredSteyer Angular-basierte Micro Frontends mit Module Federation
@ManfredSteyer Goal Learn how to build Frontend Moduliths and Micro
Frontends
@ManfredSteyer Contents • Frontend Moduliths • Nx Monorepos • Strategic
Design and DDD • Micro Frontends • Module Federation • Web Components
@ManfredSteyer Manfred Steyer
@ManfredSteyer
@ManfredSteyer Monorepo Structure
@ManfredSteyer Advantages Everyone uses the latest versions No version conflicts
No burden with distributing libs
@ManfredSteyer Two Flavors • Like Workspaces/Solutions in different IDEs Project
Monorepo • E. g. used at Google or Facebook Company-wide Monorepo
@ManfredSteyer Moving back and forth Npm Registry
@ManfredSteyer Tooling & Generator https://nrwl.io/nx Smart, Fast and Extensible Build
System
@ManfredSteyer Visualize Module Structure
@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
@ManfredSteyer Creating a Workspace npm install -g @angular/cli npm init
nx-workspace workspace cd workspace ng generate app my-app ng generate lib my-lib ng serve --project my-app ng build --project my-app
@ManfredSteyer DEMO
@ManfredSteyer DDD in a nutshell
@ManfredSteyer Methodology for bridging the gap b/w requirements and architecture/
design
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Domain Driven Design Strategic Design Tactical Design Decomposing a
System Design Patterns & Practices
@ManfredSteyer Domain Driven Design Strategic Design Tactical Design Decomposing a
System Design Patterns & Practices
@ManfredSteyer
@ManfredSteyer Example Flight System
@ManfredSteyer Booking Check-in Boarding Luggage Example Sub-Domains
@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 Smart Comp. Dumb Comp.
@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
@ManfredSteyer DEMO
@ManfredSteyer
@ManfredSteyer Finegrained Libraries • Unit of recompilation • Unit of
retesting • Access restrictions • Information Hiding • Easy: Just ng g lib … • Future replacement for NgModules?
@ManfredSteyer Micro Frontends? Short outlook
@ManfredSteyer Booking App Check-in App Boarding App Luggage App Microfrontends
@ManfredSteyer
@ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …
… … … … … … … … @ManfredSteyer Flight App Deployment Monolith
@ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …
… … … … … … … … Booking App Boarding App Microfrontends
@ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …
… … … … … … … … Booking App Boarding App Option 1: One App per Domain Monorepo
@ManfredSteyer Booking Boarding Shared Feature Feature Feature Feature Feature …
… … … … … … … … Booking App Boarding App Option 2: One Monorepo per Domain Publish shared libs seperately via npm Repository n Repository 2 Repository 1
@ManfredSteyer Benefits Autonomous Teams Separate Development Separate Deployment Own architecture
decisions Own technology descisions
@ManfredSteyer Integration via Hyperlinks
@ManfredSteyer UI Composition w/ Hyperlinks µApp SPA µApp SPA µApp
SPA
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Integration via Shell
@ManfredSteyer µService Providing a (SPA based) Shell µApp µApp µApp
Shell
@ManfredSteyer
@ManfredSteyer Idea const Component = import('http://other-app/xyz') Does not work with
webpack/ Angular CLI Even lazy parts must be known at compile time!
@ManfredSteyer Webpack 5 Module Federation Shell (Host) Microfrontend (Remote) //
Maps Urls in // webpack config remotes: { mfe1: "http://..." } // Expose files in // webpack config exposes: { Cmp: './my.cmp.ts' } import('mfe1/Cmp')
@ManfredSteyer How to Get the Microfrontend's URL? Shell (Host) Microfrontend
(Remote) RemoteEntrypoint.js <script src="…"></script>
@ManfredSteyer How to Share Libs? Shell (Host) Microfrontend (Remote) shared:
[ "@angular/core", "…" ] shared: [ "@angular/core", "…" ]
@ManfredSteyer
@ManfredSteyer Default Behavior Selecting the highest compatible version 10.0 10.1
@ManfredSteyer Default Behavior Conflict: No highest compatible version 11.0 10.1
@ManfredSteyer Configuring Singletons shared: { "my-lib": { singleton: true }
} 11.0 10.1
@ManfredSteyer Configuring Singletons shared: { "my-lib": { singleton: true, strictVersion:
true // Error instead of warning! } } 11.0 10.1
@ManfredSteyer Relaxing Version Requirements shared: { "my-lib": { requiredVersion: ">=1.0.1
<11.1.1" } }
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer 1) npm i @angular-architects/module-federation -D 2) ng g @angular-architects/module-federation:init
3) Adjust generated configuration 4) ng serve
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Wrap them into Web Components Angular App (MFE) React
App (MFE)
@ManfredSteyer
@ManfredSteyer const Component = await import('other-app/cmp');
@ManfredSteyer const main = await import('other-app/main'); main.bootstrap();
@ManfredSteyer const main = await import('other-app/main'); main.bootstrap(); const rootElm =
document.createElement('app-root') document.body.appendChild(rootElm);
@ManfredSteyer await import('other-app/main'); // Self-Bootstrapping const rootElm = document.createElement('app-root') document.body.appendChild(rootElm);
@ManfredSteyer await import('other-app/main'); const rootElm = document.createElement('app-root') document.body.appendChild(rootElm); WrapperComponent
@ManfredSteyer
@ManfredSteyer https://red-ocean-0fe4c4610.azurestaticapps.net
@ManfredSteyer Challanges • Bundle Size • Multiple Routers • Bootstrapping
Several Angular Instances • Share Platform-Object when same version is reused • Share ngZone
@ManfredSteyer
@ManfredSteyer DEMO
@ManfredSteyer Choosing a Solution
@ManfredSteyer Some General Advice Shared state, navigation b/w apps Hyperlinks
Legacy Apps or *very very* strong isolation? iframes Separate Deployment/ mix Technologies? Load Bundles on Demand Monolith little much yes no yes no Module Federation