Turborepo
Build orchestration, task pipeline, and caching with Turborepo.
YeetCode uses Turborepo v2.8.1 for build orchestration. It handles dependency-aware parallel execution, output caching, and task pipelines across all workspaces.
Task Pipeline
The pipeline is defined in turbo.json:
{
"tasks": {
"topo": {
"dependsOn": ["^topo"]
},
"build": {
"inputs": ["$TURBO_DEFAULT$", ".env"],
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "next-env.d.ts", "dist/**"]
},
"dev": {
"inputs": ["$TURBO_DEFAULT$", ".env"],
"persistent": true,
"cache": false
},
"lint": {
"dependsOn": ["^topo"]
},
"typecheck": {
"dependsOn": ["^topo"],
"outputs": ["node_modules/.cache/tsbuildinfo.json"]
}
}
}How Tasks Work
| Task | Depends On | Cached | Notes |
|---|---|---|---|
topo | ^topo (topological) | Yes | Ensures correct build order |
build | ^build | Yes | Outputs: .next/**, dist/** |
dev | — | No | Persistent (long-running), runs in parallel |
lint | ^topo | Yes | Runs after dependency graph is resolved |
typecheck | ^topo | Yes | Outputs: .tsbuildinfo |
start | — | No | Starts production servers |
test | — | No | Runs tests |
clean | — | No | Cleans build artifacts |
Key Concepts
^prefix means "run this task in dependencies first."^buildmeans "build my dependencies before building me."$TURBO_DEFAULT$uses Turbo's default file hashing for cache invalidation.- Persistent tasks like
devare long-running processes that Turbo won't try to cache.
Global Dependencies
{
"globalDependencies": ["**/.env"]
}Any .env file change invalidates all task caches. This ensures environment variable changes always trigger fresh builds.
UI Mode
Turborepo is configured with "ui": "stream" for streaming task output in the terminal.