Whitepaper Micro Frontend PDF
Whitepaper Micro Frontend PDF
Micro Front-Ends are small applications that can be work integrated, isolated, and can have
independent deployment cycles.
It is a technique for building a modern web application with multiple teams using different
JavaScript frameworks. Instead of old monolith methodology we can create apps in multiple
frameworks (and even vanilla JS), loading them together using the same router, same domain
and without refreshing the page. This gives us the ability to work separately and make separated
single page applications that can work independently, isolated and tested. We can load and
deploy them and use them together under one building system.
Because of its modular structure micro frontend is highly scalable when you need to grow
the business. Even it is open to upgrading to the latest technology ranging from web,
mobile, Internet of Things, wearables or simply to a newer framework.
Better Maintenance:
By creating small applications or modules, resources and teams can proficiently work in
separate technologies in their isolated micro-frontend reducing the risk of conflicts, bugs,
and deployment delays.
Technologies:
Teams can work in different front-end technologies without conflicting with each other.
We can take advantages of the people we have and even play around with newer
technologies at a low risk.
High Resilience:
In Micro frontend web apps are distributed in small chunks of services starting from the
UI to API integration that works independently. So, even if one feature faces the issue, it
doesn’t affect the rest of the web app. And this feature makes it possible to recover from
the error faster.
Custom elements are a Web Platform feature currently supported by Chrome, Opera, and Safari,
and available in other browsers through polyfills (see Browser Support). A custom element
extends HTML by allowing you to define a tag whose content is created and controlled by
JavaScript code. The browser maintains a CustomElementRegistry of defined custom elements
(also called Web Components), which maps an instantiable JavaScript class to an HTML tag.
The @angular/elements package exports a createCustomElement() API that provides a bridge
from Angular's component interface and change detection functionality to the built-in DOM API.
Custom elements bootstrap themselves - they start automatically when they are added to the
DOM, and are automatically destroyed when removed from the DOM. Once a custom
element is added to the DOM for any page, it looks and behaves like any other HTML
element.
npm i -g @angular/cli
ng new app-shell-custom-elements
ng add @angular/elements
3. Create a component:
Create component with Input and Output and implement working custom elements that are
understood by browsers:
We are using ViewEncapsulation.Native to isolate the style of component, so that the styles
are bundled with the template and the component’s class into one file.
@Component({
moduleId: module.id,
templateUrl: 'user-management.component.html',
styleUrls: ['user-management.component.scss'],
encapsulation: ViewEncapsulation.Native
})
get loggedInUser() {
return this.currentUser;
}
ngOnInit() {
}
getUserList() {
// @Todo get user list from API
this.userList.emit(new Array());
}
}
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpClientModule,
AppRoutingModule,
NgbModule.forRoot()
],
declarations: [
AppComponent,
AlertComponent,
UserManagementComponent
],
providers: [
AuthGuard,
JwtInterceptorProvider,
ErrorInterceptorProvider
],
bootstrap: [AppComponent]
})
<app-user-management
[currentUser]="currentUser" [userList]="userList">
</app-user-management>
https://www.youtube.com/watch?v=vHI5C-9vH-E