Why are we doing this?
App with NavBar
App1
App2
App3
App4
Repo 1
Repo 2
Repo 3
Repo 4
Each App is loaded via URL routing
App
Build and deployment
Build code on GitHub Action
Push the build artifact to DB
X = number of Apps
Sharing code became problem
Design System and Shared Libs
V3
V2
V1
App1
App3
App5
App2
App4
App6
App7
App8
App9
A build tool with mono-repo support
We have a mono-repo with Angular and Nx, which contains Angular Apps, NextJs App, Libraries, Unit Test, and e2e. We use Trunk based development approach.
2M LOC
200 Projects
40+ Apps
40+ Teams
Shell App
App1
App2
App3
App4
Single repository
Build
Build all the projects including apps and libraries and bundle them together.
Unit Test
We use jest and cypress component test to write unit tests and run them before merging our code.
e2e
For end to end we run all User Journey test suites before going to development.
npx nx generate @nx/angular:host
--name=shell
--remotes=home,about,blogs
Feature Flag is tricky but becomes very essential when we are shipping features frequently and want to make sure we dont break existing functionality.Â
What tool do we use for Feature Flag?
nx add @nx/plugin
nx g @nx/plugin:plugin
nx-plugin
--directory infra/nx-plugin
Ability to enable/disable flag
Update feature flags by creating a Pull Request
Dashboard
Dashboard to view all active features
Weekly Alert
Alert to clear the feature flags once they are GA (Generally Available)
We need our developers to ship POCs fast so they can experiment and meet our customer's future needs.
@nx/angular:remote
--name=llm-agent
--no-interactive
Nx Generator
export default async function (tree: Tree, schema: ApplicationGeneratorSchema) {
// call built-in generator from Nx
await generateAngularProject(tree, {
standalone: false,
name: schema.name,
style: "scss",
skipPackageJson: true,
port: schema.port,
e2eTestRunner: E2eTestRunner.None,
tags: tags,
prefix: "org-name",
});
// Add cypress component test when apps are created
await generateComponentTests(tree, {
project: schema.name,
port: schema.componentTestPort,
generateTests: false,
buildTarget: `${schema.name}:build-component-test`,
});
}
export default async function (tree: Tree, schema: ApplicationGeneratorSchema) {
// add files to new project if needed
generateFiles(tree, join(__dirname, 'files'), `${projectConfig.root}`, {
name: options.name, // Pass options which can be used inside file
});
}
// index.html.template
<h1>
<<%= name %>>
</<%= name %>>
</h1>
// Ths above file will be created with name passed as parameter on line no:5
Once all is removed that can be removed, that is how designs are truly in their simplest form.
nx graph
nx import [sourceRepository] [destinationDirectory]
It's always a challenge to introduce tools into a project.
nx add @nx/cypress
nx add @nx/playwright
Add e2e framework
nx add @nx/jest
nx add @nx/vite:test
Add Unit Test Tool
nx migrate latest
Keep your monorepo and tooling updated
We need to build 2M lines of code, and we get 100+ Pull Requests every day, we need to run Build, Unit Test, e2e.
GitHub Actions + Nx =
SuperpowerÂ
Merge Queue and User Journey Tests
PR 1
PR 2
PR 3
PR 4
PR = Pull Request
P
I
P
E
L
I
N
E
PR 1
PR 2
PR 3
PR 4
PR = Pull Request
Pr-1 added to merge Queue
Failed CI
Sent to Merge Queue
PR = Pull Request
create a new branch merge-queue/pr1
base branch is mainÂ
changes from PR 1 are merged intoÂ
merge-queue/pr1
PR 1
PR = Pull Request
create a new branch merge-queue/pr1-pr2
base branch is merge-queue/pr1Â
changes from PR 2 are merged intoÂ
merge-queue/pr1-pr2
PR 2
PR = Pull Request
create a new branch merge-queue/pr1-pr2-pr3
base branch is merge-queue/pr1-pr2Â
changes from PR 3 are merged intoÂ
merge-queue/pr1-pr2-pr3
PR 3
PR = Pull Request
 merge-queue/pr1-pr2-pr3
Â
PR 3
Run All CI/CD check and User Journey Tests
Running Affected Tasks on GitHub
App1
App2
App3
App4
App5
Lib1
Lib2
function newFeature() {
return true;
}
Changes in your Pull Request
App1
App2
App3
App4
App5
Lib1
Lib2
nx affected
--targets=build,lint,test
Run affected tasks
S3 bucket
Push Nx Cache
Get Nx Cache
PR 1
PR 2
PR 3
PR 4
PR = Pull Request
P
I
P
E
L
I
N
E
Releasing 40+ apps is a challenge; we need to make sure everything is well-tested before we deploy.
Create a Release Candidate
Teams execute Automated/manul tets
Postpone release to monday
Deploy Release
Success
Failure
Rollback Release
Production issue?
Create Release Candidate
Green CI/CD?
Yes
Deploy to production
No
Cancel Deployment