Front-end perspective
time
complexity
View
Logic
Data
a large single upright block of stone, especially one shaped into or serving as a pillar or monument.
single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.
View
Feature logic + data
Feature logic + data
Feature logic + data
Feature logic + data
Microservice
Microservice
Microservice
API
Frontend SPA
Microservice
Microservice
Microservice
Microservice
Microservice
Feature
Feature
Feature
Feature
Feature
Front end
Backend
Data
The idea behind Micro Frontends is to think about a website or web app as a composition of features which are owned by independent teams. Each team has a distinct area of business or mission it cares about and specialises in.
micro-frontends.org
User
Search
Job Offers
Brands
Increase productivity - ship features faster
Minimise tech debt
Increase autonomy of development teams
Avoid tech stack lock-in
Progressive rewrites of big codebases
Let's see how others do it.
Project Mosaic
Stich Framework
OpBox
Web components are a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps.
Custom elements
class UserView extends HTMLElement {...}
window.customElements.define('user-view', UserView);
<user-widget />
<search-widget />
<job-offers-app />
<brands-widget />
UI Shell
router and basic layout
Invoicing
Support
Backup
Scheduler
<Router history={history}>
<Home path="/" />
<UserPage path="/mysettings" />
<PageNotFound path="/404" />
<SubApp path="/:subappname" setup={{ ...amplifySetup }} />
</Router>
function initializeSubApp(routeDesc, setup) {
loadScriptFromUrl(routeDesc).then(({ routeDesc, setup }) =>
window.subAppFactory.init(
{ title: routeDesc.title, ...setup },
routeDesc.component
);
//...return store action with sub app creation success
)
}
returns a factory with init() method, which should register a web-component under provided DOMString tags
function init(setup = {}, tag = "my-component"){
ReactCustomElement(<App setup={setup} />, tag);
}
ReactCustomElement is a custom tailored function that mounts a react app into shadow dom based web component.
It depends.
Micro Frontends architecure
comes with initial costs.
https://martinfowler.com