In many situations, you have an existing codebase and want to improve it with Nx using an incremental adoption approach.
Thanks to Nx's modular architecture, you can start with just Nx Core and then gradually add technology-specific plugins, CI integrations, or other capabilities as your requirements evolve.
Getting started is remarkably simple. You can add Nx to any existing project with a single command:
nx@latest init
Whether a monorepo, single project or something in between, nx init
walks you through adding and configuring Nx. You can pick a minimal approach or detailed guided setup. At the end you'll have an Nx workspace ready for anything!
Next Steps
Section titled “Next Steps”After initializing Nx, you can explore your workspace with the following commands:
nx graph
to view an interactive graphnx show projects
to see a list of all projectsnx show project <project-name>
to view an interactive project detailed viewnx run-many -t <target>
to run tasks with Nx, e.g.nx run-many -t build
Update CI Configurations
Section titled “Update CI Configurations”Now that Nx is installed, you'll want to update CI configurations to leverage Nx. You can do this by changing previous commands to use nx
instead.
For example, switching from pnpm
commands to use nx
- run: pnpm run -r build - run: pnpm run -r test - run: npx nx run-many -t test build
You can directly invoke package.json
scripts with nx
as well
- run: npm run build - run: npm run test - run: npx nx build - run: npx nx test
View CI provider specific setups to learn more.
Nx Cloud
Section titled “Nx Cloud”After initializing Nx, you'll need to commit and push the changes to your repository.
Once your changes are pushed, you can finish setting up your workspace by clicking on the list printed to your terminal, or by visiting Nx Cloud directly and clicking "Connect an existing Nx repository"
To leverage Self Healing CI, you'll need to add the following to your CI configuration:
- run: npx nx run-many -t lint test build # Enable Self Healing CI w/ Nx Cloud - run: npx nx fix-ci if: always()
Empower Your Editor
Section titled “Empower Your Editor”Enhance your developer experience by using the Nx Console editor extension.
Install Nx Console for VSCodeThe official VSCode extension for Nx.
Install Nx Console for JetBrainsAvailable for WebStorm, IntelliJ IDEA Ultimate and more!
In-depth Guides
Section titled “In-depth Guides”Here are some guides that give you more details based on the technology stack you're using: