Skip to content

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!

After initializing Nx, you can explore your workspace with the following commands:

  • nx graph to view an interactive graph
  • nx show projects to see a list of all projects
  • nx show project <project-name> to view an interactive project detailed view
  • nx run-many -t <target> to run tasks with Nx, e.g. nx run-many -t build

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

.github/workflows/ci.yaml
- 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

.github/workflows/ci.yaml
- run: npm run build
- run: npm run test
- run: npx nx build
- run: npx nx test

View CI provider specific setups to learn more.

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:

.github/workflows/ci.yaml
- run: npx nx run-many -t lint test build
# Enable Self Healing CI w/ Nx Cloud
- run: npx nx fix-ci
if: always()

Enhance your developer experience by using the Nx Console editor extension.

Visual Studio Code

Install Nx Console for VSCodeThe official VSCode extension for Nx.

IntelliJ IDEA

Here are some guides that give you more details based on the technology stack you're using: