MICRO FRONTENDS with React and Redux DevDay 26.05.2018 Matthias @MatthiasLaug Alexandra @astrekalova Prasanna @pvenk
AGENDA •Why micro frontends? •Project •UI integration •Sharing data between services •Achieving consistent design •Testing
Preface : A plea for the Monolith • Monolith are not a bad design choice • Micro Services constraint you to do what is optional* while creating a monolith * but should have done nonetheless
Don’t do Micro Services if you haven’t build successfully a monolith
The monolithic path
- One Repo for the entire application - You ship either all or none - It either scales or it doesn’t - Technology Lock In E - A - O - N
Limitation of scaling teams n(n-1)/2 https://en.wikipedia.org/wiki/Channel_capacity
Evolution
- Work autonomously - Choose the technology suitable for the problem - Release as you please Promises
The Frontend Monolith
Promises - Work autonomously - Choose the technology suitable for the problem - Release as you please
One Codebase
Promises - Work autonomously - Choose the technology suitable for the problem - Release as you please
One Tech Stack
Promises - Work autonomously - Choose the technology suitable for the problem - Release as you please
One Release
What we need!
Micro Frontend? “Do one thing well and own the complete value stream!”
Project
TECH STACK Postcss / Less Webpack create-react-app Jest Enzyme
ARCHITECTURE frame.js search.js financing.js order.js
FRAME Routing Redux store React application Fonts, min CSS service.js
SERVICES Routes Components Reducers Middleware frame.js
UI integration
UI INTEGRATION frame.js search.js financing.js order.js browser On loading the app
UI INTEGRATION frame.js search.js financing.js order.js browser On loading the app ...
EXPORTING DATA IN A SERVICE
EXPORTING DATA IN A SERVICE Webpack config UMD export
LOADING SERVICE DATA INTO FRAME
INTEGRATION OF COMPONENTS
Sharing data between services
The React Way
THE REACT WAY
THE REACT WAY
The Redux Way
THE REDUX WAY One store for the application. Store setup Services have their own sub-store.
THE REDUX WAY Namespaced actions app/service-name/action
THE REDUX WAY Services listen to key events from frame
The Backend Way aka Old school way
THE BACKEND WAY
THE BACKEND WAY Consumer Driven Contracts
Design consistency
DESIGN CONSISTENCY - UI search.css order.css
DESIGN CONSISTENCY - UI search.css order.css
DESIGN CONSISTENCY - UX Design Guild #0078bf 0,120,191 #00bccd 0,188,205 #7dced5 125,206,213 #00aa5b 0,170,91 #85b880 133,184,128 #bdbd32 189,189,50 #fff350 255,243,80 #fbe0ce 251,224,206 #f2ba97 242,186,151 #a17861 161,120,97 #808184 128,129,132 #eeeeee 238,238,238 #ee5ba0 238,91,160 #702269 112,34,105 #b51b58 181,27,88 #ed312f 237,49,47 #f58a33 245,138,51 #5f3c25 95,60,37 Styleguide
Testing strategy
TESTING STRATEGY Unit tests Unit Testing is a practice where the smallest testable parts of an application (units) are individually and independently tested
TESTING STRATEGY Integration Tests CD C Contract D B API
TESTING STRATEGY Functional Tests
TESTING STRATEGY Service level testing Application Smoke Test
Sustain the pace...
Happy to talk more !!! Matthias @MatthiasLaug Alexandra @astrekalova Prasanna @pvenk

Micro frontends with react and redux dev day