Micro frontends is an approach to building frontends that splits the application into multiple independently deliverable components. This approach allows different teams to work on individual components without impacting the work of others and improves scalability. There are two main technical approaches for implementing micro frontends: UI composition, where components are rendered on the client-side using techniques like iframes or custom elements, and server-side composition, where a server acts as a composition layer to combine fragments from multiple sources. The presentation covered the benefits and challenges of both monolithic and microservice architectures as well as examples of implementing micro frontends using UI and server-side composition techniques.
6. o Have many cross-cutting concerns: logging,
limiting, tracking, etc ...
o Easy and fast to develop
o One code base for all team
o Communication overhead
o Tightly coupled, hard to scale and maintain
o Team size grows align with project size
Monolith
7. o Increase scalability and maintainability
o Independent
o Reduce the team’s scope
o Hard to develop
o Increase the deployment complexity
o Cross-cutting concern for each service
Microservices
12. Smaller Team, Clear Mission
do not care about other teams
Narrow Scope
fix to your memory
Frontend Renovation
without throwing everything away
End-to-end Development
communication is easy
Pros Cons
UI Composition
isolate the look and feel
Operational Complexity
complex deployment
Distributed Data
share data b/w micro app
14. UI Composition
Book Store
No Item in
Cart
related book:
Book Name
add to cart
Category
Team
Cart Team
Recommendation
Team
15. UI Composition
- Solutions
• Client Side Rendering
○ HTML Iframe
○ Custom Elements
• Server Side Rendering
o Server Side Include / Edge
Side Include
o Server Side Composition
16. <!DOCTYPE html>
<html>
<body>
<h2>Iframe Example</h2>
<p>Below is an example for embedded iframe in a website</p>
<iframe
src="https://example.com"
style="border:none; border: dashed 3px red"
width="100%"
height="400px">
</iframe>
</body>
</html>
HTML Iframe
17. Custom Elements
o Framework independent components
o Reusability within other components
o The DOM is the API
o Can Be Polyfilled Down to IE11
<cart-count></cart-count>
<category-details prod-id="1">
</category-details>
https://www.webcomponents.org/
19. Browser Support
class ProductDetails extends HTMLElement{
connectedCallback() {
this.innerHTML = '<h1>Product #123 Details</h1>';
}
}
customElements.define('product-details', ProductDetails);
20. Book Store
1 Item in
Cart
related book:
Book Name
add to cart
the DOM is the API
<category-details prod-id="1">
</category-details>
<recommendation-list
for-prod="1">
</recommendation-list>
<cart-count>
</cart-count>
23. Sever Side Composition
Router
Layout Service Layout
Fragments
Router Reverse proxy acting
Layout A collection of layout
Layout
Service
UI composer
Fragments Micro Frontends services
24. Sever Side Composition
Project Mosaic | Microservices for the Frontend
Skipper
extendable HTTP Router for service
composition
Quilt Layout Storage used by Tailor
Tailor
Layout Service, asynchronously fetches
multiple fragments. Partially inspired by
Facebook’s BigPipe.
https://www.mosaic9.org/
25. Book Store
1 Item in
Cart
related book:
Book Name
add to cart
Inter-application Communication
One item is added
Click “add to cart”