A Smart, Fast and Extensible Build System for ...
Be aware, this presentation might contain flashy giphy's...
Nx is a smart, fast and extensible build system with first class monorepo support and powerful integrations.
Angular / WEB consultancy at large scale
Jeff Cross
Victor Savkin
Fun Fact: Angular has schematics thanks to Nx
Actually much more than just a CLI
...is the end-to-end solution for smart, efficient and maintainable CI
A suite of paid extensions for the Nx CLI specifically designed for enterprises, built and supported by the Nx core team.
Yeah, but I can do this with the Angular-CLI as well!
-- a random developer
(Angular-cli is not meant for Enterprise applications)
(But works, perfectly for small(er) (open-source) projects as well
(Module Federation)
One `package.json` to rule them all
nx migrate latest
Handles migrations/upgrades for major libraries
Developers new to Nx are initially often hesitant to move their logic into libraries, because they assume it implies that those libraries need to be general purpose and shareable across applications.
This is a common misconception, moving code into libraries can be done from a pure code organization perspective.
apps/
expo <---- App (shell) folder, lazy-loads the needed domains
d&i (rpp) <---- App (shell) folder, lazy-loads the needed domains
libs/
persoon/ <---- Domain / grouping folder
data-access/
feature/
persoon-details/ <---- feature -> usually a page which can be accessed via routes
ui/
persoon-list/ <---- dumb component, which can be used in the features in persoon
shared/ <---- shared / grouping folder -> can be used in each domain
ui/
button/ <---- dumb component, which can be used in ALL features
card/
details-summary/
dialog/
zaak/ <---- grouping folder
vonnis/ <---- Domain
data-access/ feature-raadplegen/ <---- feature -> usually a page which can be accessed via routes feature-opvoeren/ feature-beoordelen/ gedragsaanwijzing/ <---- Domain (509hh)
# see what's been affected by changes
nx affected:graph
# run tests for current changes
nx affected:test
# run e2e tests for current changes
nx affected:e2e
# run linting for current changes
nx affected:lint
# run your custom commands like generate for current changes
nx affected:generate
# show the dep-graph for current changes
nx affected:dep-graph
Zorgen dat gedeelde configs hebben voor
npx nx init
nx run-many --parallel=3 -t=build
npx nx import [my-project]
Nx provides several key advantages when integrated with a custom CI/CD pipeline
Improved Build Times:
Nx's intelligent build system analyzes project dependencies and only rebuilds the necessary parts of your application, resulting in significantly faster build times compared to traditional build systems
On Premise:
Everything is handled by the CI/CD team and not in the cloud
Increased Maintenance: Setting up and maintaining a custom CI/CD pipeline can require significant effort and expertise
Lack of Specialized Features: Compared to Nx Cloud, a custom setup may lack specialized features like distributed task execution and advanced caching
Integration Challenges: Integrating Nx with your chosen CI/CD tools can present challenges
Potential for Inconsistency: Potential for inconsistencies in build environments across different machines
Security Risks: Managing your own CI/CD infrastructure introduces security responsibilities
Caching: Implement effective caching strategies to store and reuse build artifacts. Nx has a built-in caching mechanism that can be further optimized by configuring your CI/CD system to store and retrieve cached artifacts. This can drastically reduce build times by avoiding redundant computations (.nx, .cache, node_modules, artifacts)
Parallelization: Utilize parallelization to run multiple build tasks concurrently. Nx supports parallel execution of tasks, allowing you to take advantage of multi-core processors and significantly reduce build times
Dependency Analysis: Leverage Nx's dependency graph to identify and build only the affected parts of your application. This can be achieved using the nx affected
command, which analyzes changes and determines which projects need to be rebuilt
Optimize CI/CD Configuration: Fine-tune your CI/CD configuration to minimize unnecessary steps and optimize resource allocation. This could involve optimizing Docker image builds, streamlining testing processes, and efficiently distributing tasks across build agents
Task Scheduling: Nx allows you to define and schedule tasks in a declarative manner, making it easier to manage complex build processes and ensure that tasks are executed in the correct order
Affected Command: The nx affected
command is a powerful tool for optimizing CI/CD pipelines. It allows you to target specific projects for building, testing, and deployment based on the changes made in a given commit or branch
Distributed Task Execution: While not using Nx Cloud, you can still implement distributed task execution by configuring your CI/CD system to distribute tasks across multiple build agents. This can further improve build times by parallelizing tasks across available resources
- better CODEOWNERS
- Self host remote-caching
- S3, Azure, Google Cloud Storage
- Network drive
- conformance
$ 375,- per dev per jaar
- unlimited repos
- https://cloud.nx.app/powerpack/purchase
(inbegrepen bij Nx Enterprise (cloud + powerpack)
Nx based Distributed Task Execution & Remote Cache
Private Cloud / Nx Enterprise
For the moment the best integrations are with github /gitlab
Reduced CI Costs:
Faster Build Times:
Improved Reliability:
Enhanced Collaboration:
Security Concerns:
Complexity:
Vendor Lock-in:
Build artifacts: Compiled code, test results, and other build outputs
Cache entries: Cached build artifacts and task results to speed up builds
Metadata: Information about the project, tasks, and build configurations
Important: Nx Cloud does not store your source code
Encryption: All communication with the Nx Cloud API is encrypted
Access control: Restricts access to sensitive data
Immutable cache entries: Ensures cache entries cannot be tampered with
End-to-end encryption: Provides an additional layer of security for task artifacts
But most are needed for proper usage of the tooling(s) you are gonna use anyway:
But again, this is the same when you are NOT using Nx
First input of information is always https://nx.dev (also for Playwright, Cypress, Vitest, Jest, Storybook, etc)