← Back to articles

Turborepo vs Nx vs Lerna (2026 Monorepo Comparison)

Monorepos are mainstream. The question is which tool to manage them. Turborepo is minimal and fast. Nx is feature-rich and opinionated. Lerna is the veteran, now maintained by Nx. Here's the honest comparison.

Quick Verdict

  • Turborepo — Best for simple monorepos. Minimal config, fast caching.
  • Nx — Best for large teams and complex monorepos. Most features.
  • Lerna — Best for publishing npm packages. Now powered by Nx.

What They Do

All three orchestrate tasks across packages in a monorepo:

  1. Task running — Run build/test/lint across all packages in correct order
  2. Caching — Skip work that hasn't changed
  3. Dependency graph — Understand which packages depend on which
  4. Parallel execution — Run independent tasks simultaneously

Speed & Caching

TurborepoNxLerna
Local caching✅ (via Nx)
Remote caching✅ (Vercel)✅ (Nx Cloud)✅ (Nx Cloud)
Cache hit speed~50ms~50ms~50ms
Cold build (medium repo)FastFastSlower
Task hashingFile contentFile content + runtimeVia Nx

Both Turborepo and Nx are extremely fast with caching. The difference is negligible for most repos.

Remote caching is the big productivity win. CI gets a cache hit from your local build. Both offer it (Turborepo via Vercel, Nx via Nx Cloud).

Configuration

Turborepo

// turbo.json
{
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**", ".next/**"]
    },
    "test": {
      "dependsOn": ["build"]
    },
    "lint": {}
  }
}

Minimal. Define tasks, dependencies, outputs. That's it.

Nx

// nx.json
{
  "targetDefaults": {
    "build": {
      "dependsOn": ["^build"],
      "cache": true,
      "outputs": ["{projectRoot}/dist"]
    },
    "test": {
      "cache": true
    }
  }
}

Plus per-project project.json files with targets. More verbose but more powerful.

Lerna

// lerna.json
{
  "version": "independent",
  "npmClient": "pnpm",
  "useNx": true
}

Lerna now delegates task running to Nx under the hood.

Winner: Turborepo for simplicity. Nx for control.

Feature Comparison

FeatureTurborepoNxLerna
Task orchestration
Local caching
Remote caching✅ (Vercel)✅ (Nx Cloud)✅ (Nx Cloud)
Code generators✅ (nx generate)
Dependency graph UI✅ (nx graph)
Affected detection✅ (nx affected)
Plugin ecosystem✅ (50+ plugins)
Package publishing✅ (nx release)✅ (lerna publish)
Module federation

Nx has significantly more features. The question is whether you need them.

Affected Detection

Nx's nx affected is a killer feature. It detects which packages changed and only runs tasks for those:

# Only test packages affected by current changes
nx affected -t test

Turborepo doesn't have this. You filter manually:

turbo run test --filter=...[HEAD~1]

For large monorepos, affected detection saves significant CI time.

When to Use Each

Choose Turborepo When

  • Small-to-medium monorepo (2-20 packages)
  • Want minimal configuration
  • Already on Vercel (remote caching is free)
  • Team doesn't need generators or plugins
  • Just need fast builds and caching

Choose Nx When

  • Large monorepo (20+ packages)
  • Multiple teams working in one repo
  • Need code generators (scaffolding new packages/components)
  • Want dependency graph visualization
  • Need affected detection for CI optimization
  • Enterprise features (access control, analytics)

Choose Lerna When

  • Publishing npm packages to registry
  • Need versioning management (independent or fixed)
  • Existing Lerna repo (just upgrade, it uses Nx now)
  • Need changelog generation from commits

Setup Comparison

Turborepo from Scratch

npx create-turbo@latest
# Done. Workspace with example packages.

Nx from Scratch

npx create-nx-workspace@latest
# Choose: integrated or package-based
# Choose: framework preset
# More questions...

Adding to Existing Repo

Turborepo: npm install turbo -D + add turbo.json. Two minutes.

Nx: npx nx@latest init. Adds more files but auto-detects your setup.

Winner: Turborepo for getting started.

Package Manager Compatibility

TurborepoNxLerna
npm workspaces
pnpm workspaces
Yarn workspaces
Bun workspaces

All three work with all major package managers.

Remote Caching Pricing

Turborepo (Vercel)Nx Cloud
Free✅ (Vercel account)✅ (500 hours/month)
TeamPart of Vercel Pro ($20/member)$35/contributor/month
EnterpriseVercel EnterpriseCustom

If you're on Vercel, Turborepo remote caching is effectively free. Nx Cloud has a generous free tier for open source and small teams.

FAQ

Can I use Turborepo and Nx together?

Technically possible but not recommended. Pick one.

Is Lerna dead?

No. Lerna was acquired by Nrwl (Nx team) in 2022 and is actively maintained. It's now powered by Nx for task running. Still the best for npm package publishing.

Do I even need a monorepo tool?

If you have 2-3 packages and simple build steps, pnpm workspaces alone might be enough. Add Turborepo when builds get slow.

Which is better for Next.js?

Turborepo (built by Vercel, who makes Next.js). Native integration and examples.

Can I migrate from Lerna to Turborepo?

Yes. Replace lerna run with turbo run. Keep lerna publish for package publishing if needed.

Bottom Line

Turborepo for most projects. It's simple, fast, and gets out of your way. Nx when your monorepo is large, complex, or has multiple teams needing generators, affected detection, and plugins. Lerna specifically for npm package publishing workflows.

Start with Turborepo. If you outgrow it, Nx is there. Most teams never outgrow Turborepo.

Get AI tool guides in your inbox

Weekly deep-dives on the best AI coding tools, automation platforms, and productivity software.