"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov
Demystifying
Is an architectural approach. That comes from the Back-End world and for now
adopted for MFE.
Monolith
SPA SPA
Monolith
Microservices Microservices
Microfronends
Front-end
Back-end
Any organization that designs a system (defined broadly) will produce a design
whose structure is a copy of the organization's communication structure.
Conway’s Law
Melvin E. Conway
It’s all about scaling and adding new teams
Team C
Team B
Team A git
git
git
own
environment
CAN BE TESTED
INDEPENDENTLY
INTEGRATION / VISUAL  E2E TESTS
DEVELOP
DEVELOP
DEVELOP
own
environment
own
environment
// Independent Releases and Deployments
// Automous Development
// Model Around Business Domains
// Framework Agnostic and Technology Independent
// Can be simply deleted or replaced by other component
// Can be easily embbeded
// Encapsulation
Benefits of Microfrontends
// Sustainability
// Fast release cycle, independent deploys
// High expertise in domain-based cross-functional teams
// Autonomous development
// Component-oriented testing
Maybe you already have
a working project?
So maybe you will need:
// Performance: no overhead in network requests or JS size
// No code duplication
// Encapsulation level
// Iteratively move on new technology, do not stop working business
// So depends on previous point it might be easy to embed
// Do not lack in development experience
// Highly configurable front-end, feature-flags, predicate system, AB testing
Examples
// Authorisation and Registration Widgets
Mostly any part of application, or page
might be a modularized. Depends on your
domains and philosophy of decomposition
// Personal user cabinet
// Payments Page
Microfrontends is a subdomain
representation on FE
// Strict boundaries
// Clean and stable contracts
// No shared logic with another domains
// Independent and release cycles with fault tolerance
Modules
Decomposition Decoupling
// Independent/Self-contained (Low Coupling): A module
has to be as detached from other dependencies as possible.
// Specific (High Cohesion): Elements within one class/module
should functionally belong together and do one particular thing.
// Reusable: A module has to be easy to integrate into various
kinds of programs to perform its task
Big Picture
Before
Backend
After
.JS .CSS
Business
Logistic
Shell
Shell
Microfrontend
Microfrontend
Microfrontend
Microfrontend
Microfrontend
And it’s all united in one environment under
one resource
How can we orchestrate it?
Build Time (From Different Packages) - not true, you got a
single release point
Server Side - seems quite good, but you need team with
knowledge in at least SSI or some alternative to compose you
FE on BE, it may be some additional semi BE framework.
Client Side - True way for real frontenders, just joking, we are
the engineers and must to know a lot. Incredible scaling. A root
application that dynamically loads each independently
deployed web application
Just a few players: Single SPA, Piral, Mosaic9, ILC, Open Com-
ponents, Bit.
Orchestration Strategies
Build Time
Integration
Browser
Server
Build&Deploy
Repository
Server Side
Integration
Runtime
Integration
Microfrontends Basic Suite Kit
// Shell. Routing. Orchestrating. Configurations manifest with list
of resources to load
// Module. (.render method to embed it somewhere)
// Some Way of Communication between them - of course
Event Based. Pull Based or Push Based
Do not couple business subdomains!
// Contracts IN
// Contracts OUT
Just a basics of components
Event Bus
Lifecycle Hoks
Internal State
Properties
Own Dependencies Shared Dependencies
Events
Integration Layer
Business Domain-related Component
Modules in Front-End
Simple .js scripts
and functions
(IIFE module
pattern)
AMD | UMD ES6 Modules Custom modules
system (build
toolings such as
webpack, systemjs
with import maps,
etc.)
IIFE - the grandpa of modules
Technically you can just create and simple
functions with some properties in it, write
some CSS, set it as static somewhere on CDN,
and add it into your apps.
Implement you render or mount method to stick
into DOM or attach to something.
Handle some properties, bubble some events,
profit?
It’s an old Jquery Plugins. But just imagine that it is more
complex app, not a part of UI kit or UI library
Bundlers, transpilers, frameworks to handle it all, we wrote our routing
soluitions.
So you will need to create some ".render, .mount” methods, provide
wrappers, lifecycle hooks, handle the code duplication by yourself,
tracking the versions mismatches, care about islolation and encapsula-
tion…
Approaches that we faced. Runtime integration
iFrames
Module
Federation
WebComponents
+ ES6 modules
iFrames
// First class encapsulation
// Own window and globals (DOM)
// Easy to embed on page
// Can be lazy loaded
// Control and restricted over access to internals
// Communication through window.postMessage events
Deployments and Autonomous Development
Fully
independent
deployments
Fully
framework-
agnostic
solution
Drawbacks
No code
duplication
control
Got limited
view to render
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov
Federated Modules part
// Our case: Monolith with 2y/o react/redux-observables codebase
// From 11 to 15-20 teams
// From 10 to 100 engineers
// Highly configurable product with a lot of dynamics load,
AB tests and feature flags
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov
Module Federation
// Provide Loading chunks and webpack modules from different hosts
// Natively feels like working with dynamic imports, same API, promises
and modules with low-level webpack modules code.
// Best fit for teams that develops around webpack, and had similar tech
stack around company (Only React/Preact, Angular, Vue etc.).
// You need to handle encapsulation by yourself.
// Linting and conventions must help
Module Federation Basics
RemoteEntry - IOC container
Code Duplication
We can share dependencies and we need to mark em as shared
in different modules and shell itself
Default Strategy based on Sem Ver.
v1.2
will not be loaded will be loaded
v1.5
Default Strategy based on Sem Ver.
L O A D I N G...
v2.2
will be loaded will be loaded
v1.5
Additional Possibilities
If you are now that no breaking changes provided in versions, you can
add it as range '^2.6.5'
Will provide an error Will load provided version
of package anyway
REQUIRED VERSION: VERSION RANGE | FALSE
Syncronous loading of dependencies
EAGER: TRUE
Our solution with shell
// Application startup
// Shared dependency’s provider
// Routing
// Initialise Event Bus
// Hosts internal SDK’s
// Soft deprecation of unused API’s
Shared dep.
Shared dep.
Shared dep.
SHELL
Routing Initialisation Orchestration Basic Configs
Shared dep.
remoteApp
remoteApp
remoteApp
remoteApp
remoteApp
Dynamic Modules loading on demand
Dynamically Load RemoteEntry Container
Wrapper around webpack internals
Simply lazy-load component. Incredible
flexibility
Fault tolerance and no CLS with skeletons
A CHAIN IS AS STRONG AS THE WEAKEST LINK
Scope - meta information for your crashlytic
Style Isolation
CSS-in-js with custom hash settings in each MFE for more unique names
Or conventions ( But we cannot rely on conventions in multiple teams)
Cross-component communication
Because Module Federation works similar to your own SPA solution
without ecnapsulation you should use your approach.
We use an Push-Based RX-bus based EE.
Event-based module is perfect fit for the low-coupled systems.
Event Bus
Lifecycle Hoks
Internal State
Properties
Own Dependencies Shared Dependencies
Events
Integration Layer
Business Domain-related Component
Why rxjs?
Data provider Observable
Consumer
Consumer
Consumer
Flow of events. Push-Based approach.
RxJS is a library for composing asynchronous and event-based programs
by using observable sequences. It provides one core type, the Observable,
satellite types (Observer, Schedulers, Subjects) and operators inspired by
Array methods (map, filter, reduce, every, etc) to allow handling
asynchronous events as collections
After subscription Consumer Will Get Next Value
1 2 3 4
4
Observe
Consumer
Behavior
SIMPLY STORES THE CURRENT VALUE
1 2 3
3
4
4
Observe
Consumer
Scoped namings will create Behaviour Subject
Event Bus is just an abstraction
By the way we try to scope our messages around business domains
and subdomains:
// user.data.updated
// user.data.received
// sports.tournaments.updated
Event Bus
Lifecycle Hoks
Internal State
Properties
Own Dependencies Shared Dependencies
Events
Integration Layer
Business Domain-related Component
Tooling and contracts control
Events Schema
ESlint Plugin
MFE1
ESlint Plugin
MFE1
Deployments
Team A
Team B
Team C
// Fully Independent
// Load and executes as regular webpack module can be deployed to npm
or as a simple static to server.
// We got a risks to broke something, so we need automatization and
regression.
// We need to keep contracts stable, and use soft deprecation for unused
contracts
Browser NGINX
Infra
cache
CI/CD
assets/styles.[hash].css
assets/bundles.[hash].js
assets/remoteEntry.js
assets/images.png
assets/styles.[hash].css
assets/bundles.[hash].js
assets/remoteEntry.js
assets/images.png
assets/styles.[hash].css
assets/bundles.[hash].js
assets/remoteEntry.js
assets/images.png
CI/CD
CI/CD
Team A
Team B
Team C
Browser NGINX
Infra
cache
CI/CD
CI/CD
CI/CD
Deployments Versioning Possibility
Team A
Team B
Team C
Browser NGINX
Infra
Semantic Release
cache
CI/CD
1.0.1/styles.[hash].css
1.0.1/bundle.[hash].js
1.0.1/remoteEntry.js
1.0.1/styles.[hash].css
1.0.1/bundle.[hash].js
1.0.1/remoteEntry.js
1.0.1/styles.[hash].css
1.0.1/bundle.[hash].js
1.0.1/remoteEntry.js
CI/CD
CI/CD
assets/1.0.1/mfe1
assets/1.0.1/mfe2
assets/1.0.1/mfe3
You can dynamically wrote remotes path’s
Dynamic Loading provides us possibillity to generate
path’s on the fly.
So just load your Dependency Containers
from ‘https://your-domain.com/v.0.1.1/remoteEntry.js’
Configurabillity
Because we got fully runtime-based composition, we can rely on
remote-configs or manifests to configure our app without rebuilding
or re-deploying it. We can literally hide everything under the feature
flags or AB tests in runtime
Product
Manager Configs Provider
Slider Footer
Consumer
Off On
Testing
Micro frontends are about automatisation.
Unit -> Component Testing -> Integration tests
We might test it on it own environment, then on
top of it - integration +End-2-End tests
Performance budgeting
Provide a performance budgets as soon as possible,
to prevent your colleagues bundle 2mb of icons in their
MFE and impacts Web Vitals
// Sitespeed + Grafana
// Webpagetest + Grafana
// LightHouse CI
// Webpack Bundlesize
Cashing Strategy
// Hashes for vendors and bundles
// Infrastructure cache-control (СloudFlare or similar)
// ServiceWorker-based cache for static
// eTags
// SDK-level caching
// Transport-layer caching and butching in workers
Amount Of Requests in isolated modules might
be trouble
Highly independent modules Impacts Infra and Browser Performance
with their requests. We implemented and SDK’s with their own level
of caching and provide to reuse it. Service Workers and Dynamic
Modules Loading on demand - is key.
Frankenstein: Different Frameworks on Page
// Legacy solutions
// Moving to the new technologies
// Any other root cause…
But keep in mind that current frameworks
doesn’t share common environment nicely
(Routing, globals, etc.).
Module Federation: No framework agnostic
approach out of the box.
But we can still do this. You will need
some wrappers.
Conclusions about Module Federation
// Good for teams that already on webpack.
// Provides you posibility to split release cycles and make
them faster.
// Shared dependency and their control are so useful
// Not very high level of encapsulation and isolation out of box,
but you can handle it with conventions and toolings.
// Onboarding of newcomers is easy.
// Need some additional work to create a frankenstein (multiple
frameworks on same page).
// Embeddable in the webpack applications.
For everything else, there's Webcomponents
and ES6 modules
// It’s close to standarts
// High level of encapsulation (DOM, Styles)
// Shadow DOM and Custom Elements API
// Framework agnostic
// Easy to embed, works in any WEB context
// And you can combine it with Module Federation
WebComponents Suite
ES6 modules Custom Elements Shadow DOM HTML templates
DOCUMENT
SHADOW
HOST
DOCUMENT
SHADOW
HOST
SHADOW
TREE
SHADOW TREE
DOCUMENT TREE FLATTENED TREE (FOR RENDERING)
SHADOW
ROOT
SHADOW
HOST
Frankenstein CookBook
// Define Custom Element
// Create some div inside WebComponent
// On ConnectedCallback() lifecycle hook - just
mount your framework-based app to the div.
// And you can combine it with Module Federation
Few words about WebComponents
// SSR - main drawback for now
// DX - good if you use some microframeworks (Lit/Stencil etc..)
// Deployments - easy, static or npm packages.
// Encapsulation - Medium. DOM, css.
// Easy to embed on page because of Custom Elements (for some
frameworks such as react, you still need a wrapper)
// Communication - Custom Events.
Conclusion:
Long-term bet on web standards
Win
// ~15 teams: Freedom for teams and developers
// Less cognitive load: Easy to onboard newcomers on project
// Domain-based experience focus
// Fast Release Cycles: Releases every day, except friday of course
// Sustainability: 1.5+ year on production with current approach
Teams and Front-end Scaling
Micro frontends are more likely about the
philosophy of finding the perfect balance
between technical and communication
overhead and stability with excellent
development freedom and experience.
"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov

More Related Content

PPTX
Introduction To Micro Frontends
PDF
Mikrofrontend a Module Federation
PPTX
Micro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJS
PDF
"Micro-frontends, web development", Oleksandr Khivrych
PDF
Micro frontends
PPTX
PDF
Micro Frontends Architecture - Jitendra kumawat (Guavus)
PDF
FEVR - Micro Frontend
Introduction To Micro Frontends
Mikrofrontend a Module Federation
Micro Front Ends : Divided We Rule by Parth Ghiya - AhmedabadJS
"Micro-frontends, web development", Oleksandr Khivrych
Micro frontends
Micro Frontends Architecture - Jitendra kumawat (Guavus)
FEVR - Micro Frontend

What's hot (20)

PPTX
Micro frontend architecture_presentation_ssoni
PDF
Micro Frontends
PDF
State of Micro Frontend
PDF
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
PPTX
Micro frontend
PPTX
Micro-frontends – is it a new normal?
PPTX
[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...
PDF
Micro Frontends Architecture
PPTX
Shift Remote FRONTEND: Micro Frontend Architecture: A Look Into the Future - ...
PPTX
Building applications in a Micro-frontends way
PPTX
Micro Front-End & Microservices - Plansoft
PDF
How to build Micro Frontends with @angular/elements
PDF
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
PPTX
Micro-Frontend Architecture
PDF
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
PDF
Micro frontend: The microservices puzzle extended to frontend
PPTX
Microfrontends Monoreops & Trunkbased based
PDF
Why Microservice
PDF
Spring Boot and Microservices
PPTX
Hexagonal architecture with Spring Boot
Micro frontend architecture_presentation_ssoni
Micro Frontends
State of Micro Frontend
Ivan Jovanovic - Micro Frontends - Codemotion Rome_2019
Micro frontend
Micro-frontends – is it a new normal?
[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...
Micro Frontends Architecture
Shift Remote FRONTEND: Micro Frontend Architecture: A Look Into the Future - ...
Building applications in a Micro-frontends way
Micro Front-End & Microservices - Plansoft
How to build Micro Frontends with @angular/elements
"Micro-frontends from A to Z. How and Why we use Micro-frontends in Namecheap...
Micro-Frontend Architecture
Microservice Architecture | Microservices Tutorial for Beginners | Microservi...
Micro frontend: The microservices puzzle extended to frontend
Microfrontends Monoreops & Trunkbased based
Why Microservice
Spring Boot and Microservices
Hexagonal architecture with Spring Boot
Ad

Similar to "Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov (20)

PDF
Best practices for creating modular Web applications
PPTX
Micro-Frontends JSVidCon
PDF
micro-frontends-with-vuejs
PDF
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
PDF
The DevOps Paradigm
PPT
Top java script frameworks ppt
PPTX
The twelve factor app
PPTX
Building reusable components as micro frontends with glimmer js and webcompo...
PPT
Presentation 1 open source tools in continuous integration environment v1.0
PPTX
PPT
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
PPTX
Microservices and containers for the unitiated
DOCX
Spring notes
PDF
Agile integration: Decomposing the monolith
PDF
Power your move to the cloud 20180611
PDF
Webinar on deployment automation Xebialabs - 15 sept 2010
PDF
Spring Framework Tutorial | VirtualNuggets
PPT
PDF
Getting started with ibm worklight tips
PPTX
Webpack/Parcel: What’s Happening Behind the React App?
Best practices for creating modular Web applications
Micro-Frontends JSVidCon
micro-frontends-with-vuejs
The DevOps paradigm - the evolution of IT professionals and opensource toolkit
The DevOps Paradigm
Top java script frameworks ppt
The twelve factor app
Building reusable components as micro frontends with glimmer js and webcompo...
Presentation 1 open source tools in continuous integration environment v1.0
Shine a Light with Prism (the Composite Application Guidance for WPF and Silv...
Microservices and containers for the unitiated
Spring notes
Agile integration: Decomposing the monolith
Power your move to the cloud 20180611
Webinar on deployment automation Xebialabs - 15 sept 2010
Spring Framework Tutorial | VirtualNuggets
Getting started with ibm worklight tips
Webpack/Parcel: What’s Happening Behind the React App?
Ad

More from Fwdays (20)

PDF
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
PDF
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
PPTX
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
PPTX
"Як ми переписали Сільпо на Angular", Євген Русаков
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
PDF
"Validation and Observability of AI Agents", Oleksandr Denisyuk
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
PPTX
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
PPTX
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
PDF
"AI is already here. What will happen to your team (and your role) tomorrow?"...
PPTX
"Is it worth investing in AI in 2025?", Alexander Sharko
PDF
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
PDF
"Scaling in space and time with Temporal", Andriy Lupa.pdf
PDF
"Database isolation: how we deal with hundreds of direct connections to the d...
PDF
"Scaling in space and time with Temporal", Andriy Lupa .pdf
PPTX
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
PPTX
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
PPTX
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
PPTX
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...
"Mastering UI Complexity: State Machines and Reactive Patterns at Grammarly",...
"Effect, Fiber & Schema: tactical and technical characteristics of Effect.ts"...
"Computer Use Agents: From SFT to Classic RL", Maksym Shamrai
"Як ми переписали Сільпо на Angular", Євген Русаков
"AI Transformation: Directions and Challenges", Pavlo Shaternik
"Validation and Observability of AI Agents", Oleksandr Denisyuk
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
"Co-Authoring with a Machine: What I Learned from Writing a Book on Generativ...
"Human-AI Collaboration Models for Better Decisions, Faster Workflows, and Cr...
"AI is already here. What will happen to your team (and your role) tomorrow?"...
"Is it worth investing in AI in 2025?", Alexander Sharko
''Taming Explosive Growth: Building Resilience in a Hyper-Scaled Financial Pl...
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Database isolation: how we deal with hundreds of direct connections to the d...
"Scaling in space and time with Temporal", Andriy Lupa .pdf
"Provisioning via DOT-Chain: from catering to drone marketplaces", Volodymyr ...
" Observability with Elasticsearch: Best Practices for High-Load Platform", A...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"Istio Ambient Mesh in production: our way from Sidecar to Sidecar-less",Hlib...

Recently uploaded (20)

PDF
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
PDF
giants, standing on the shoulders of - by Daniel Stenberg
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PDF
NewMind AI Weekly Chronicles – August ’25 Week IV
PDF
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
PDF
Rapid Prototyping: A lecture on prototyping techniques for interface design
PDF
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
PDF
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
PDF
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
Auditboard EB SOX Playbook 2023 edition.
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PDF
EIS-Webinar-Regulated-Industries-2025-08.pdf
PDF
Electrocardiogram sequences data analytics and classification using unsupervi...
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
agenticai-neweraofintelligence-250529192801-1b5e6870.pptx
PPTX
Training Program for knowledge in solar cell and solar industry
PDF
LMS bot: enhanced learning management systems for improved student learning e...
Aug23rd - Mulesoft Community Workshop - Hyd, India.pdf
giants, standing on the shoulders of - by Daniel Stenberg
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
NewMind AI Weekly Chronicles – August ’25 Week IV
“The Future of Visual AI: Efficient Multimodal Intelligence,” a Keynote Prese...
Rapid Prototyping: A lecture on prototyping techniques for interface design
The-Future-of-Automotive-Quality-is-Here-AI-Driven-Engineering.pdf
A hybrid framework for wild animal classification using fine-tuned DenseNet12...
Improvisation in detection of pomegranate leaf disease using transfer learni...
Transform-Your-Streaming-Platform-with-AI-Driven-Quality-Engineering.pdf
CXOs-Are-you-still-doing-manual-DevOps-in-the-age-of-AI.pdf
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
Auditboard EB SOX Playbook 2023 edition.
Basics of Cloud Computing - Cloud Ecosystem
EIS-Webinar-Regulated-Industries-2025-08.pdf
Electrocardiogram sequences data analytics and classification using unsupervi...
Enhancing plagiarism detection using data pre-processing and machine learning...
agenticai-neweraofintelligence-250529192801-1b5e6870.pptx
Training Program for knowledge in solar cell and solar industry
LMS bot: enhanced learning management systems for improved student learning e...

"Micro-frontends: Scalable and Modular Frontend in Parimatch Tech", Kyrylo Aistrakhanov

  • 2. Demystifying Is an architectural approach. That comes from the Back-End world and for now adopted for MFE. Monolith SPA SPA Monolith Microservices Microservices Microfronends Front-end Back-end
  • 3. Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization's communication structure. Conway’s Law Melvin E. Conway
  • 4. It’s all about scaling and adding new teams Team C Team B Team A git git git own environment CAN BE TESTED INDEPENDENTLY INTEGRATION / VISUAL E2E TESTS DEVELOP DEVELOP DEVELOP own environment own environment
  • 5. // Independent Releases and Deployments // Automous Development // Model Around Business Domains // Framework Agnostic and Technology Independent // Can be simply deleted or replaced by other component // Can be easily embbeded // Encapsulation
  • 6. Benefits of Microfrontends // Sustainability // Fast release cycle, independent deploys // High expertise in domain-based cross-functional teams // Autonomous development // Component-oriented testing
  • 7. Maybe you already have a working project? So maybe you will need: // Performance: no overhead in network requests or JS size // No code duplication // Encapsulation level // Iteratively move on new technology, do not stop working business // So depends on previous point it might be easy to embed // Do not lack in development experience // Highly configurable front-end, feature-flags, predicate system, AB testing
  • 8. Examples // Authorisation and Registration Widgets Mostly any part of application, or page might be a modularized. Depends on your domains and philosophy of decomposition // Personal user cabinet // Payments Page
  • 9. Microfrontends is a subdomain representation on FE // Strict boundaries // Clean and stable contracts // No shared logic with another domains // Independent and release cycles with fault tolerance
  • 10. Modules Decomposition Decoupling // Independent/Self-contained (Low Coupling): A module has to be as detached from other dependencies as possible. // Specific (High Cohesion): Elements within one class/module should functionally belong together and do one particular thing. // Reusable: A module has to be easy to integrate into various kinds of programs to perform its task
  • 12. And it’s all united in one environment under one resource
  • 13. How can we orchestrate it? Build Time (From Different Packages) - not true, you got a single release point Server Side - seems quite good, but you need team with knowledge in at least SSI or some alternative to compose you FE on BE, it may be some additional semi BE framework. Client Side - True way for real frontenders, just joking, we are the engineers and must to know a lot. Incredible scaling. A root application that dynamically loads each independently deployed web application Just a few players: Single SPA, Piral, Mosaic9, ILC, Open Com- ponents, Bit.
  • 15. Microfrontends Basic Suite Kit // Shell. Routing. Orchestrating. Configurations manifest with list of resources to load // Module. (.render method to embed it somewhere) // Some Way of Communication between them - of course Event Based. Pull Based or Push Based
  • 16. Do not couple business subdomains! // Contracts IN // Contracts OUT Just a basics of components Event Bus Lifecycle Hoks Internal State Properties Own Dependencies Shared Dependencies Events Integration Layer Business Domain-related Component
  • 17. Modules in Front-End Simple .js scripts and functions (IIFE module pattern) AMD | UMD ES6 Modules Custom modules system (build toolings such as webpack, systemjs with import maps, etc.)
  • 18. IIFE - the grandpa of modules Technically you can just create and simple functions with some properties in it, write some CSS, set it as static somewhere on CDN, and add it into your apps. Implement you render or mount method to stick into DOM or attach to something. Handle some properties, bubble some events, profit?
  • 19. It’s an old Jquery Plugins. But just imagine that it is more complex app, not a part of UI kit or UI library
  • 20. Bundlers, transpilers, frameworks to handle it all, we wrote our routing soluitions. So you will need to create some ".render, .mount” methods, provide wrappers, lifecycle hooks, handle the code duplication by yourself, tracking the versions mismatches, care about islolation and encapsula- tion…
  • 21. Approaches that we faced. Runtime integration iFrames Module Federation WebComponents + ES6 modules
  • 22. iFrames // First class encapsulation // Own window and globals (DOM) // Easy to embed on page // Can be lazy loaded // Control and restricted over access to internals // Communication through window.postMessage events
  • 23. Deployments and Autonomous Development Fully independent deployments Fully framework- agnostic solution
  • 26. Federated Modules part // Our case: Monolith with 2y/o react/redux-observables codebase // From 11 to 15-20 teams // From 10 to 100 engineers // Highly configurable product with a lot of dynamics load, AB tests and feature flags
  • 28. Module Federation // Provide Loading chunks and webpack modules from different hosts // Natively feels like working with dynamic imports, same API, promises and modules with low-level webpack modules code. // Best fit for teams that develops around webpack, and had similar tech stack around company (Only React/Preact, Angular, Vue etc.). // You need to handle encapsulation by yourself. // Linting and conventions must help
  • 30. RemoteEntry - IOC container
  • 31. Code Duplication We can share dependencies and we need to mark em as shared in different modules and shell itself
  • 32. Default Strategy based on Sem Ver. v1.2 will not be loaded will be loaded v1.5
  • 33. Default Strategy based on Sem Ver. L O A D I N G... v2.2 will be loaded will be loaded v1.5
  • 34. Additional Possibilities If you are now that no breaking changes provided in versions, you can add it as range '^2.6.5' Will provide an error Will load provided version of package anyway REQUIRED VERSION: VERSION RANGE | FALSE
  • 35. Syncronous loading of dependencies EAGER: TRUE
  • 36. Our solution with shell // Application startup // Shared dependency’s provider // Routing // Initialise Event Bus // Hosts internal SDK’s // Soft deprecation of unused API’s Shared dep. Shared dep. Shared dep. SHELL Routing Initialisation Orchestration Basic Configs Shared dep. remoteApp remoteApp remoteApp remoteApp remoteApp
  • 40. Simply lazy-load component. Incredible flexibility
  • 41. Fault tolerance and no CLS with skeletons A CHAIN IS AS STRONG AS THE WEAKEST LINK
  • 42. Scope - meta information for your crashlytic
  • 43. Style Isolation CSS-in-js with custom hash settings in each MFE for more unique names Or conventions ( But we cannot rely on conventions in multiple teams)
  • 44. Cross-component communication Because Module Federation works similar to your own SPA solution without ecnapsulation you should use your approach. We use an Push-Based RX-bus based EE. Event-based module is perfect fit for the low-coupled systems. Event Bus Lifecycle Hoks Internal State Properties Own Dependencies Shared Dependencies Events Integration Layer Business Domain-related Component
  • 45. Why rxjs? Data provider Observable Consumer Consumer Consumer Flow of events. Push-Based approach. RxJS is a library for composing asynchronous and event-based programs by using observable sequences. It provides one core type, the Observable, satellite types (Observer, Schedulers, Subjects) and operators inspired by Array methods (map, filter, reduce, every, etc) to allow handling asynchronous events as collections
  • 46. After subscription Consumer Will Get Next Value 1 2 3 4 4 Observe Consumer
  • 47. Behavior SIMPLY STORES THE CURRENT VALUE 1 2 3 3 4 4 Observe Consumer
  • 48. Scoped namings will create Behaviour Subject
  • 49. Event Bus is just an abstraction By the way we try to scope our messages around business domains and subdomains: // user.data.updated // user.data.received // sports.tournaments.updated Event Bus Lifecycle Hoks Internal State Properties Own Dependencies Shared Dependencies Events Integration Layer Business Domain-related Component
  • 50. Tooling and contracts control Events Schema ESlint Plugin MFE1 ESlint Plugin MFE1
  • 51. Deployments Team A Team B Team C // Fully Independent // Load and executes as regular webpack module can be deployed to npm or as a simple static to server. // We got a risks to broke something, so we need automatization and regression. // We need to keep contracts stable, and use soft deprecation for unused contracts Browser NGINX Infra cache CI/CD assets/styles.[hash].css assets/bundles.[hash].js assets/remoteEntry.js assets/images.png assets/styles.[hash].css assets/bundles.[hash].js assets/remoteEntry.js assets/images.png assets/styles.[hash].css assets/bundles.[hash].js assets/remoteEntry.js assets/images.png CI/CD CI/CD
  • 52. Team A Team B Team C Browser NGINX Infra cache CI/CD CI/CD CI/CD Deployments Versioning Possibility Team A Team B Team C Browser NGINX Infra Semantic Release cache CI/CD 1.0.1/styles.[hash].css 1.0.1/bundle.[hash].js 1.0.1/remoteEntry.js 1.0.1/styles.[hash].css 1.0.1/bundle.[hash].js 1.0.1/remoteEntry.js 1.0.1/styles.[hash].css 1.0.1/bundle.[hash].js 1.0.1/remoteEntry.js CI/CD CI/CD assets/1.0.1/mfe1 assets/1.0.1/mfe2 assets/1.0.1/mfe3
  • 53. You can dynamically wrote remotes path’s Dynamic Loading provides us possibillity to generate path’s on the fly. So just load your Dependency Containers from ‘https://your-domain.com/v.0.1.1/remoteEntry.js’
  • 54. Configurabillity Because we got fully runtime-based composition, we can rely on remote-configs or manifests to configure our app without rebuilding or re-deploying it. We can literally hide everything under the feature flags or AB tests in runtime Product Manager Configs Provider Slider Footer Consumer Off On
  • 55. Testing Micro frontends are about automatisation. Unit -> Component Testing -> Integration tests We might test it on it own environment, then on top of it - integration +End-2-End tests
  • 56. Performance budgeting Provide a performance budgets as soon as possible, to prevent your colleagues bundle 2mb of icons in their MFE and impacts Web Vitals // Sitespeed + Grafana // Webpagetest + Grafana // LightHouse CI // Webpack Bundlesize
  • 57. Cashing Strategy // Hashes for vendors and bundles // Infrastructure cache-control (СloudFlare or similar) // ServiceWorker-based cache for static // eTags // SDK-level caching // Transport-layer caching and butching in workers
  • 58. Amount Of Requests in isolated modules might be trouble Highly independent modules Impacts Infra and Browser Performance with their requests. We implemented and SDK’s with their own level of caching and provide to reuse it. Service Workers and Dynamic Modules Loading on demand - is key.
  • 59. Frankenstein: Different Frameworks on Page // Legacy solutions // Moving to the new technologies // Any other root cause… But keep in mind that current frameworks doesn’t share common environment nicely (Routing, globals, etc.). Module Federation: No framework agnostic approach out of the box. But we can still do this. You will need some wrappers.
  • 60. Conclusions about Module Federation // Good for teams that already on webpack. // Provides you posibility to split release cycles and make them faster. // Shared dependency and their control are so useful // Not very high level of encapsulation and isolation out of box, but you can handle it with conventions and toolings. // Onboarding of newcomers is easy. // Need some additional work to create a frankenstein (multiple frameworks on same page). // Embeddable in the webpack applications.
  • 61. For everything else, there's Webcomponents and ES6 modules // It’s close to standarts // High level of encapsulation (DOM, Styles) // Shadow DOM and Custom Elements API // Framework agnostic // Easy to embed, works in any WEB context // And you can combine it with Module Federation
  • 62. WebComponents Suite ES6 modules Custom Elements Shadow DOM HTML templates DOCUMENT SHADOW HOST DOCUMENT SHADOW HOST SHADOW TREE SHADOW TREE DOCUMENT TREE FLATTENED TREE (FOR RENDERING) SHADOW ROOT SHADOW HOST
  • 63. Frankenstein CookBook // Define Custom Element // Create some div inside WebComponent // On ConnectedCallback() lifecycle hook - just mount your framework-based app to the div. // And you can combine it with Module Federation
  • 64. Few words about WebComponents // SSR - main drawback for now // DX - good if you use some microframeworks (Lit/Stencil etc..) // Deployments - easy, static or npm packages. // Encapsulation - Medium. DOM, css. // Easy to embed on page because of Custom Elements (for some frameworks such as react, you still need a wrapper) // Communication - Custom Events. Conclusion: Long-term bet on web standards
  • 65. Win // ~15 teams: Freedom for teams and developers // Less cognitive load: Easy to onboard newcomers on project // Domain-based experience focus // Fast Release Cycles: Releases every day, except friday of course // Sustainability: 1.5+ year on production with current approach
  • 66. Teams and Front-end Scaling Micro frontends are more likely about the philosophy of finding the perfect balance between technical and communication overhead and stability with excellent development freedom and experience.