10+ AI SaaS templates for web & mobile
home

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

ยท14 min read

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.

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 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, the Turborepo monorepo guide, and getting started with the Turborepo CLI. Nx maintains its own migration from Turborepo.

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.

Turborepo vs Nx at a glance

FactorTurborepoNx
What it isHigh-performance task runner and cache for JS/TS monorepos (docs intro)Monorepo build system, plugins, graph, and CI platform (nx.dev)
Primary configRoot turbo.json (tasks, optional per-package turbo.json)Root nx.json plus per-project project.json or inferred config
Task sourcepackage.json scripts you already wroteSame scripts or targets inferred by Nx plugins
Local cachingContent-aware hashing, .turbo directoryLocal cache before remote (remote cache docs)
Remote cachingVercel Remote Cache (free on all plans, including off Vercel); self-hosted servers implementing the Remote Cache API (remote caching)Nx Cloud via nx connect; hobby tier for external CI; usage-based CI Plan in beta (pricing, checked 3 Dec 2026)
Affected / filteringturbo run build --affected, --filter, ...[base...HEAD] syntax (turbo run reference)nx affected -t build, project matchers (-p admin-*, tags) (from-turborepo guide)
Code generationturbo gen / @turbo/gen (Plop-style workspace generators)nx generate, first-party and community plugins
Plugins / inferenceWraps existing scripts; framework env inference for cache hashesFirst-party plugins (Vite, Jest, ESLint, and others), inferred inputs/outputs
Language supportJS/TS ecosystems via package manager workspacesJS/TS plus Java (.NET, Maven, Gradle) and community plugins (Python, Rust, Go) per Nx marketing and migration docs
VisualizationDependency insights via CLI and docsnx graph, Nx Console
Boundariesturbo boundaries (tags on packages)ESLint module boundary rules, conformance (enterprise)
Learning curveSmaller surface: one JSON file, npm scriptsLarger surface: graph, executors, Nx Cloud concepts
Ownership / lock-inOpen source runner; remote cache portable to self-hosted APIOpen source core; advanced CI and Ultracache tied to Nx Cloud tiers
Typical pairingpnpm + Turborepo (this repo)pnpm, npm, or Yarn + Nx

What is Turborepo?

Turborepo 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 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).

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:

{
  "$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 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). 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).
  • 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). 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). 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). Nx documents read/write token scoping for CI branches to reduce cache poisoning risk.

Pricing (checked 3 December 2026): 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 and run reference:

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:

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). That path has no Turborepo equivalent.

TopicTurborepoNx
Commandturbo run <tasks> --affectednx affected -t <tasks>
ScopePackage-level by default; optional task-level with futureFlags.affectedUsingTaskInputsProject graph plus Ultracache recordings in CI
Historyfetch-depth: 0 or blobless clonefetch-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 walkthrough and pnpm workspace docs 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). 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). 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 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).

ToolBest for
TurborepoTask running and caching on npm-style workspaces without adopting the full Nx graph
NxGraph, plugins, generators, enterprise conformance, Nx Cloud CI
LernaRelease 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)
  • 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. Compare the free create-t3-turbo template in create-t3-turbo vs TurboStarter.

Monorepo hygiene we rely on:

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.

Sounds good?Now let's make it real. In minutes.
Try TurboStarter

FAQ

Sources (checked 3 December 2026)

world map
Community

Connect with like-minded people

Join our community to get feedback, support, and grow together with 1,000+ builders on board, let's ship it!

Join us

Ship your startup everywhere. In minutes.

Don't burn tokens on setup and start building features on day one.

Get TurboStarter