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
Vamos Falar Sobre Micro Frontends
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Nélio Frazão
March 12, 2020
Technology
0
160
Vamos Falar Sobre Micro Frontends
Talk apresentada no 8° Meet-up do Paraíba JS
Nélio Frazão
March 12, 2020
Tweet
Share
More Decks by Nélio Frazão
See All by Nélio Frazão
Trabalhando com Arrays e Objetos
neliofrazao
0
27
Aula de introdução a JS
neliofrazao
0
39
Vamos falar sobre TDD
neliofrazao
0
20
Other Decks in Technology
See All in Technology
We Built for Predictability; The Workloads Didn’t Care
stahnma
0
140
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
ブロックテーマ、WordPress でウェブサイトをつくるということ / 2026.02.07 Gifu WordPress Meetup
torounit
0
190
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
インフラエンジニア必見!Kubernetesを用いたクラウドネイティブ設計ポイント大全
daitak
1
370
OpenShiftでllm-dを動かそう!
jpishikawa
0
130
Oracle AI Database移行・アップグレード勉強会 - RAT活用編
oracle4engineer
PRO
0
100
Red Hat OpenStack Services on OpenShift
tamemiya
0
120
予期せぬコストの急増を障害のように扱う――「コスト版ポストモーテム」の導入とその後の改善
muziyoshiz
1
2k
22nd ACRi Webinar - NTT Kawahara-san's slide
nao_sumikawa
0
100
AWS Network Firewall Proxyを触ってみた
nagisa53
1
240
Context Engineeringが企業で不可欠になる理由
hirosatogamo
PRO
3
620
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
220
Building the Perfect Custom Keyboard
takai
2
690
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
52
Crafting Experiences
bethany
1
49
Documentation Writing (for coders)
carmenintech
77
5.3k
Facilitating Awesome Meetings
lara
57
6.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
The Mindset for Success: Future Career Progression
greggifford
PRO
0
240
The Art of Programming - Codeland 2020
erikaheidi
57
14k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
97
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Transcript
VAMOS FALAR SOBRE MICRO FRONTEND Palestrante: Nélio Frazão Email:
[email protected]
SOBRE NÉLIO Nélio Frazão, Frontend, com 12 anos de experiência.
Possui MBA em Marketing Digital, pela Faculdade Estácio/Idez em /João Pessoa/PB. e especialista em Desenvolvimento de Aplicações para WEB pelo UNIPÊ
ENTENDENDO O PROBLEMA SPA (MONOLITO) DB Backend (MONOLITO) A P
I G A T W A Y
DESVANTAGENS MONOLITO Baixa Escalabilidade Falta de Flexibilidade Code Base Gigante
Complexidade Preso a uma única tecnologia. Exige que todo o sistema seja replicado. Quanto maior o sistema, maior é a base de código. Dificuldade nas entregas contínuas.
MICRO SPA (MONOLITO) DB CHECKOUT SERVICE A P I G
A T W A Y DB CATALOG SERVICE
E SE O FRONT END...
MICRO FRONT END CHECKOUT FRONT END DB CHECKOUT SERVICE A
P I G A T W A Y DB CATALOG SERVICE CATALOG FRONT END B A S E A P P
MICRO FRONT END Base APP
DEFININDO MICRO FRONTEND Um estilo de arquitetura onde podem ser
feitas entregas independentes de fragmentos de frontend que compõem uma aplicação maior.
VANTAGENS MICRO FRONTEND DEPLOY INDEPENDENTE UPGRADES INCREMENTAIS MÚLTIPLAS TECNOLOGIAS TIMES
AUTONOMOS
O QUE DEVEMOS ESPERAR DE UM MICRO FRONTEND? AGNÓSTICO DE
TECNOLOGIA ISOLAR CÓDIGO DA EQUIPE DEPLOY INDEPENDENTE CONVENÇÕES DE TRABALHO
IMPLEMENTAÇÃO BUILD-TIME COMPOSITION RUN-TIME COMPOSITION VS
BUILD-TIME COMPOSITION CHECKOUT FRONT END CATALOG FRONT END Base APP
PACKAGE REGISTRY
BUILD-TIME INTEGRATION { "name": "@ecommerce/container" , "version": "1.0.0", "description": "some
ecommerce app" , "dependencies": { "@ecommerce/checkout": "^1.2.3", "@ecommerce/catalog": "^4.5.6", } }
BUILD-TIME COMPOSITION Bundles Independentes Times separados por contexto Arquitetura monolítica
para diferentes times Sem deploys independentes
RUN-TIME COMPOSITION CHECKOUT FRONT END CATALOG FRONT END BASE APP
BUILD-TIME COMPOSITION Times independentes Deploys indepentes Pode haver muitas requisições
no lado do usuário
SERVER-SIDE TEMPLATE COMPOSITION USER'S BROWSER SERVICE 2 N G I
N X CONTAINER APP SERVER SERVICE 1 <esi:include src="include/service1" />
SERVER-SIDE TEMPLATE COMPOSITION <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title>Feed
me</title> </head> <body> <h1> Feed me</h1> <esi:include src="/order" /> </body> </html> server { listen 8080; server_name localhost; root /usr/share/nginx/html; index index.html; ssi on; rewrite ^/$ http:/ /localhost:8080/browse redirect; location /browse { set $PAGE 'browse'; } location /order { set $PAGE 'order'; } location /profile { set $PAGE 'profile' } error_page 404 /index.html; } variável $PAGE guarda a URL que está sendo solicitado:
RUN-TIME INTEGRATION VIA IFRAMES <iframe src="http:/ /micro2.com"/> <iframe src="http:/micro3.com"/> <iframe
src="http:/ /www.micro1.com"/>
RUN-TIME INTEGRATION VIA WEB COMPONENTS MICRO-APP2 MICRO-APP3 MICRO-APP1
<h1>Welcome to Feed me!</h1> <script src="https:/ /browse.example.com/bundle.js"></script> <script src="https:/ /order.example.com/bundle.js"></script>
<script src="https:/ /profile.example.com/bundle.js"></script> <div id="micro-frontend-root"></div> <script type="text/javascript"> const webComponentsByRoute = { '/': 'micro-frontend-browse-restaurants', '/order-food': 'micro-frontend-order-food', '/user-profile': 'micro-frontend-user-profile', }; const webComponentType = webComponentsByRoute[window.location.pathname]; const root = document.getElementById('micro-frontend-root'); const webComponent = document.createElement(webComponentType); root.appendChild(webComponent); </script> EXEMPLO
SINGLE-SPA BOOTSTRAP MOUNT( ) UNMOUNT( )
COMPARTILHANDO DADOS
PROPS <ContainerApp className={classes.root}> <Product item={this.props.selectedItem} /> <ProductReview item={this.props.selectedItem} /> </ContainerApp>
STATE MANAGEMENT TOOLS
DOM EVENTS let event = new Event(click) elem.dispatchEvent(event) elem.addEventListener(click, e
=> { /* code */}, false ) DISPATCH O EVENTO ESCUTA O EVENTO
DESIGN DESIGN
TESTS TESTS
CONSIDERAÇÕES FINAIS CONSIDERAÇÕES FINAIS
OBRIGADO
[email protected]
http:/ /www.linkedin.com/in/neliofrazao