SlideShare a Scribd company logo
Angular Based Frontend
Architecture
Himanshu Tamrakar
About me
Himanshu Tamrakar | Developer at Decimal
Email: himanshu.tamrakar@outlook.com
Contact No. : (+91)-8989468903
Github: https://github.com/Himanshu-Tamrakar
Agenda Introduction
(npm)- package
Mono repo
Micro Frontend
How to choose
Introduction
Root Module Feature Modules Shared Module
App Module
...
Feature Module 1
Shared Module
Typical Angular Architecture
Feature Module 2
1. (npm)-package
(npm)-package
Concept
➔ Node_module
➔ Your stuff
➔ Package.json
➔ package-lock.json
Angular Package Formatter
➔ Google Guidelines For Creating Library To Work Seamlessly With Angular
Tool for aligning towards library
➔ ng-packagr
.
Angular CLI6+
1
Creating Library
using CLI 6+
01
Since angular CLI6+, we have an option to
generate library which follow all guidelines
proposed by google.
Commands
➔ npm install -g @angular/cli
➔ ng new lib-project --create-application=false
➔ cd lib-project
➔ ng generate library password-strength-lib
➔ ng generate application playground-app
➔ ng server --project playground-app
➔ ng build --project password-strength-lib
Folder Structure
02
Folder structure after creating
password-strength-lib library and
playgroung-app application
playgroung-app is to test library. It
helps creating documentation related to
library and library maintenance.
Publish library to
npm registry
03
--registry option is to point to particular
registry. It could be npm public or in-house
registry.
➔ Increment package version
➔ ng build --project password-strength-lib
➔ npm publish --registry http://localhost
➔ npm install --registry http://localhost
➔ Another way to manager library
Publish library to
local artifactory
04
npm pack command package you library
build into .tgz file
➔ Increment package version
➔ ng build --project password-strength-lib
➔ Write script in package.json
➔ "build_lib": "ng build password-strength-lib"
➔ "npm_pack": "cd dist/password-strength-lib
&& npm pack"
➔ "package": "npm run build_lib && npm run
npm_pack"
➔ npm install ‘path to .tgz file..’
package.json
➔ Distribution
➔ Versioning
➔ Decoupling between library author and app author
Advantages
Disadvantages
➔ Distribution
➔ Versioning
➔ Decoupling between library author and app author
Distribution
➔ Annoying
➔ Stop organizations
to develop further
library
Versioning
➔ Version management cost
is high
➔ Version Conflicts
➔ How to force developers to
use latest version of npm
package
What is app author is same
as lib author
Conclusion
When it comes to big project or ecosystem, we need something better than library.
Note: Inv compiled library build can’t be published to npm registry. If you are creating a library using
Angular 9 then you have to compile your library without Inv compiler. For this mentions enableIvy: false
at angularCompilationOption at .tsconfig.json.
Reason: It uses ViewEngine.
2. Mono repo
Folder Structure
It’s call a workspace that contains several
tiny self contained projects. Library also
works as project in monorepo. To use
library, we need not to build and publish.
Further we can publish library is necessary.
We have one node_module for all projects.
➔ Every projects uses latest version
➔ No version conflicts
➔ No burden of distributing library
➔ Creating new library is very easy
➔ You can even publish your library easily
➔ Successfully used at Google, Facebook...
Advantages
Ways of creating
Monorepo
architecture
Nx is not a replacement for Angular CLI.
Under the hood, Nx uses the Angular CLI to
generate code and run tasks.
➔ By Angular CLI 6+
➔ By nx-nrwl
Monorepo
architecture using
Angular CLI
We access project by project name. This
could be possible because we define public
api in project src folder.
Note: Using mono repo in organization is
not for beginner or intermediate
programmer.
➔ npm install -g @angular/cli
➔ ng new vahana-workspace --create-application=false
➔ cd vahana-workspace
➔ ng generate application login, iam, vdesigner, vconnect
➔ ng generate library validation, dashboard-lib
➔ We need to update path in .tsconf file
Folder Structure
It’s call a workspace that contains several
tiny self contained projects. Library also
works as project in monorepo. To use
library, we need not to build and publish.
Further we can publish library is necessary.
We have one node_module for all projects.
.tsconfig file in cli
generated monorepo
Check the path statement. When ever we
import validation or dashboard-lib, It point
to there public apis.
Monorepo
architecture using
Nx-nrwl
Nx provide more features that will use full
when creating many projects. It provide
many feature like dep-graph generate
visual dependency graph between projects.
➔ npx create-nx-workspace vahana-workspace-nx
➔ Select angular type mono repo
➔ cd vahana-workspace-nx
➔ ng g @nrwl/angular:app account, aim, vconnect….
➔ ng g @nrwl/angular:lib chart-lib, dashboard-api-lib..
➔ ng serve --project account
➔ npm run dep-graph
Folder Structure
.tsconfig file in nx
generated monrepo
Visualize Module Structure
Graph dependencies within workspace. npm run dep-graph generate visualize dependency graph within
workspace.
Demo
➔ Tightly couples or contract. It is hard to break
the contract.
➔ Complex structure
➔ One architecture, Hard to change
➔ One Technology stack
Disadvantages
➔ More coordination
➔ Blocking tasks
➔ Dependency with other team.
➔ You can’t deploy your code until your
colleague done with his code or
➔ You can’t even start you work until your
colleague finished his work.
Conclusion?
3. Micro Frontend
Idea Here is
…….
BIG System
Micro Frontend 1
Micro Frontend 3 Micro Frontend n
Micro Frontend 2
…..
➔ Separate development and deployment
➔ Different technology
➔ Less coordination
➔ Less complexity
Advantages
➔ Highly distributed system
➔ Distributed data
➔ UI composition
Disadvantages
Note: UI-composition means that to provide hole system software as one consistent thing to the
users.
Solution to micro
frontend
Hyperlinks are best and secure way to
move to another document.
➔ UI composition using hyperlinks
➔ SPA based shell app
UI composition using Hyperlinks
APP 1 APP 2 APP 3
SPA based shell
SPA 1 SPA 2 SPA 3
SHELL APP
SPA based shell
SPA 1 SPA 2 SPA 3
SHELL APP
➔ Iframe
➔ Web components
➔ Bootstrapping several spa’s
4. How to choose
Decision Tree
Questions?
References
Enterprise Angular
Confluence: Angular Library
Confluence: Architecture Web Based Enterprise application
Confluence: Web components
Angular based enterprise level frontend architecture

More Related Content

What's hot (20)

PPTX
Jenkins presentation
Valentin Buryakov
 
PPTX
Git and GitFlow branching model
Pavlo Hodysh
 
PDF
Git training v10
Skander Hamza
 
PDF
Introduction to GitHub Actions
Bo-Yi Wu
 
PPTX
ISTIO Deep Dive
Yong Feng
 
PPTX
Jenkins for java world
Ashok Kumar
 
PPTX
Spring Boot and REST API
07.pallav
 
PDF
Angular & RXJS: examples and use cases
Fabio Biondi
 
PDF
Introduction to Github Actions
Knoldus Inc.
 
PPTX
Gitlab CI/CD
JEMLI Fathi
 
PDF
Documenting your REST API with Swagger - JOIN 2014
JWORKS powered by Ordina
 
PDF
Micro Frontends
Spyros Ioakeimidis
 
PPTX
Understanding REST APIs in 5 Simple Steps
Tessa Mero
 
PPTX
Micro frontend
Amr Abd El Latief
 
PPT
TypeScript Presentation
Patrick John Pacaña
 
PDF
Jenkins
Roger Xia
 
PPTX
CI-CD WITH GITLAB WORKFLOW
AddWeb Solution Pvt. Ltd.
 
PDF
CI/CD with Github Actions
Md. Minhazul Haque
 
PDF
Continuous Integration With Jenkins
Edureka!
 
PDF
Default GitLab CI Pipeline - Auto DevOps
Rajith Bhanuka Mahanama
 
Jenkins presentation
Valentin Buryakov
 
Git and GitFlow branching model
Pavlo Hodysh
 
Git training v10
Skander Hamza
 
Introduction to GitHub Actions
Bo-Yi Wu
 
ISTIO Deep Dive
Yong Feng
 
Jenkins for java world
Ashok Kumar
 
Spring Boot and REST API
07.pallav
 
Angular & RXJS: examples and use cases
Fabio Biondi
 
Introduction to Github Actions
Knoldus Inc.
 
Gitlab CI/CD
JEMLI Fathi
 
Documenting your REST API with Swagger - JOIN 2014
JWORKS powered by Ordina
 
Micro Frontends
Spyros Ioakeimidis
 
Understanding REST APIs in 5 Simple Steps
Tessa Mero
 
Micro frontend
Amr Abd El Latief
 
TypeScript Presentation
Patrick John Pacaña
 
Jenkins
Roger Xia
 
CI-CD WITH GITLAB WORKFLOW
AddWeb Solution Pvt. Ltd.
 
CI/CD with Github Actions
Md. Minhazul Haque
 
Continuous Integration With Jenkins
Edureka!
 
Default GitLab CI Pipeline - Auto DevOps
Rajith Bhanuka Mahanama
 

Similar to Angular based enterprise level frontend architecture (20)

PPTX
Web worker in your angular application
Suresh Patidar
 
PDF
Dockercon EU 2014
Rafe Colton
 
PDF
When to use Serverless? When to use Kubernetes?
Niklas Heidloff
 
PPTX
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
PDF
The path to a serverless-native era with Kubernetes
sparkfabrik
 
PPTX
Angular4 getting started
TejinderMakkar
 
PDF
Grunt training deck
James Ford
 
PPTX
Angular on ASP.NET MVC 6
Noam Kfir
 
PDF
The Self-Service Developer - GOTOCon CPH
Laszlo Fogas
 
PDF
CI/CD Across Multiple Environments
Karl Isenberg
 
PPTX
Next Generation N-API
Nicola Del Gobbo
 
DOCX
Gaganjot Kaur- The Nx Workspace.docx
Gaganjot kaur
 
PDF
Rejekts 24 EU No GitOps Pain, No Platform Gain
Łukasz Piątkowski
 
PDF
Red Hat Forum Benelux 2015
Microsoft
 
PDF
Web componenet using angular element
Himanshu Tamrakar
 
PPTX
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
VMware Tanzu
 
PDF
Chromium: NaCl and Pepper API
Chang W. Doh
 
PPTX
How create react app help in creating a new react applications
Concetto Labs
 
PDF
Deploying to DigitalOcean With GitHub Actions
DigitalOcean
 
PPTX
Cloud native buildpacks-cncf
Suman Chakraborty
 
Web worker in your angular application
Suresh Patidar
 
Dockercon EU 2014
Rafe Colton
 
When to use Serverless? When to use Kubernetes?
Niklas Heidloff
 
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
Docker, Inc.
 
The path to a serverless-native era with Kubernetes
sparkfabrik
 
Angular4 getting started
TejinderMakkar
 
Grunt training deck
James Ford
 
Angular on ASP.NET MVC 6
Noam Kfir
 
The Self-Service Developer - GOTOCon CPH
Laszlo Fogas
 
CI/CD Across Multiple Environments
Karl Isenberg
 
Next Generation N-API
Nicola Del Gobbo
 
Gaganjot Kaur- The Nx Workspace.docx
Gaganjot kaur
 
Rejekts 24 EU No GitOps Pain, No Platform Gain
Łukasz Piątkowski
 
Red Hat Forum Benelux 2015
Microsoft
 
Web componenet using angular element
Himanshu Tamrakar
 
Exploring Next Generation Buildpacks - Anand Rao & Scott Deeg
VMware Tanzu
 
Chromium: NaCl and Pepper API
Chang W. Doh
 
How create react app help in creating a new react applications
Concetto Labs
 
Deploying to DigitalOcean With GitHub Actions
DigitalOcean
 
Cloud native buildpacks-cncf
Suman Chakraborty
 
Ad

Recently uploaded (20)

PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
DOCX
Import Data Form Excel to Tally Services
Tally xperts
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPTX
How Cloud Computing is Reinventing Financial Services
Isla Pandora
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Import Data Form Excel to Tally Services
Tally xperts
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
How Cloud Computing is Reinventing Financial Services
Isla Pandora
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
MailsDaddy Outlook OST to PST converter.pptx
abhishekdutt366
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Online Queue Management System for Public Service Offices in Nepal [Focused i...
Rishab Acharya
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Ad

Angular based enterprise level frontend architecture

  • 2. About me Himanshu Tamrakar | Developer at Decimal Email: [email protected] Contact No. : (+91)-8989468903 Github: https://github.com/Himanshu-Tamrakar
  • 3. Agenda Introduction (npm)- package Mono repo Micro Frontend How to choose
  • 5. Root Module Feature Modules Shared Module App Module ... Feature Module 1 Shared Module Typical Angular Architecture Feature Module 2
  • 7. (npm)-package Concept ➔ Node_module ➔ Your stuff ➔ Package.json ➔ package-lock.json
  • 8. Angular Package Formatter ➔ Google Guidelines For Creating Library To Work Seamlessly With Angular
  • 9. Tool for aligning towards library ➔ ng-packagr .
  • 11. 1 Creating Library using CLI 6+ 01 Since angular CLI6+, we have an option to generate library which follow all guidelines proposed by google. Commands ➔ npm install -g @angular/cli ➔ ng new lib-project --create-application=false ➔ cd lib-project ➔ ng generate library password-strength-lib ➔ ng generate application playground-app ➔ ng server --project playground-app ➔ ng build --project password-strength-lib
  • 12. Folder Structure 02 Folder structure after creating password-strength-lib library and playgroung-app application playgroung-app is to test library. It helps creating documentation related to library and library maintenance.
  • 13. Publish library to npm registry 03 --registry option is to point to particular registry. It could be npm public or in-house registry. ➔ Increment package version ➔ ng build --project password-strength-lib ➔ npm publish --registry http://localhost ➔ npm install --registry http://localhost ➔ Another way to manager library
  • 14. Publish library to local artifactory 04 npm pack command package you library build into .tgz file ➔ Increment package version ➔ ng build --project password-strength-lib ➔ Write script in package.json ➔ "build_lib": "ng build password-strength-lib" ➔ "npm_pack": "cd dist/password-strength-lib && npm pack" ➔ "package": "npm run build_lib && npm run npm_pack" ➔ npm install ‘path to .tgz file..’
  • 16. ➔ Distribution ➔ Versioning ➔ Decoupling between library author and app author Advantages
  • 17. Disadvantages ➔ Distribution ➔ Versioning ➔ Decoupling between library author and app author
  • 18. Distribution ➔ Annoying ➔ Stop organizations to develop further library Versioning ➔ Version management cost is high ➔ Version Conflicts ➔ How to force developers to use latest version of npm package What is app author is same as lib author
  • 19. Conclusion When it comes to big project or ecosystem, we need something better than library. Note: Inv compiled library build can’t be published to npm registry. If you are creating a library using Angular 9 then you have to compile your library without Inv compiler. For this mentions enableIvy: false at angularCompilationOption at .tsconfig.json. Reason: It uses ViewEngine.
  • 21. Folder Structure It’s call a workspace that contains several tiny self contained projects. Library also works as project in monorepo. To use library, we need not to build and publish. Further we can publish library is necessary. We have one node_module for all projects.
  • 22. ➔ Every projects uses latest version ➔ No version conflicts ➔ No burden of distributing library ➔ Creating new library is very easy ➔ You can even publish your library easily ➔ Successfully used at Google, Facebook... Advantages
  • 23. Ways of creating Monorepo architecture Nx is not a replacement for Angular CLI. Under the hood, Nx uses the Angular CLI to generate code and run tasks. ➔ By Angular CLI 6+ ➔ By nx-nrwl
  • 24. Monorepo architecture using Angular CLI We access project by project name. This could be possible because we define public api in project src folder. Note: Using mono repo in organization is not for beginner or intermediate programmer. ➔ npm install -g @angular/cli ➔ ng new vahana-workspace --create-application=false ➔ cd vahana-workspace ➔ ng generate application login, iam, vdesigner, vconnect ➔ ng generate library validation, dashboard-lib ➔ We need to update path in .tsconf file
  • 25. Folder Structure It’s call a workspace that contains several tiny self contained projects. Library also works as project in monorepo. To use library, we need not to build and publish. Further we can publish library is necessary. We have one node_module for all projects.
  • 26. .tsconfig file in cli generated monorepo Check the path statement. When ever we import validation or dashboard-lib, It point to there public apis.
  • 27. Monorepo architecture using Nx-nrwl Nx provide more features that will use full when creating many projects. It provide many feature like dep-graph generate visual dependency graph between projects. ➔ npx create-nx-workspace vahana-workspace-nx ➔ Select angular type mono repo ➔ cd vahana-workspace-nx ➔ ng g @nrwl/angular:app account, aim, vconnect…. ➔ ng g @nrwl/angular:lib chart-lib, dashboard-api-lib.. ➔ ng serve --project account ➔ npm run dep-graph
  • 29. .tsconfig file in nx generated monrepo
  • 30. Visualize Module Structure Graph dependencies within workspace. npm run dep-graph generate visualize dependency graph within workspace.
  • 31. Demo
  • 32. ➔ Tightly couples or contract. It is hard to break the contract. ➔ Complex structure ➔ One architecture, Hard to change ➔ One Technology stack Disadvantages ➔ More coordination ➔ Blocking tasks ➔ Dependency with other team. ➔ You can’t deploy your code until your colleague done with his code or ➔ You can’t even start you work until your colleague finished his work.
  • 35. Idea Here is ……. BIG System Micro Frontend 1 Micro Frontend 3 Micro Frontend n Micro Frontend 2 …..
  • 36. ➔ Separate development and deployment ➔ Different technology ➔ Less coordination ➔ Less complexity Advantages
  • 37. ➔ Highly distributed system ➔ Distributed data ➔ UI composition Disadvantages Note: UI-composition means that to provide hole system software as one consistent thing to the users.
  • 38. Solution to micro frontend Hyperlinks are best and secure way to move to another document. ➔ UI composition using hyperlinks ➔ SPA based shell app
  • 39. UI composition using Hyperlinks APP 1 APP 2 APP 3
  • 40. SPA based shell SPA 1 SPA 2 SPA 3 SHELL APP
  • 41. SPA based shell SPA 1 SPA 2 SPA 3 SHELL APP ➔ Iframe ➔ Web components ➔ Bootstrapping several spa’s
  • 42. 4. How to choose
  • 45. References Enterprise Angular Confluence: Angular Library Confluence: Architecture Web Based Enterprise application Confluence: Web components