ConfigsApr 6, 2026·2 min read

Turborepo — High-Performance JS/TS Monorepo Build System

Incremental build system for JavaScript and TypeScript monorepos by Vercel. Remote caching, parallel execution, and zero-config setup. Never rebuild unchanged packages. 28,000+ stars.

TL;DR
Turborepo speeds up monorepo builds with remote caching, parallel execution, and dependency-aware task scheduling.
§01

What it is

Turborepo is an incremental build system for JavaScript and TypeScript monorepos, developed by Vercel. It understands the dependency graph between packages in your monorepo and only rebuilds what has changed. Combined with remote caching, it ensures that no build work is ever done twice across your entire team or CI.

Turborepo is designed for frontend and full-stack teams managing multiple packages, apps, and shared libraries in a single repository.

§02

How it saves time or tokens

In a typical monorepo, running build or test across all packages is slow because every package rebuilds from scratch. Turborepo hashes inputs for each task and caches the outputs. When you run the same task with the same inputs, it replays the cached output instantly. Remote caching means your teammate or CI server can reuse the cache from your local build. Teams report build times dropping by 40-80% after adopting Turborepo.

§03

How to use

  1. Create a new monorepo or add Turborepo to an existing one:
# New monorepo
npx create-turbo@latest my-monorepo

# Or add to existing project
npm install turbo --save-dev
  1. Configure tasks in turbo.json:
{
  "tasks": {
    "build": {
      "dependsOn": ["^build"],
      "outputs": ["dist/**"]
    },
    "test": {
      "dependsOn": ["build"]
    },
    "lint": {}
  }
}
  1. Run tasks across all packages:
npx turbo build
npx turbo test
npx turbo build test lint  # parallel where possible
§04

Example

A monorepo structure with Turborepo:

my-monorepo/
  apps/
    web/          # Next.js app
    api/          # Express server
  packages/
    ui/           # Shared React components
    config/       # Shared ESLint, TS configs
    utils/        # Shared utilities
  turbo.json
  package.json

Running npx turbo build builds packages/utils first (no dependencies), then packages/ui (depends on utils), then apps/web and apps/api in parallel (both depend on ui). If packages/utils has not changed since the last build, its output is replayed from cache in milliseconds.

§05

Related on TokRepo

§06

Common pitfalls

  • Not specifying outputs in turbo.json. Without output declarations, Turborepo cannot cache task results, and you lose the primary performance benefit.
  • Forgetting to set up remote caching for CI. Local caching helps individual developers, but remote caching is where the biggest gains come from in team environments. Link with npx turbo login && npx turbo link.
  • Using dependsOn: ["build"] (without the ^ prefix) when you mean cross-package dependencies. The ^ prefix means 'run this task in dependencies first', while without it means 'run this task in the same package first'.

Frequently Asked Questions

How does Turborepo remote caching work?+

Turborepo hashes the inputs for each task (source files, environment variables, dependencies). When a task runs, it uploads the output artifact to a remote cache (Vercel by default, or self-hosted). When any team member or CI runner runs the same task with the same inputs, Turborepo downloads and replays the cached output instead of rebuilding.

Can I use Turborepo with pnpm or yarn workspaces?+

Yes. Turborepo works with npm, pnpm, and yarn workspaces. It reads the workspace configuration from your package manager and builds the dependency graph automatically. No additional configuration is needed.

How does Turborepo compare to Nx?+

Both are monorepo build tools with caching and task scheduling. Turborepo focuses on simplicity and zero-config for JS/TS projects. Nx provides more features like code generators, module boundaries, and support for non-JS languages. Turborepo is often chosen for smaller monorepos or teams that prefer minimal tooling.

Is Turborepo free to use?+

Turborepo itself is open source and free. Remote caching via Vercel has a free tier (limited cache size) and paid plans for larger teams. You can also self-host the remote cache server to avoid vendor dependency.

Does Turborepo work with Docker builds?+

Yes. Turborepo provides a prune command that generates a minimal subset of the monorepo for a specific app, making Docker builds faster by only including the packages that app depends on. This reduces Docker layer sizes and build times.

Citations (3)
🙏

Source & Thanks

Created by Vercel. Licensed under MIT.

turborepo — ⭐ 28,000+

Thanks to Vercel for making monorepo builds fast.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets