Turborepo Cheat Sheet

Quick reference for Turborepo commands, pipeline configuration, caching, and workspace management. Essential commands for monorepo development.

Getting Started Pipeline Config (turbo.json) Caching Workspace Management Environment Variables

Getting Started

npx create-turbo@latest Create a new Turborepo monorepo
turbo init Initialize Turborepo in an existing monorepo
turbo run build Run the build task across all packages
turbo run dev Run dev servers for all packages
turbo run lint Run linting across all packages

Pipeline Config (turbo.json)

"dependsOn": ["^build"] Run after dependency builds complete
"outputs": ["dist/**"] Specify cacheable output directories
"cache": false Disable caching for a task
"persistent": true Mark long-running tasks (e.g. dev servers)
"env": ["API_URL"] Include env vars in task hash

Caching

turbo run build --force Ignore cache and force re-execution
turbo run build --dry Show what would run without executing
turbo prune --scope=app Create sparse monorepo with only needed packages
TURBO_TEAM=my-team Set team for remote caching
TURBO_TOKEN=token Auth token for remote cache access

Workspace Management

turbo run build --filter=app Run task only in the "app" package
turbo run build --filter=./packages/* Run task in all packages under packages/
turbo run build --filter=[HEAD^1] Run only in packages changed since last commit
turbo run build --filter=...^app Run in all dependencies of "app" (excluding app)
turbo gen workspace Scaffold a new workspace from a template

Environment Variables

"globalEnv": ["CI"] Env vars that affect all task hashes globally
"env": ["DATABASE_URL"] Env vars scoped to a specific task hash
"globalPassThroughEnv": ["npm_lifecycle_event"] Global env vars passed through without hashing
"passThroughEnv": ["SECRET_KEY"] Task-scoped env vars passed through without hashing
TURBO_HASH Environment variable exposing the current task hash

Try It Live

Test these patterns with our free JSON Formatter. No signup needed.

Open JSON Formatter →
Step-by-Step Guide

How to Format JSON Online

Read Guide →

More Cheat Sheets