Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Configure and optimize Turborepo monorepo build pipelines with correct task structure, caching, and CI setup.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/caching/remote-cache.md
1# Remote Caching23Share cache artifacts across your team and CI pipelines.45## Benefits67- Team members get cache hits from each other's work8- CI gets cache hits from local development (and vice versa)9- Dramatically faster CI runs after first build10- No more "works on my machine" rebuilds1112## Vercel Remote Cache1314Free, zero-config when deploying on Vercel. For local dev and other CI:1516### Local Development Setup1718```bash19# Authenticate with Vercel20npx turbo login2122# Link repo to your Vercel team23npx turbo link24```2526This creates `.turbo/config.json` with your team info (gitignored by default).2728### CI Setup2930Set these environment variables:3132```bash33TURBO_TOKEN=<your-token>34TURBO_TEAM=<your-team-slug>35```3637Get your token from Vercel dashboard → Settings → Tokens.3839**GitHub Actions example:**4041```yaml42- name: Build43run: npx turbo build44env:45TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}46TURBO_TEAM: ${{ vars.TURBO_TEAM }}47```4849## Configuration in turbo.json5051```json52{53"remoteCache": {54"enabled": true,55"signature": false56}57}58```5960Options:6162- `enabled`: toggle remote cache (default: true when authenticated)63- `signature`: require artifact signing (default: false)6465## Artifact Signing6667Verify cache artifacts haven't been tampered with:6869```bash70# Set a secret key (use same key across all environments)71export TURBO_REMOTE_CACHE_SIGNATURE_KEY="your-secret-key"72```7374Enable in config:7576```json77{78"remoteCache": {79"signature": true80}81}82```8384Signed artifacts can only be restored if the signature matches.8586## Self-Hosted Options8788Community implementations for running your own cache server:8990- **turbo-remote-cache** (Node.js) - supports S3, GCS, Azure91- **turborepo-remote-cache** (Go) - lightweight, S3-compatible92- **ducktape** (Rust) - high-performance option9394Configure with environment variables:9596```bash97TURBO_API=https://your-cache-server.com98TURBO_TOKEN=your-auth-token99TURBO_TEAM=your-team100```101102## Cache Behavior Control103104```bash105# Disable remote cache for a run106turbo build --remote-cache-read-only # read but don't write107turbo build --no-cache # skip cache entirely108109# Environment variable alternative110TURBO_REMOTE_ONLY=true # only use remote, skip local111```112113## Debugging Remote Cache114115```bash116# Verbose output shows cache operations117turbo build --verbosity=2118119# Check if remote cache is configured120turbo config121```122123Look for:124125- "Remote caching enabled" in output126- Upload/download messages during runs127- "cache hit, replaying output" with remote cache indicator128