# Turborepo vs Nx (2026): Which Monorepo Tool to Ship With

> Turborepo vs Nx for JavaScript monorepos: task runners, remote caching, affected CI, Lerna, and when a thin Turbo layer or a full Nx platform fits your team.

Published: 2026-12-03 · Tags: web, development, deployment, guide

**Turborepo vs nx** is the question teams ask once a pnpm or npm workspace outgrows `pnpm -r run build`. You already have packages. You need ordered tasks, cache hits, and CI that skips unchanged apps. Turborepo is a task runner and cache on top of the package manager you already use. Nx is a build system and platform: project graph, plugins, generators, module boundaries, and Nx Cloud for remote cache and CI features.

This page is a developer-to-developer comparison from a team that ships [TurboStarter](https://www.turbostarter.dev) as a **pnpm** workspace with **Turborepo 2.11.10** (see root `package.json` and `turbo.json`). We do not claim benchmark wins here. Official docs are the source for product behavior and pricing shapes, read on **3 December 2026**.

For depth on one side of the fence, see [Turborepo best practices](https://www.turbostarter.dev/blog/turborepo-best-practices), the [Turborepo monorepo guide](https://www.turbostarter.dev/blog/turborepo-the-ultimate-guide-to-modern-javascript-monorepo-management), and [getting started with the Turborepo CLI](https://www.turbostarter.dev/blog/get-started-with-turborepo-cli-and-ship-your-project-to-production-in-seconds). Nx maintains its own [migration from Turborepo](https://nx.dev/docs/guides/adopting-nx/from-turborepo).

<Callout type="success" title="Turborepo vs Nx: the short answer">
  **Pick Turborepo** when you want a thin scheduler and content hash cache on top of **pnpm workspaces** (or npm, Yarn, Bun), a single root `turbo.json`, and scripts that stay in each package's `package.json`. It fits most TypeScript SaaS monorepos that only need run, cache, filter, and remote cache.

  **Pick Nx** when you need a first-class project graph across stacks, **inferred tasks** from Vite or Gradle configs, **generators**, **module boundary** rules, **Ultracache** on Nx Cloud, distributed CI workers, or polyglot repos where JS and non-JS projects share one graph.

  **Pick neither alone** for installs: you still want a workspace tool (**pnpm monorepo** layout, npm workspaces, and similar). Turborepo and Nx orchestrate tasks; they do not replace the lockfile.
</Callout>

## Turborepo vs Nx at a glance

| Factor               | Turborepo                                                                                                                                                                                        | Nx                                                                                                                                            |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| What it is           | High-performance task runner and cache for JS/TS monorepos ([docs intro](https://turborepo.dev/docs))                                                                                            | Monorepo build system, plugins, graph, and CI platform ([nx.dev](https://nx.dev))                                                             |
| Primary config       | Root `turbo.json` (`tasks`, optional per-package `turbo.json`)                                                                                                                                   | Root `nx.json` plus per-project `project.json` or inferred config                                                                             |
| Task source          | `package.json` scripts you already wrote                                                                                                                                                         | Same scripts **or** targets inferred by Nx plugins                                                                                            |
| Local caching        | Content-aware hashing, `.turbo` directory                                                                                                                                                        | Local cache before remote ([remote cache docs](https://nx.dev/docs/features/ci-features/remote-cache))                                        |
| Remote caching       | Vercel Remote Cache (free on all plans, including off Vercel); self-hosted servers implementing the Remote Cache API ([remote caching](https://turborepo.dev/docs/core-concepts/remote-caching)) | Nx Cloud via `nx connect`; hobby tier for external CI; usage-based CI Plan in beta ([pricing](https://nx.dev/pricing), checked 3 Dec 2026)    |
| Affected / filtering | `turbo run build --affected`, `--filter`, `...[base...HEAD]` syntax ([`turbo run` reference](https://turborepo.dev/docs/reference/run))                                                          | `nx affected -t build`, project matchers (`-p admin-*`, tags) ([from-turborepo guide](https://nx.dev/docs/guides/adopting-nx/from-turborepo)) |
| Code generation      | `turbo gen` / `@turbo/gen` (Plop-style workspace generators)                                                                                                                                     | `nx generate`, first-party and community plugins                                                                                              |
| Plugins / inference  | Wraps existing scripts; framework env inference for cache hashes                                                                                                                                 | First-party plugins (Vite, Jest, ESLint, and others), inferred `inputs`/`outputs`                                                             |
| Language support     | JS/TS ecosystems via package manager workspaces                                                                                                                                                  | JS/TS plus Java (.NET, Maven, Gradle) and community plugins (Python, Rust, Go) per Nx marketing and migration docs                            |
| Visualization        | Dependency insights via CLI and docs                                                                                                                                                             | `nx graph`, Nx Console                                                                                                                        |
| Boundaries           | `turbo boundaries` (tags on packages)                                                                                                                                                            | ESLint module boundary rules, conformance (enterprise)                                                                                        |
| Learning curve       | Smaller surface: one JSON file, npm scripts                                                                                                                                                      | Larger surface: graph, executors, Nx Cloud concepts                                                                                           |
| Ownership / lock-in  | Open source runner; remote cache portable to self-hosted API                                                                                                                                     | Open source core; advanced CI and Ultracache tied to Nx Cloud tiers                                                                           |
| Typical pairing      | pnpm + Turborepo (this repo)                                                                                                                                                                     | pnpm, npm, or Yarn + Nx                                                                                                                       |

## What is Turborepo?

[Turborepo](https://turborepo.dev/docs) is maintained by Vercel. It runs the scripts defined in workspace `package.json` files, builds a task graph from `dependsOn`, hashes inputs (files, env vars, lockfile), and restores outputs from a local or remote cache. It does not install dependencies. Your package manager does.

Adoption is incremental: add `turbo.json`, wire root scripts (`"build": "turbo build"`), declare `packageManager` in the root `package.json` (required in Turborepo 2.x). Turborepo 2.0 renamed `pipeline` to `tasks` and made strict environment mode the default.

**What is turborepo** in one sentence for search: it is the `turbo` CLI plus remote cache that keeps monorepo CI from rebuilding unchanged packages.

## What is Nx?

[Nx](https://nx.dev) is an open source monorepo toolkit originally aimed at Angular, now used across JS and other stacks. It understands a **project graph** (apps and libraries), can **infer** tasks from tool configs, provides **generators** to scaffold projects, and integrates with **Nx Cloud** for shared cache, analytics, distributed workers, and (on supported versions) **Ultracache** that records files tasks actually read.

`nx init` on an existing Turborepo repo converts `turbo.json` to `nx.json` so both can run side by side until you remove Turborepo ([migration guide](https://nx.dev/docs/guides/adopting-nx/from-turborepo)).

## Task running and caching

Both tools cache task outputs when inputs match. Both need explicit **outputs** (build folders, and similar) or restorers replay logs without artifacts.

### Turborepo: `turbo.json` and real TurboStarter tasks

TurboStarter's root config (abbreviated) shows patterns production repos use:

```json
{
  "$schema": "https://turbo.build/schema.json",
  "ui": "tui",
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": [
        ".cache/tsbuildinfo.json",
        "dist/**",
        ".output/**",
        ".vercel/output/**",
        ".tanstack/**"
      ]
    },
    "dev": {
      "cache": false,
      "persistent": false
    },
    "typecheck": {
      "dependsOn": ["^build"],
      "outputs": [".cache/tsbuildinfo.json"]
    },
    "setup": {
      "cache": false,
      "dependsOn": ["@workspace/db#db:setup"]
    }
  },
  "globalEnv": ["DATABASE_URL", "DEMO_DATABASE_URL", "VERCEL"],
  "globalPassThroughEnv": ["NODE_ENV", "CI", "npm_lifecycle_event"]
}
```

`^build` means "build dependency packages first." A bare `build` in the same package would only order tasks inside that package. `globalEnv` participates in every task hash. See [Turborepo best practices](https://www.turbostarter.dev/blog/turborepo-best-practices) for `outputs`, strict `envMode`, and `passThroughEnv`.

### Nx: `nx.json` and `targetDefaults`

After `nx init`, Turborepo's `tasks.build` block becomes `targetDefaults.build` with `{projectRoot}` path tokens ([mapping table](https://nx.dev/docs/guides/adopting-nx/from-turborepo)). Package-specific overrides like `web#build` become filtered entries in an array under the same task name.

Nx can also define targets in `project.json` or infer them from `vite.config.ts` so you do not duplicate `outputs` by hand. That reduces cache misconfiguration at the cost of learning Nx's plugin model.

### Caching philosophy

* **Turborepo remote caching** hashes what you declare in `inputs`, `env`, and `globalEnv`. Wrong declarations produce wrong hits; the docs warn to fix local caching before sharing artifacts ([remote caching](https://turborepo.dev/docs/core-concepts/remote-caching)).
* **Nx** adds **Ultracache** on Nx Cloud Workers to record files a task actually read, which Nx documents as improving hit rates when manual `inputs` are incomplete ([Ultracache section](https://nx.dev/docs/features/ci-features/remote-cache)). That feature is Nx Cloud specific, not something Turborepo ships as of these docs.

## Remote caching

### Turborepo remote caching

Local `.turbo/cache` helps one machine. **Turborepo remote caching** shares artifacts across laptops and CI.

* **Vercel Remote Cache**: free on all Vercel plans, even if you do not deploy on Vercel ([remote caching](https://turborepo.dev/docs/core-concepts/remote-caching)). Link with `turbo login` and `turbo link`, or set `TURBO_TOKEN` and `TURBO_TEAM` in CI.
* **Self-hosted**: any server implementing the Turborepo Remote Cache HTTP API; `turbo login --manual` for custom endpoints. Community implementations are listed in the same doc.

Optional `remoteCache.signature` plus `TURBO_REMOTE_CACHE_SIGNATURE_KEY` verifies artifact integrity on download.

### Nx Cloud remote cache

Connect with `npx nx connect` or `nx login`. Cached entries include terminal output and declared outputs; source files are hashed, not stored ([remote cache](https://nx.dev/docs/features/ci-features/remote-cache)). Nx documents read/write token scoping for CI branches to reduce cache poisoning risk.

**Pricing (checked 3 December 2026):** [nx.dev/pricing](https://nx.dev/pricing) lists a **Hobby** tier for external CI, a **CI Plan** in beta (usage-based worker minutes, $0 base fee during beta at time of writing), and **Enterprise** options. Credits and concurrent workers apply on paid tiers. Treat numbers as current on that page, not guarantees here.

Turborepo's remote cache has no per-minute credit model on Vercel's free remote cache offering. Nx's bill grows with Nx Cloud CI features you enable. Compare total cost (runner minutes plus cache service), not CLI speed claims.

## Affected builds in CI

Both tools need enough Git history to compare against a base branch.

### Turborepo in GitHub Actions

From Turborepo's [CI guide](https://turborepo.dev/docs/guides/ci-vendors/github-actions) and [run reference](https://turborepo.dev/docs/reference/run):

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - uses: actions/checkout@v4
        with:
          filter: blob:none
          fetch-depth: 0
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - uses: vercel/setup-turborepo-remote-cache-action@v1.0.0
      - run: pnpm turbo run build lint test --affected
```

`--affected` aligns with `--filter=...[main...HEAD]`. Set `TURBO_SCM_BASE` when your default branch is not `main`. Shallow `fetch-depth: 1` breaks affected detection.

### Nx in GitHub Actions

From Nx's migration and remote cache docs:

```yaml
jobs:
  main:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: npm ci
      - run: npx nx affected -t build lint test
```

Distributed execution uses `nx-cloud start-workers` and related steps ([Nx Cloud docs](https://nx.dev/nx-cloud)). That path has no Turborepo equivalent.

| Topic   | Turborepo                                                                                | Nx                                             |
| ------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------- |
| Command | `turbo run <tasks> --affected`                                                           | `nx affected -t <tasks>`                       |
| Scope   | Package-level by default; optional task-level with `futureFlags.affectedUsingTaskInputs` | Project graph plus Ultracache recordings in CI |
| History | `fetch-depth: 0` or blobless clone                                                       | `fetch-depth: 0`                               |

## Developer experience and migration

### Adding Turborepo to an existing pnpm workspace

1. Add `turbo` as a dev dependency and `packageManager` field.
2. Create `turbo.json` with `tasks` mirroring scripts (`build`, `lint`, `test`, `dev`).
3. Point root scripts at `turbo run <task>`.
4. Fix `outputs` and env hashing before enabling remote cache.

The [get started with Turborepo CLI](https://www.turbostarter.dev/blog/get-started-with-turborepo-cli-and-ship-your-project-to-production-in-seconds) walkthrough and [pnpm workspace docs](https://pnpm.io/workspaces) cover install and linking. **pnpm monorepo vs turborepo** is not either/or: pnpm links packages; Turborepo runs and caches tasks.

### Adopting Nx (`nx init`)

`npx nx@latest init` reads `turbo.json`, writes `nx.json`, and leaves Turborepo in place until you delete it ([step-by-step migration](https://nx.dev/docs/guides/adopting-nx/from-turborepo)). Expect to port `persistent: true` to `continuous: true`, move per-package `turbo.json` overrides to filtered `targetDefaults`, and reattach `sharedGlobals` when tasks define their own `inputs`.

### Moving between them

* **Turborepo to Nx**: official `nx init` path, then CI switch to `nx affected`, then remove `turbo`.
* **Nx to Turborepo**: no single official codemod. You keep package scripts, recreate `tasks` in `turbo.json`, and replace `nx run-many` with `turbo run`.

Running both temporarily is supported during Nx migration. Long term, one orchestrator keeps mental overhead low.

## Turbopack vs Turborepo

Different tools. Easy to confuse because both names start with "Turbo."

**Turbopack** is a bundler focused on dev and build performance inside frameworks such as Next.js ([Turbopack guide](https://www.turbostarter.dev/blog/turbopack-ultimate-guide-to-next-gen-webpack-bundler-replacement)). **Turborepo** never bundles your app. It runs `vite build`, `next build`, or whatever script each package defines. TurboStarter's web app uses Vite/TanStack Start; Turborepo schedules `build` across packages. A fast bundler does not replace a monorepo task graph.

## Nx vs Lerna vs Turborepo

**Lerna** was the early JavaScript monorepo CLI for versioning and publish workflows. [Lerna's introduction](https://lerna.js.org/docs/introduction) states **Nx took over stewardship**. From Lerna v6+, `lerna run` delegates scheduling and caching to Nx's task runner. Lerna still shines at **npm publish** flows (`lerna version`, fixed or independent modes).

| Tool          | Best for                                                                            |
| ------------- | ----------------------------------------------------------------------------------- |
| **Turborepo** | Task running and caching on npm-style workspaces without adopting the full Nx graph |
| **Nx**        | Graph, plugins, generators, enterprise conformance, Nx Cloud CI                     |
| **Lerna**     | Release management on top of workspaces; task execution now piggybacks on Nx        |

**Nx vs lerna vs turborepo** and **turborepo vs nx vs lerna** usually mean: use Lerna only if npm publishing is the hard problem; use Turborepo or Nx for day-to-day builds. You can run Lerna publish in an Nx workspace; you do not need Lerna to use Turborepo.

## When to choose Nx

Consider Nx when:

* Multiple languages or build tools must share one dependency graph (Java services beside TypeScript apps, per Nx's migration marketing).
* You want **generators** and **inferred tasks** so `outputs` track Vite or Jest configs automatically.
* **Module boundary** rules and conformance dashboards are non-negotiable for a large org.
* You plan to use **Nx Cloud Workers**, dynamic distribution, or **Self-Healing CI** as your primary CI product.
* You are already on `@nx/*` plugins and `nx graph` is part of day-to-day debugging.

Nx wins on platform breadth. You pay in config surface area and (if you use advanced CI) Nx Cloud pricing.

## When to choose Turborepo

Consider Turborepo when:

* The repo is **JavaScript or TypeScript** with pnpm (or npm/Yarn) workspaces and standard package scripts.
* You want minimal config: one `turbo.json`, remote cache on Vercel for free, and filters for CI.
* Team ownership matters: fewer concepts between `pnpm install` and `turbo run build`.
* You are standardizing on Vercel deploys or already documented Turborepo in your starter kit.

Turborepo wins on simplicity and fitting the npm ecosystem. It does not replace publish tooling (use Changesets, Lerna, or your own release scripts) or polyglot graph analysis.

## How TurboStarter does it

TurboStarter is a production-ready **starter kit** (not just a task runner) laid out as:

* **pnpm** workspace: `apps/*`, `packages/*`, `tooling/*` ([pnpm-workspace.yaml](https://github.com/turbostarterdev/turbostarter.dev/blob/main/pnpm-workspace.yaml))
* **Turborepo** for `dev`, `build`, `test`, `typecheck`, and setup tasks
* Shared packages (`@workspace/api`, `@workspace/auth`, `@workspace/db`, `@workspace/ui`, and others) consumed by deployable apps

This open source snapshot centers on the TanStack Start web app under `apps/web`, with the full kit documented for web, Expo mobile, and browser extension surfaces in [cross-platform SaaS with one backend](https://www.turbostarter.dev/blog/cross-platform-saas-one-backend-web-mobile-extension). Compare the free **create-t3-turbo** template in [create-t3-turbo vs TurboStarter](https://www.turbostarter.dev/blog/create-t3-turbo-vs-turbostarter).

Monorepo hygiene we rely on:

* [Renovate vs Dependabot](https://www.turbostarter.dev/blog/renovate-vs-dependabot-whats-the-best-tool-to-automate-your-dependency-updates) for dependency PRs (orthogonal to Turborepo, but keeps cache keys changing predictably).
* [Oxc migration](https://www.turbostarter.dev/blog/oxc-migration-faster-linting-and-formatting-with-rust) for fast lint/format at the repo root (`//#lint` tasks in `turbo.json`).
* [Project structure](https://www.turbostarter.dev/docs/web/installation/structure) for where apps and packages live.
* [Which TurboStarter kit to choose](https://www.turbostarter.dev/blog/which-turbostarter-kit-to-choose) when you buy the kit, not when you pick Turborepo over Nx.

We chose Turborepo because the product is **ship a SaaS**, not **operate a build-system platform**. One backend, multiple clients, strict TypeScript packages: Turborepo stays out of the way. If you outgrow it, Nx's migration path exists.

<ContentCta />

## FAQ

<Accordions>
  <Accordion title="Is Turborepo better than Nx?">
    Neither is universally better. Turborepo is a strong default for **turborepo monorepo** workflows that are mostly TypeScript, script-driven, and pnpm-based. Nx is stronger when you need its graph, plugins, generators, Ultracache, and Nx Cloud CI as a package. This page compares tradeoffs; see [Nx vs Turborepo context on nx.dev](https://nx.dev/docs/guides/adopting-nx/from-turborepo) for Nx's view.
  </Accordion>

  <Accordion title="Can you use Nx and Turborepo together?">
    Yes, temporarily. `nx init` keeps `turbo.json` until you finish migration ([migration guide](https://nx.dev/docs/guides/adopting-nx/from-turborepo)). Running both long term doubles config and confuses newcomers. Pick one orchestrator for CI.
  </Accordion>

  <Accordion title="Is Turborepo free?">
    The `turbo` CLI is open source. **Vercel Remote Cache** is free on all Vercel plans, including repos that deploy elsewhere ([remote caching](https://turborepo.dev/docs/core-concepts/remote-caching)). Self-hosted cache servers are your infrastructure cost. You still pay for CI runners and Vercel/hosting separately.
  </Accordion>

  <Accordion title="Does Nx work with pnpm?">
    Yes. Nx supports pnpm workspaces the same way it supports npm and Yarn. `nx init` does not remove your package manager. You still declare workspaces in `pnpm-workspace.yaml` ([pnpm workspaces](https://pnpm.io/workspaces)).
  </Accordion>

  <Accordion title="Is Lerna dead?">
    No, but its role changed. Nx stewards Lerna; **lerna run** uses Nx's task runner in v6+ ([Lerna introduction](https://lerna.js.org/docs/introduction)). Many teams use Lerna for **publishing** and Turborepo or Nx for **builds**.
  </Accordion>

  <Accordion title="Which is faster, Turborepo or Nx?">
    Marketing pages on both sides cite large-repo benchmarks (Nx's site references multi-machine CI comparisons). Those numbers depend on repo shape, cache correctness, and hardware. For your repo, measure `turbo run build` vs `nx run-many -t build` with a warm cache and fair `outputs`/`inputs`. This post does not quote speed figures.
  </Accordion>

  <Accordion title="Do I need a monorepo tool at all with pnpm workspaces?">
    You can run `pnpm -r run build` without Turborepo or Nx. You lose cross-package task ordering (`^build`), content caching, remote cache, and affected CI shortcuts. Many teams add **turborepo monorepo** tooling once CI time or fan-out grows past a few packages.
  </Accordion>
</Accordions>

## Sources (checked 3 December 2026)

* [Turborepo documentation](https://turborepo.dev/docs) (overview, tasks, remote caching, `turbo run`, CI)
* [Nx documentation](https://nx.dev) (adopting Nx from Turborepo, remote cache, Ultracache)
* [Nx pricing](https://nx.dev/pricing) (Hobby, CI Plan beta, Enterprise)
* [Lerna documentation](https://lerna.js.org/docs/introduction) (Nx stewardship, `lerna run` and Nx)
* [pnpm workspaces](https://pnpm.io/workspaces)


More posts: [blog](https://www.turbostarter.dev/blog.md)
