Mykhailo Churilov
Lead Software Engineer
Standalone App #1
Standalone App #1
Legacy Mono App
Redirect to external
Back-end
REST communication
JWT
Text
App #2
Shell keeper
App#1 Keeper
App#2 Keeper
App#3 Keeper
Shell
Header
Container
App #1
App #2
App #3
CSS, HTML
CSS, HTML
CSS, HTML
inners CustomElement depend on the route
/app1/root/route
changes route
Script Loader
Identity Service
defines
custom elements
UI lib
Responsibilities:
Responsibilities:
Parses elements schema
Creates node for each item
Register custom DOM element for each node
const components = [{
name: 'vue',
scriptName: 'vue-bundle.min.js',
template: '<div id="app"></div>',
cssPath: null
}, {
name: 'angular',
scriptName: 'ng-bundle.min.js',
template: '<app-root id="app"></app-root>',
cssPath: null
}];
components.forEach((el) => {
const node = Object.create(HTMLElement.prototype);
node.attachedCallback = () => {
const remote = DEFAULT_PATH;
this.appendChild(
document.createRange()
.createContextualFragment(el.template)
);
$.getScript(remote + '/' + el.scriptName)
.done(() => {
window[el.name] = true;
});
};
document.registerElement(el.name + '-app', {
prototype: node
});
});
1. Parses app name in the route
2. Inserts {{app_name}}-app to the DOM
/app1/products/12
/app2/products/12
/error_page
app1 loaded
app2 loaded
no app loaded
App #1
App #2
App #3
CSS, HTML
CSS, HTML
CSS, HTML
Wrapper
Shared Store
ROUTE: /angular/home
ROUTE: /vue/home
For what?
WTF?
App#1 Keeper
App#2 Keeper
App#3 Keeper
Resource management service
Container Stage
Active app #cur
Store events for #cur
Release events for #last
OnAppActivated()
app #1
app #2
app #3
Isolate own styles
Prevent app run on the different app in location
Keep tracking all listeners, so on Exit of app we can easily destroy them
Bootstrap application from JS code
Forget about document and window
CDN for app #1
v_1
v_2
v_3
CDN for app #2
v_1
v_2
v_3
CDN for app #3
v_1
v_2
v_3
Shell
Script Loader
Server
{Config}
GET app#1 v_2
app_1_v_2
bundle
1. Unit Testing of micro-apps
2. E2E
3. Resources Guard
4. Visual testing