Slide 1

Slide 1 text

Introduction to Micro Frontends @ivanjov96

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

We want something new!

Slide 5

Slide 5 text

But now we can!

Slide 6

Slide 6 text

I present you The Micro Frontends!

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

Ivan Jovanovic Senior software engineer @ nearForm https://ivanjov.com @ivanjov96

Slide 9

Slide 9 text

Serbia

Slide 10

Slide 10 text

What are Micro Frontends?

Slide 11

Slide 11 text

Micro Frontends - a microservice approach to the modern web

Slide 12

Slide 12 text

What are Microservices?

Slide 13

Slide 13 text

Microservices is an architectural style that structures an application as a collection of loosely coupled services

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

Event bus

Slide 16

Slide 16 text

Event bus allows publish-subscribe-style communication between components without requiring the components to explicitly register with one another

Slide 17

Slide 17 text

Microservice principles • Lightweight protocol between services • Small services, one job per service • Service independence • Easier to understand, develop and test • Speeds up development • Enables continues delivery and deployment

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

VS VS

Slide 22

Slide 22 text

+ +

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

App Footer Body Header

Slide 25

Slide 25 text

Root app App 3 App 2 App 1 Header Body Footer

Slide 26

Slide 26 text

How did we get here? • Monolith full stack apps • Frontend and backend apps • Microservices in the backend • Components on the UI • Micro frontends

Slide 27

Slide 27 text

We need to fight with the bad architecture!

Slide 28

Slide 28 text

What problem does it solve? • Use new frontend framework on the old architecture • No more shared codebases and conflicts • Independent deployments • Each team can pick their own stack • You can easily scale your frontend app

Slide 29

Slide 29 text

How to split apps? • By functionality on the page • By page • By section

Slide 30

Slide 30 text

Implementation • External app bootstrapping • IFrames • Single-spa library • Frint framework

Slide 31

Slide 31 text

External app bootstrapping

Slide 32

Slide 32 text

External app bootstrapping • Code lives on different server • Independent deployment • Communication is done through: • Window object • Event bus

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

React app

Slide 36

Slide 36 text

React app export

Slide 37

Slide 37 text

Fetching React app in the Root app

Slide 38

Slide 38 text

Event bus - Eev • https://github.com/chrisdavies/eev • Less than 500 bytes minified + zipped • Really fast • Zero dependencies • Simple

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

IFrames

Slide 43

Slide 43 text

IFrames • Code lives on different server • Independent deployment • Communication is done through browser “Event bus”

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

Single-spa library

Slide 50

Slide 50 text

Single-spa library • https://github.com/CanopyTax/single-spa • Use multiple frameworks on the same page without refreshing the page • Write code using a new framework, without rewriting your existing app • Lazy load code for improved initial load time

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

Single-spa library • Code lives on the same server • Everything is bundled and deployed at the same time • Communication is done through: • Window object • Event bus • Shared state (Redux etc.) • Whatever works for you…

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Loading function

Slide 55

Slide 55 text

Activity function

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

Single-spa app

Slide 58

Slide 58 text

Bootstrap

Slide 59

Slide 59 text

Mount

Slide 60

Slide 60 text

Unmount

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Frint

Slide 65

Slide 65 text

Frint • https://frint.js.org/ • CLI • Routing • State management • Server side rendering supported

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

Frint CLI

Slide 68

Slide 68 text

Frint CLI

Slide 69

Slide 69 text

Reactive Programming

Slide 70

Slide 70 text

It works with React Native!!!

Slide 71

Slide 71 text

Who is using Micro Frontends?

Slide 72

Slide 72 text

And many more…

Slide 73

Slide 73 text

Everyone!

Slide 74

Slide 74 text

Conclusion • Don’t use this if you have a simple app • Use micro frontends to make things easier, not complicated • Micro frontends architecture doesn’t mean to use every framework in the world • Don’t forget to make standards across micro apps

Slide 75

Slide 75 text

Thank you! Blog ivanjov.com Twitter @ivanjov96