When you start a new project with Nx, you have two options: manual or guided.
Option 1: Manual setup
Section titled “Option 1: Manual setup”In a nutshell, this means using your favorite CLI to create your initial project setup and then adding Nx to it.
Let's take the example of an NPM workspace. Create a new root-level package.json
like:
{ "name": "my-workspace", "version": "1.0.0", "private": true, "workspaces": ["packages/*", "apps/*"]}
Then you can add Nx to it by using:
nx@latest init
Nx will detect the underlying workspace configuration, ask you a couple of questions and install itself into the workspace. As you keep going, you can incrementally add functionality, like:
Option 2: Create a new workspace with presets
Section titled “Option 2: Create a new workspace with presets”Alternatively, you can choose a more guided approach by leveraging some of the presets Nx comes with.
Run the following command to get started:
npx create-nx-workspace@latest
This interactive command will guide you through the setup process, allowing you to:
- Choose your workspace name - This will be the name of your root directory
- Select your preferred package manager - npm, yarn, or pnpm
- Pick a preset - Choose from various technology stacks and configurations
- Configure additional options - Such as styling solutions, testing frameworks, and more
Choose a preset that matches your technology stack. This gives you a fully configured workspace.
You can also choose an empty workspace preset which sets up the bare minimum configuration including Nx itself. This allows you to add technologies and features incrementally over time as you need them.
Option 3: Get the complete Nx platform experience
Section titled “Option 3: Get the complete Nx platform experience”For the complete experience, you can also get started directly from the Nx Cloud application.
This approach gives you a fully end-to-end development workflow right from the start, making it easy to get up and running when your project is in its initial phase. You'll get a fully working CI configuration that includes Nx Cloud's AI-powered features like AI-powered self-healing CI that automatically fixes common CI failures. This means you benefit from intelligent automation right from day one, without having to configure complex CI pipelines manually.
As your project grows and scales, you'll have access to additional features like remote caching to speed up builds across your team, distributed task execution with Nx Agents to parallelize work across multiple machines, and automatic test splitting to optimize your CI pipeline performance.