Turborepo vs Nx vs Lerna (2026 Comparison)
Monorepos need task runners — something to build, test, and lint packages in the right order, fast. Turborepo, Nx, and Lerna are the three options. Here's the honest comparison for 2026.
Quick Verdict
- Turborepo — Best for simple monorepos. Minimal config, fast builds, Vercel integration.
- Nx — Best for large/complex monorepos. Most features, steepest learning curve.
- Lerna — Legacy. Now maintained by Nx team. Use Turborepo or Nx instead.
What They Do
All three solve the same core problem: in a monorepo with multiple packages, run tasks (build, test, lint) efficiently by:
- Caching — don't rebuild what hasn't changed
- Task ordering — build dependencies before dependents
- Parallelization — run independent tasks simultaneously
Speed Comparison
| Feature | Turborepo | Nx | Lerna |
|---|---|---|---|
| Local caching | ✅ | ✅ | ✅ (via Nx) |
| Remote caching | ✅ (Vercel) | ✅ (Nx Cloud) | ✅ (via Nx Cloud) |
| Incremental builds | ✅ | ✅ | ❌ (basic) |
| Task parallelization | ✅ | ✅ | ✅ |
| Affected detection | ❌ | ✅ | ❌ |
| Distributed execution | ❌ | ✅ (Nx Agents) | ❌ |
Nx is faster at scale because of affected detection (only run tasks for changed packages and their dependents) and distributed execution across CI machines.
Turborepo is fast enough for most monorepos and simpler to configure.
Configuration
Turborepo
// turbo.json
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"test": {
"dependsOn": ["build"]
},
"lint": {}
}
}
Run: turbo build — builds all packages in dependency order with caching.
Config complexity: Low. One JSON file. Straightforward.
Nx
// nx.json
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"cache": true
},
"test": {
"cache": true
}
}
}
Plus per-project configuration in project.json or inferred from package.json.
Run: nx build my-app or nx run-many -t build
Config complexity: Medium-High. More files, more options, more to learn.
Lerna
// lerna.json
{
"version": "independent",
"npmClient": "npm",
"command": {
"publish": {
"conventionalCommits": true
}
}
}
Run: lerna run build
Config complexity: Low but features are limited without Nx.
Feature Comparison
| Feature | Turborepo | Nx | Lerna |
|---|---|---|---|
| Task running | ✅ | ✅ | ✅ |
| Caching | ✅ | ✅ | ✅ (via Nx) |
| Code generators | ❌ | ✅ (extensive) | ❌ |
| Dependency graph viz | ✅ (basic) | ✅ (excellent) | ❌ |
| Plugin system | ❌ | ✅ (100+ plugins) | ❌ |
| Affected commands | ❌ | ✅ | ❌ |
| Version management | ❌ | ❌ | ✅ |
| Publishing | ❌ | ❌ | ✅ |
| Module federation | ❌ | ✅ | ❌ |
Key takeaway: Nx has far more features. Turborepo is intentionally minimal.
Developer Experience
Turborepo
- Install:
npx create-turbo@latest - Learn in 30 minutes
- Zero plugins, zero generators
- "It just caches your tasks"
- Maintained by Vercel
Nx
- Install:
npx create-nx-workspace@latest - Learn in 2-3 days for basics, weeks for advanced
- Rich plugin ecosystem (React, Angular, Node, etc.)
- Code generators scaffold new packages
- Graph visualization tool
- Maintained by Nrwl (Nx team)
Lerna
- Original monorepo tool (2016)
- Acquired by Nx team in 2022
- Now uses Nx under the hood for caching
- Primary value:
lerna publishfor npm publishing - Consider it "Nx-lite with publishing"
Remote Caching
Both offer remote caching (share cache across CI runs and team members):
- Turborepo: Vercel Remote Cache (free for Vercel users, or self-hosted)
- Nx: Nx Cloud (free tier: 500 hours/month, or self-hosted with Nx Powerpack)
Remote caching is the biggest performance win. A 10-minute CI build becomes 30 seconds when nothing changed.
When to Use Each
Choose Turborepo When
- Starting a new monorepo
- You want minimal configuration
- Your monorepo has < 20 packages
- Deploying to Vercel (native integration)
- Team doesn't want to learn a framework
- You just need caching and task orchestration
Choose Nx When
- Large monorepo (20+ packages, 100+ developers)
- You need code generators and scaffolding
- Need affected detection for CI optimization
- Building with Angular (Nx was born from Angular CLI)
- Need distributed task execution
- Enterprise with complex build requirements
Choose Lerna When
- Publishing npm packages (lerna publish is still useful)
- Existing Lerna monorepo (don't migrate without reason)
- Combine with Nx:
npx lerna add-cachingadds Nx caching to Lerna
Migration Paths
| From | To | Effort |
|---|---|---|
| Lerna | Turborepo | Low (replace lerna run with turbo) |
| Lerna | Nx | Medium (add nx.json, configure targets) |
| Turborepo | Nx | Medium (add nx.json, keep turbo.json initially) |
| Nx | Turborepo | Hard (lose generators, affected, plugins) |
FAQ
Can I use Turborepo and Nx together?
Technically yes, but there's no benefit. They do the same core job. Pick one.
Is Lerna dead?
Not dead, but not the primary choice for new projects. It's maintained by the Nx team and useful for npm publishing. For task running, use Turborepo or Nx.
Do I even need a monorepo tool?
If you have 2-3 packages, npm/pnpm workspaces alone might be enough. Add Turborepo when builds get slow. Add Nx when you need more structure.
Which is better with pnpm?
Both Turborepo and Nx work great with pnpm workspaces. pnpm is the preferred package manager for monorepos in 2026.
What about Bun workspaces?
Bun workspaces work with Turborepo. Nx support is improving. For bleeding edge, Bun + Turborepo is the fastest setup.
Bottom Line
Turborepo for most teams. Simple, fast, gets out of your way. Nx for large organizations needing code generators, affected detection, and distributed execution. Lerna only for npm publishing workflows.
Start with Turborepo. If you outgrow it (rare), migrate to Nx.