SlideShare a Scribd company logo
From monolith SPA to micro-frontends
How we extended microservices architecture to frontend
Rustam Aliyev @rstml
Ivan Martynov @j_martyn
07/07/2018 OneDome
What is ”microservice”?
• Architectural pattern
• Collection of loosely coupled services
Application
(PHP, Ruby, etc.)
Database
Frontend (SPA)
API
Backend
Database
XHR
Conway’s Law
Produced system design copies
organisational structure
M. Conway, 1967
Frontend (SPA)
API Gateway (REST, GraphQL)
Backend
Database
Microservice A
Team A
Backend
Database
Microservice B
Team B
Backend
Database
Microservice N
Team N
…
Problems of monolith SPA
• Ownership !
• Dependency management "
• Shared components #
• Deployment and releases $
• A/B testing %
…
Backend
Database
Microservice A
Team A
Frontend
Backend
Database
Microservice B
Team B
Frontend
Backend
Database
Microservice N
Team N
Frontend…
API Gateway (REST, GraphQL)
Decoupling Monolith
Typical SPA Anatomy
• One entry point (index.js)
• SPA framework
• All components in one bundle
...
<script src="https://unpkg.com/react/dist/react.js"></script>
<script src="/index.js"></script>
...
Complex monolith SPA
• All-in-one SPA bundle
• Package per product with custom routings
• Shared components in separate packages
index.js
…App A
Package
App B
Package
App N
Package
Shared
Components
Package(s)
Ways to decompose monolith frontend
1. Strong isolation
Web Components / IFrame
Multiple SPAs / frameworks
Communication channels
2. Weak isolation
Dependency Injection
Single SPA / framework
Shared state store
…
App A
Package
Team A
App B
Package
Team B
App N
Package
Team N
Browser
Runtime
Dependency
Injection
Shared
Components
Package ver.A
Shared
Components
Package ver.B
Shared
Components
Package ver.N
Thin SPA (injector)
Shared Store (Redux, MobX)
/* app/package.json */
{
"dependencies" : {
"dependency" : "1.0.0"
}
}
/* app.js */
import dependency from 'dependency';
...
dependency.use();
/* index.html */
<script src="/dependency.v1.0.0.js"></script>
<script src="/app.v2.0.0.js"></script>
<script src="/thin-spa.js"></script>
/* app.js */
export default (dependency) => {
dependency.use();
}
/* thin-spa.js (injector) */
import app from 'app';
import dependency from 'dependency';
...
app(dependency); // wiring
Importing vs Dependency Injection
Organising projects
Before: project structure
Package
Thin SPA
Package
App A
Package
App B
Package
Shared
Component
… Package
App N
Before: Local development workflow
1. Manual symlink or npm link to test
2. Publish components to NPM
3. Deploy whole app
cd ~/components
npm link
cd ~/application
npm link components
Monorepo
• A single repository holding the code of many packages
• Monorepo ≠ monolith
Thin
SPA
Package
App A
Package
App B
Package
Shared
Components
Package
…
App N
Package
Monorepo
Shared
Components
Package
Lerna
• Tool for managing monorepo
• Inter-dependency management
• Publishing
• Testing
• CLI: bootstrap, publish, etc.
• yarn optimised
lerna-repo
├─ package.json
├─ lerna.json
└─ packages
├─ main-spa
│ └─ package.json
├─ design-lib
│ └─ package.json
├─ app-a
│ └─ package.json
└─ app-b
├─ package.json
└─ node_modules
├─ design-lib -> ../../design-lib
├─ ...
Lerna
• Tool for managing monorepo
• Inter-dependency management
• Publishing
• Testing
• CLI: bootstrap, publish, etc.
• yarn optimised
/* lerna.json */
{
"lerna": "2.5.1",
"npmClient": "yarn",
"useWorkspaces": true, // yarn workspaces
"version": "independent"
}
/* package.json */
{
// yarn workspaces configuration
"workspaces": [
"packages/*"
],
"private": true
}
Lerna: Local development workflow
• Automatically interlinking
• Inter-dependencies and downstream versions
• Automated testing
lerna bootstrap
# All packages are symlinked now
git commit -a -m "Many changes"
lerna publish
# Changes:
# - app-A: 1.0.1 => 1.0.2
# - app-B: 1.2.1 => 1.3.0
# - utils: 1.5.4 => 1.5.5
# - components: 3.0.4 => 3.0.5
Deployment
A
…
B
N
…
A
…
B1
N
B2
Monorepo (e.g. Git) Web Server
Build, test, deployApplications
Shared
components
Micro-frontends
Thin SPA
Results
Same
bundle size
Migrated gradually
in background
~1 month
Summary
Before After
Ownership ! "
Dependency management # $
Shared components % &
Deployment and releases ' (
A/B testing ) *
Future work
• Applying Web Components
• Communication between modules via event bus
• Bolt as an alternative to Lerna
• Hierarchical dependency injection
Questions?

More Related Content

What's hot (20)

PPTX
Laravel Tutorial PPT
Piyush Aggarwal
 
ODP
Projects In Laravel : Learn Laravel Building 10 Projects
Sam Dias
 
PPTX
Spring boot
sdeeg
 
PDF
Getting Reactive with Spring Framework 5.0’s GA release
VMware Tanzu
 
PPTX
Java springboot microservice - Accenture Technology Meetup
Accenture Hungary
 
PPTX
Introduction to spring boot
Santosh Kumar Kar
 
PDF
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
PPTX
A introduction to Laravel framework
Phu Luong Trong
 
PPTX
Web application framework
Pankaj Chand
 
PPTX
API Development with Laravel
Michael Peacock
 
PDF
Spring Boot and Microservices
seges
 
PDF
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
PDF
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
PDF
Why Laravel?
Jonathan Goode
 
PPT
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Lorvent56
 
PDF
Digpen 7: Why choose Laravel?
John Blackmore
 
PPTX
Maven in mulesoft
venkata20k
 
PPTX
Ready! Steady! SpringBoot!
GlobalLogic Ukraine
 
PDF
Java Web Application Security - Utah JUG 2011
Matt Raible
 
PDF
Spring Boot
HongSeong Jeon
 
Laravel Tutorial PPT
Piyush Aggarwal
 
Projects In Laravel : Learn Laravel Building 10 Projects
Sam Dias
 
Spring boot
sdeeg
 
Getting Reactive with Spring Framework 5.0’s GA release
VMware Tanzu
 
Java springboot microservice - Accenture Technology Meetup
Accenture Hungary
 
Introduction to spring boot
Santosh Kumar Kar
 
Migrating to Java 9 Modules
Sander Mak (@Sander_Mak)
 
A introduction to Laravel framework
Phu Luong Trong
 
Web application framework
Pankaj Chand
 
API Development with Laravel
Michael Peacock
 
Spring Boot and Microservices
seges
 
Laravel Introduction
Ahmad Shah Hafizan Hamidin
 
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
Why Laravel?
Jonathan Goode
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Lorvent56
 
Digpen 7: Why choose Laravel?
John Blackmore
 
Maven in mulesoft
venkata20k
 
Ready! Steady! SpringBoot!
GlobalLogic Ukraine
 
Java Web Application Security - Utah JUG 2011
Matt Raible
 
Spring Boot
HongSeong Jeon
 

Similar to Rustam Aliyev and Ivan Martynov - From monolith web app to micro-frontends – How we extended microservices architecture to frontend (20)

PPTX
Manual JavaScript Analysis Is A Bug
Lewis Ardern
 
PPTX
Full-Stack-Presentation-Slide(Longsaar_Francis).pptx
longsaarmuknaan
 
PDF
Node.js an Exectutive View
Manuel Eusebio de Paz Carmona
 
PDF
N api-node summit-2017-final
Michael Dawson
 
PPTX
N-API NodeSummit-2017
Arunesh Chandra
 
PDF
Cytoscape: Now and Future
Keiichiro Ono
 
PDF
Intro to CakePHP
Walther Lalk
 
PDF
Reaktive Programmierung mit den Reactive Extensions (Rx)
NETUserGroupBern
 
PDF
Building and deploying LLM applications with Apache Airflow
Kaxil Naik
 
PPTX
Quick look in Reactive Extensions
johnlvidal
 
PPTX
Introduction to React native
Dhaval Barot
 
PPTX
Spring MVC framework
Mohit Gupta
 
PPTX
Micro frontend
Amr Abd El Latief
 
PDF
From CoreOS to Kubernetes and Concourse CI
Denis Izmaylov
 
PDF
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
PPTX
Magento 2 Workflows
Ryan Street
 
PPTX
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
PDF
Node.js Course 2 of 2 - Advanced techniques
Manuel Eusebio de Paz Carmona
 
PDF
Learning Concurrent Programming in Scala Second Edition Aleksandar Prokopec
phadkepoya
 
PDF
PHP - Programming language war, does it matter
Mizno Kruge
 
Manual JavaScript Analysis Is A Bug
Lewis Ardern
 
Full-Stack-Presentation-Slide(Longsaar_Francis).pptx
longsaarmuknaan
 
Node.js an Exectutive View
Manuel Eusebio de Paz Carmona
 
N api-node summit-2017-final
Michael Dawson
 
N-API NodeSummit-2017
Arunesh Chandra
 
Cytoscape: Now and Future
Keiichiro Ono
 
Intro to CakePHP
Walther Lalk
 
Reaktive Programmierung mit den Reactive Extensions (Rx)
NETUserGroupBern
 
Building and deploying LLM applications with Apache Airflow
Kaxil Naik
 
Quick look in Reactive Extensions
johnlvidal
 
Introduction to React native
Dhaval Barot
 
Spring MVC framework
Mohit Gupta
 
Micro frontend
Amr Abd El Latief
 
From CoreOS to Kubernetes and Concourse CI
Denis Izmaylov
 
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
Magento 2 Workflows
Ryan Street
 
Webdevcon Keynote hh-2012-09-18
Pierre Joye
 
Node.js Course 2 of 2 - Advanced techniques
Manuel Eusebio de Paz Carmona
 
Learning Concurrent Programming in Scala Second Edition Aleksandar Prokopec
phadkepoya
 
PHP - Programming language war, does it matter
Mizno Kruge
 
Ad

More from OdessaJS Conf (20)

PPTX
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
OdessaJS Conf
 
PDF
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
OdessaJS Conf
 
PDF
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
OdessaJS Conf
 
PPTX
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
OdessaJS Conf
 
PPTX
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
OdessaJS Conf
 
PPTX
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
OdessaJS Conf
 
PDF
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
OdessaJS Conf
 
PDF
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
OdessaJS Conf
 
PPTX
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
OdessaJS Conf
 
PPTX
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
OdessaJS Conf
 
PPTX
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
OdessaJS Conf
 
PPTX
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
OdessaJS Conf
 
PPTX
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
OdessaJS Conf
 
PPTX
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
OdessaJS Conf
 
PDF
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
OdessaJS Conf
 
PDF
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
OdessaJS Conf
 
PDF
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
OdessaJS Conf
 
PDF
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
OdessaJS Conf
 
PDF
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
OdessaJS Conf
 
PDF
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
OdessaJS Conf
 
'GraphQL Schema Design' by Borys Mohyla. OdessaJS'2021
OdessaJS Conf
 
'How i came up with my talk' by Yurii Artiukh. OdessaJS'2021
OdessaJS Conf
 
"Is there life in react without redux" by Babich Sergiy. OdessaJS'2021
OdessaJS Conf
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
OdessaJS Conf
 
Андрій Троян. Розробка мікросервісів з NestJS. OdessaJS'2021
OdessaJS Conf
 
Олексій Гончар "Використання Electron в розробці корпоративної відео-мессeндж...
OdessaJS Conf
 
Максим Климишин "Що такого особливого у пропозиції вартості шаблону Micro Fro...
OdessaJS Conf
 
Павло Галушко. GOOD CODE MYTHS. OdessaJS'2021
OdessaJS Conf
 
"NODEJS & GRAPHQL COOKBOOK. LET’S TALK ABOUT MICRO-SERVICES" by Антон Чередні...
OdessaJS Conf
 
'BUILDING ANGULAR APPS WITH NX' by Anastasia Necheporenko
OdessaJS Conf
 
'IS THERE JAVASCRIPT ON SWAGGER PLUGINS?' by Dmytro Gusev
OdessaJS Conf
 
'ETHEREUM SMART CONTRACTS ON JS' by Yaroslav Dvorovenko
OdessaJS Conf
 
'GOLANG USAGE IN DEVELOPMENT OF NODE.JS APPLICATIONS (NODE.JS: IN GO WE TRUST...
OdessaJS Conf
 
'MICROFRONTENDS WITH REACT' by Liliia Karpenko
OdessaJS Conf
 
'Web performance metrics' BY ROMAN SAVITSKYI at OdessaJS'2020
OdessaJS Conf
 
'STORY OF ANOTHER ANIMATION' by YURII ARTYUKH at OdessaJS'2020
OdessaJS Conf
 
'JavaScript was invented in Odessa' by DMITRIY GUSEV at OdessaJS'2020
OdessaJS Conf
 
'Why svelte' by BORYS MOHYLA at OdessaJS'2020
OdessaJS Conf
 
'Effective node.js development' by Viktor Turskyi at OdessaJS'2020
OdessaJS Conf
 
'Tensorflow.js in real life' by Pavlo Galushko at OdessaJS'2020
OdessaJS Conf
 
Ad

Recently uploaded (20)

PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Market Insight : ETH Dominance Returns
CIFDAQ
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PPTX
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Market Insight : ETH Dominance Returns
CIFDAQ
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
TrustArc Webinar - Navigating Data Privacy in LATAM: Laws, Trends, and Compli...
TrustArc
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
Agentic AI in Healthcare Driving the Next Wave of Digital Transformation
danielle hunter
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
The Future of AI & Machine Learning.pptx
pritsen4700
 

Rustam Aliyev and Ivan Martynov - From monolith web app to micro-frontends – How we extended microservices architecture to frontend

  • 1. From monolith SPA to micro-frontends How we extended microservices architecture to frontend Rustam Aliyev @rstml Ivan Martynov @j_martyn 07/07/2018 OneDome
  • 2. What is ”microservice”? • Architectural pattern • Collection of loosely coupled services
  • 5. Conway’s Law Produced system design copies organisational structure M. Conway, 1967
  • 6. Frontend (SPA) API Gateway (REST, GraphQL) Backend Database Microservice A Team A Backend Database Microservice B Team B Backend Database Microservice N Team N …
  • 7. Problems of monolith SPA • Ownership ! • Dependency management " • Shared components # • Deployment and releases $ • A/B testing %
  • 8. … Backend Database Microservice A Team A Frontend Backend Database Microservice B Team B Frontend Backend Database Microservice N Team N Frontend… API Gateway (REST, GraphQL)
  • 10. Typical SPA Anatomy • One entry point (index.js) • SPA framework • All components in one bundle ... <script src="https://unpkg.com/react/dist/react.js"></script> <script src="/index.js"></script> ...
  • 11. Complex monolith SPA • All-in-one SPA bundle • Package per product with custom routings • Shared components in separate packages index.js …App A Package App B Package App N Package Shared Components Package(s)
  • 12. Ways to decompose monolith frontend 1. Strong isolation Web Components / IFrame Multiple SPAs / frameworks Communication channels 2. Weak isolation Dependency Injection Single SPA / framework Shared state store
  • 13. … App A Package Team A App B Package Team B App N Package Team N Browser Runtime Dependency Injection Shared Components Package ver.A Shared Components Package ver.B Shared Components Package ver.N Thin SPA (injector) Shared Store (Redux, MobX)
  • 14. /* app/package.json */ { "dependencies" : { "dependency" : "1.0.0" } } /* app.js */ import dependency from 'dependency'; ... dependency.use(); /* index.html */ <script src="/dependency.v1.0.0.js"></script> <script src="/app.v2.0.0.js"></script> <script src="/thin-spa.js"></script> /* app.js */ export default (dependency) => { dependency.use(); } /* thin-spa.js (injector) */ import app from 'app'; import dependency from 'dependency'; ... app(dependency); // wiring Importing vs Dependency Injection
  • 16. Before: project structure Package Thin SPA Package App A Package App B Package Shared Component … Package App N
  • 17. Before: Local development workflow 1. Manual symlink or npm link to test 2. Publish components to NPM 3. Deploy whole app cd ~/components npm link cd ~/application npm link components
  • 18. Monorepo • A single repository holding the code of many packages • Monorepo ≠ monolith Thin SPA Package App A Package App B Package Shared Components Package … App N Package Monorepo Shared Components Package
  • 19. Lerna • Tool for managing monorepo • Inter-dependency management • Publishing • Testing • CLI: bootstrap, publish, etc. • yarn optimised lerna-repo ├─ package.json ├─ lerna.json └─ packages ├─ main-spa │ └─ package.json ├─ design-lib │ └─ package.json ├─ app-a │ └─ package.json └─ app-b ├─ package.json └─ node_modules ├─ design-lib -> ../../design-lib ├─ ...
  • 20. Lerna • Tool for managing monorepo • Inter-dependency management • Publishing • Testing • CLI: bootstrap, publish, etc. • yarn optimised /* lerna.json */ { "lerna": "2.5.1", "npmClient": "yarn", "useWorkspaces": true, // yarn workspaces "version": "independent" } /* package.json */ { // yarn workspaces configuration "workspaces": [ "packages/*" ], "private": true }
  • 21. Lerna: Local development workflow • Automatically interlinking • Inter-dependencies and downstream versions • Automated testing lerna bootstrap # All packages are symlinked now git commit -a -m "Many changes" lerna publish # Changes: # - app-A: 1.0.1 => 1.0.2 # - app-B: 1.2.1 => 1.3.0 # - utils: 1.5.4 => 1.5.5 # - components: 3.0.4 => 3.0.5
  • 23. A … B N … A … B1 N B2 Monorepo (e.g. Git) Web Server Build, test, deployApplications Shared components Micro-frontends Thin SPA
  • 25. Summary Before After Ownership ! " Dependency management # $ Shared components % & Deployment and releases ' ( A/B testing ) *
  • 26. Future work • Applying Web Components • Communication between modules via event bus • Bolt as an alternative to Lerna • Hierarchical dependency injection