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
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.5k
Greatest Disaster Hits in Web Performance
guaca
0
270
Amazon S3 Vectorsを使って資格勉強用AIエージェントを構築してみた
usanchuu
3
450
Codex 5.3 と Opus 4.6 にコーポレートサイトを作らせてみた / Codex 5.3 vs Opus 4.6
ama_ch
0
180
Amazon Bedrock Knowledge Basesチャンキング解説!
aoinoguchi
0
150
Bill One 開発エンジニア 紹介資料
sansan33
PRO
5
17k
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
All About Sansan – for New Global Engineers
sansan33
PRO
1
1.4k
小さく始めるBCP ― 多プロダクト環境で始める最初の一歩
kekke_n
1
450
22nd ACRi Webinar - NTT Kawahara-san's slide
nao_sumikawa
0
100
~Everything as Codeを諦めない~ 後からCDK
mu7889yoon
3
440
Cosmos World Foundation Model Platform for Physical AI
takmin
0
940
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.2k
Evolving SEO for Evolving Search Engines
ryanjones
0
130
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
66
Exploring anti-patterns in Rails
aemeredith
2
250
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.6k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
Un-Boring Meetings
codingconduct
0
200
How to Ace a Technical Interview
jacobian
281
24k
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