Turborepo Monorepo Overview Provides guidance for Turborepo monorepo management: workspace creation, task configuration, Next.js/NestJS integration, testing pipelines (Vitest/Jest), CI/CD setup, and build performance optimization. When to Use - Create or initialize Turborepo workspaces - Configure tasks with dependencies and outputs - Set up Next.js/NestJS apps in monorepo structure - Configure Vitest/Jest test pipelines - Build CI/CD workflows (GitHub Actions, GitLab CI) - Implement remote caching with Vercel Remote Cache - Optimize build times and cache hit ratios - Debug task dependency or…

: 'ts-jest'\n },\n collectCoverageFrom: [\n 'src/**/*.ts',\n '!src/**/*.d.ts',\n '!src/**/*.interface.ts',\n '!src/main.ts'\n ],\n coverageDirectory: 'coverage',\n coverageReporters: ['text', 'lcov', 'html']\n}\n```\n\n### turbo.json for Jest\n\n```json\n{\n \"pipeline\": {\n \"test\": {\n \"dependsOn\": [\"build\"],\n \"outputs\": [\"coverage/**\"],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"jest.config.js\"]\n },\n \"test:watch\": {\n \"cache\": false,\n \"persistent\": true\n }\n }\n}\n```\n\n## Playwright Configuration\n\n### Installation\n\n```bash\npnpm add -D -w @playwright/test\n```\n\n### playwright.config.ts\n\n```typescript\nimport { defineConfig, devices } from '@playwright/test'\n\nexport default defineConfig({\n testDir: './e2e',\n fullyParallel: true,\n forbidOnly: !!process.env.CI,\n retries: process.env.CI ? 2 : 0,\n workers: process.env.CI ? 1 : undefined,\n reporter: 'html',\n use: {\n baseURL: 'http://localhost:3000',\n trace: 'on-first-retry'\n },\n projects: [\n {\n name: 'chromium',\n use: { ...devices['Desktop Chrome'] }\n }\n ],\n webServer: {\n command: 'pnpm run dev',\n url: 'http://localhost:3000',\n reuseExistingServer: !process.env.CI\n }\n})\n```\n\n### turbo.json for Playwright\n\n```json\n{\n \"pipeline\": {\n \"test:e2e\": {\n \"dependsOn\": [\"build\"],\n \"outputs\": [\"playwright-report/**\"],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"playwright.config.ts\"]\n }\n }\n}\n```\n\n## Testing Strategies\n\n### Unit Tests (fast, isolated)\n\n```json\n{\n \"pipeline\": {\n \"test:unit\": {\n \"outputs\": [],\n \"inputs\": [\"src/**/*.ts\", \"test/unit/**/*.ts\"]\n }\n }\n}\n```\n\n### Integration Tests (slower, dependencies)\n\n```json\n{\n \"pipeline\": {\n \"test:integration\": {\n \"dependsOn\": [\"build\"],\n \"outputs\": [\"coverage/**\"]\n }\n }\n}\n```\n\n### E2E Tests (slowest, full system)\n\n```json\n{\n \"pipeline\": {\n \"test:e2e\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\"playwright-report/**\"]\n }\n }\n}\n```\n\n## Running Tests by Type\n\n```bash\n# Run all tests\nturbo run test\n\n# Run only unit tests\nturbo run test:unit\n\n# Run tests for affected packages\nturbo run test --filter=[HEAD^]\n\n# Run tests with coverage\nturbo run test:coverage\n```\n\n## CI/CD Testing\n\n```yaml\n# .github/workflows/ci.yml\n- name: Run tests\n run: pnpm run test --filter=[HEAD^]\n\n- name: Run E2E tests\n run: pnpm run test:e2e --filter=[HEAD^]\n```\n\n## Test Monorepo Patterns\n\n### Testing library changes\n\nWhen a library changes, only test packages that depend on it:\n\n```bash\nturbo run test --filter=[HEAD^]\n```\n\n### Testing only changed packages\n\n```bash\nturbo run test --filter=...[HEAD]\n```\n\n### Parallel test execution\n\nTurborepo automatically runs tests in parallel based on dependencies:\n\n```json\n{\n \"pipeline\": {\n \"test\": {\n \"dependsOn\": [\"build\"]\n }\n }\n}\n```\n","content_type":"text/markdown; charset=utf-8","language":"markdown","size":4155,"content_sha256":"f601171882cd93fdd8b8b7d0c9ebed2a98f4bbbcc6df67896aeb81e842f95a4b"},{"filename":"references/turbo.json","content":"{\n \"$schema\": \"https://turborepo.dev/schema.json\",\n \"globalDependencies\": [\"**/.env.*local\", \".env\"],\n \"globalEnv\": [\"NODE_ENV\", \"CI\"],\n \"pipeline\": {\n \"build\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [\".next/**\", \"!.next/cache/**\", \"dist/**\", \"build/**\"],\n \"env\": [\"NEXT_PUBLIC_*\", \"VITE_*\", \"NUXT_PUBLIC_*\"]\n },\n \"dev\": {\n \"cache\": false,\n \"persistent\": true\n },\n \"lint\": {\n \"outputs\": [],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"!**/*.md\", \"!**/*.spec.ts\", \"!**/*.test.ts\"]\n },\n \"test\": {\n \"dependsOn\": [\"build\"],\n \"outputs\": [\"coverage/**\"],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"jest.config.js\", \"vitest.config.ts\"]\n },\n \"typecheck\": {\n \"dependsOn\": [\"^build\"],\n \"outputs\": [],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"tsconfig.json\"]\n },\n \"clean\": {\n \"cache\": false\n }\n }\n}\n","content_type":"application/json; charset=utf-8","language":"json","size":868,"content_sha256":"ed61f4e11faba4cd2b993cade86e6b3e0d23613b4d3cedf01483bd4571ae5842"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Turborepo Monorepo","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Overview","type":"text"}]},{"type":"paragraph","content":[{"text":"Provides guidance for Turborepo monorepo management: workspace creation, ","type":"text"},{"text":"turbo.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" task configuration, Next.js/NestJS integration, testing pipelines (Vitest/Jest), CI/CD setup, and build performance optimization.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Create or initialize Turborepo workspaces","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Configure ","type":"text"},{"text":"turbo.json","type":"text","marks":[{"type":"code_inline"}]},{"text":" tasks with dependencies and outputs","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Set up Next.js/NestJS apps in monorepo structure","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Configure Vitest/Jest test pipelines","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Build CI/CD workflows (GitHub Actions, GitLab CI)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Implement remote caching with Vercel Remote Cache","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Optimize build times and cache hit ratios","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Debug task dependency or cache issues","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Migrate from other monorepo tools to Turborepo","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Instructions","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Workspace Creation","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Create a new workspace:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm create turbo@latest my-workspace\ncd my-workspace","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Initialize in existing project:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm add -D -w turbo","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Create turbo.json in root","type":"text","marks":[{"type":"strong"}]},{"text":" (minimal config):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"$schema\": \"https://turborepo.dev/schema.json\",\n \"pipeline\": {\n \"build\": { \"dependsOn\": [\"^build\"], \"outputs\": [\"dist/**\", \".next/**\"] },\n \"lint\": { \"outputs\": [] },\n \"test\": { \"dependsOn\": [\"build\"], \"outputs\": [\"coverage/**\"] }\n }\n}","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Add scripts to root package.json:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{ \"scripts\": { \"build\": \"turbo run build\", \"dev\": \"turbo run dev\", \"lint\": \"turbo run lint\", \"test\": \"turbo run test\", \"clean\": \"turbo run clean\" } }","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Validate task graph before CI:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"turbo run build --dry-run --filter=... # Verify task execution order","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Task Configuration","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Configure tasks","type":"text","marks":[{"type":"strong"}]},{"text":" in ","type":"text"},{"text":"turbo.json","type":"text","marks":[{"type":"code_inline"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{ \"pipeline\": { \"build\": { \"dependsOn\": [\"^build\"], \"outputs\": [\"dist/**\"] }, \"test\": { \"dependsOn\": [\"build\"], \"outputs\": [\"coverage/**\"] }, \"lint\": { \"outputs\": [] } } }","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run tasks:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"turbo run build # All packages\nturbo run lint test build # Multiple tasks\nturbo run build --filter=web # Specific package","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Parallel type checking","type":"text","marks":[{"type":"strong"}]},{"text":" (use transit nodes to avoid cache issues):","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{ \"pipeline\": { \"transit\": { \"dependsOn\": [\"^transit\"] }, \"typecheck\": { \"dependsOn\": [\"transit\"] } } }","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Validate before committing:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"turbo run build --dry-run # Check task order and affected packages","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Framework Integration","type":"text"}]},{"type":"paragraph","content":[{"text":"Next.js:","type":"text","marks":[{"type":"strong"}]},{"text":" outputs ","type":"text"},{"text":"\".next/**\"","type":"text","marks":[{"type":"code_inline"}]},{"text":" and env ","type":"text"},{"text":"[\"NEXT_PUBLIC_*\"]","type":"text","marks":[{"type":"code_inline"}]},{"text":" - See ","type":"text"},{"text":"references/nextjs-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/nextjs-config.md","title":null}}]}]},{"type":"paragraph","content":[{"text":"NestJS:","type":"text","marks":[{"type":"strong"}]},{"text":" outputs ","type":"text"},{"text":"\"dist/**\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", dev tasks with ","type":"text"},{"text":"cache: false, persistent: true","type":"text","marks":[{"type":"code_inline"}]},{"text":" - See ","type":"text"},{"text":"references/nestjs-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/nestjs-config.md","title":null}}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Testing Setup","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Vitest configuration:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"pipeline\": {\n \"test\": {\n \"outputs\": [],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"vitest.config.ts\"]\n },\n \"test:watch\": {\n \"cache\": false,\n \"persistent\": true\n }\n }\n}","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Run affected tests:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"turbo run test --filter=[HEAD^]","type":"text"}]},{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"references/testing-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/testing-config.md","title":null}}]},{"text":" for complete testing setup.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Package Configurations","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Create package-specific turbo.json:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"extends\": [\"//\"],\n \"tasks\": {\n \"build\": {\n \"outputs\": [\"$TURBO_EXTENDS$\", \".next/**\"]\n }\n }\n}","type":"text"}]},{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"references/package-configs.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/package-configs.md","title":null}}]},{"text":" for detailed package configuration patterns.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"CI/CD Setup","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"GitHub Actions with validation checkpoints:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"yaml"},"content":[{"text":"- name: Install dependencies\n run: pnpm install\n\n- name: Validate affected packages (dry-run)\n run: pnpm turbo run build --filter=[HEAD^] --dry-run\n # VALIDATE: Review output to confirm only expected packages will build\n\n- name: Run tests\n run: pnpm run test --filter=[HEAD^]\n\n- name: Build affected packages\n run: pnpm run build --filter=[HEAD^]\n\n- name: Verify cache hits\n run: pnpm turbo run build --filter=[HEAD^] --dry-run | grep \"Cache\"\n # VALIDATE: Confirm cache hits for unchanged packages","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Remote cache setup:","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Login to Vercel\nnpx turbo login\n\n# Link repository\nnpx turbo link","type":"text"}]},{"type":"paragraph","content":[{"text":"See ","type":"text"},{"text":"references/ci-cd.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/ci-cd.md","title":null}}]},{"text":" for complete CI/CD setup examples.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Task Properties Reference","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Property","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Description","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Example","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"dependsOn","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tasks that must complete first","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"[\"^build\"]","type":"text","marks":[{"type":"code_inline"}]},{"text":" - dependencies first","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"outputs","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Files/folders to cache","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"[\"dist/**\"]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"inputs","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Files for cache hash","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"[\"src/**/*.ts\"]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"env","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Environment variables affecting hash","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"[\"DATABASE_URL\"]","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"cache","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Enable/disable caching","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"true","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"false","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"persistent","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Long-running task","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"true","type":"text","marks":[{"type":"code_inline"}]},{"text":" for dev servers","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"outputLogs","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Log verbosity","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"\"full\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"\"new-only\"","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"\"errors-only\"","type":"text","marks":[{"type":"code_inline"}]}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Dependency Patterns","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"^task","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Run task in dependencies first (topological order)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"task","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Run task in same package first","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"package#task","type":"text","marks":[{"type":"code_inline"}]},{"text":" - Run specific package's task","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Filter Syntax","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Filter","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Description","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"web","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Only web package","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"web...","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"web + all dependencies","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"...web","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"web + all dependents","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"...web...","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"web + deps + dependents","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"[HEAD^]","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Packages changed since last commit","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"./apps/*","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"All packages in apps/","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Performance Optimization","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use specific outputs","type":"text","marks":[{"type":"strong"}]},{"text":" - Only cache what's needed","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Fine-tune inputs","type":"text","marks":[{"type":"strong"}]},{"text":" - Exclude files that don't affect output","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Transit nodes","type":"text","marks":[{"type":"strong"}]},{"text":" - Enable parallel type checking","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Remote cache","type":"text","marks":[{"type":"strong"}]},{"text":" - Share cache across team/CI","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Package configurations","type":"text","marks":[{"type":"strong"}]},{"text":" - Customize per-package behavior","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Caching Strategy","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"pipeline\": {\n \"build\": {\n \"outputs\": [\"dist/**\"],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"!README.md\", \"!**/*.md\"]\n }\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Task Organization","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Independent tasks","type":"text","marks":[{"type":"strong"}]},{"text":" - No ","type":"text"},{"text":"dependsOn","type":"text","marks":[{"type":"code_inline"}]},{"text":": lint, format, spellcheck","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Build tasks","type":"text","marks":[{"type":"strong"}]},{"text":" - ","type":"text"},{"text":"dependsOn: [\"^build\"]","type":"text","marks":[{"type":"code_inline"}]},{"text":": build, compile","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Test tasks","type":"text","marks":[{"type":"strong"}]},{"text":" - ","type":"text"},{"text":"dependsOn: [\"build\"]","type":"text","marks":[{"type":"code_inline"}]},{"text":": test, e2e","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Dev tasks","type":"text","marks":[{"type":"strong"}]},{"text":" - ","type":"text"},{"text":"cache: false, persistent: true","type":"text","marks":[{"type":"code_inline"}]},{"text":": dev, watch","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Issues","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Tasks not running in order","type":"text"}]},{"type":"paragraph","content":[{"text":"Problem:","type":"text","marks":[{"type":"strong"}]},{"text":" Tasks execute in wrong order","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution:","type":"text","marks":[{"type":"strong"}]},{"text":" Check ","type":"text"},{"text":"dependsOn","type":"text","marks":[{"type":"code_inline"}]},{"text":" configuration","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"build\": {\n \"dependsOn\": [\"^build\"]\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Cache misses on unchanged files","type":"text"}]},{"type":"paragraph","content":[{"text":"Problem:","type":"text","marks":[{"type":"strong"}]},{"text":" Cache invalidating unexpectedly","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution:","type":"text","marks":[{"type":"strong"}]},{"text":" Review ","type":"text"},{"text":"globalDependencies","type":"text","marks":[{"type":"code_inline"}]},{"text":" and ","type":"text"},{"text":"inputs","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"globalDependencies\": [\"tsconfig.json\"],\n \"pipeline\": {\n \"build\": {\n \"inputs\": [\"$TURBO_DEFAULT$\", \"!*.md\"]\n }\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Type errors after cache hit","type":"text"}]},{"type":"paragraph","content":[{"text":"Problem:","type":"text","marks":[{"type":"strong"}]},{"text":" TypeScript errors not caught due to cache","type":"text"}]},{"type":"paragraph","content":[{"text":"Solution:","type":"text","marks":[{"type":"strong"}]},{"text":" Use transit nodes for type checking","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"transit\": { \"dependsOn\": [\"^transit\"] },\n \"typecheck\": { \"dependsOn\": [\"transit\"] }\n}","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Examples","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Example 1: Create New Workspace","type":"text"}]},{"type":"paragraph","content":[{"text":"Input:","type":"text","marks":[{"type":"strong"}]},{"text":" \"Create a Turborepo with Next.js and NestJS\"","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm create turbo@latest my-workspace\ncd my-workspace\n\n# Add Next.js app\npnpm add next react react-dom -F apps/web\n\n# Add NestJS API\npnpm add @nestjs/core @nestjs/common -F apps/api","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Example 2: Configure Testing Pipeline","type":"text"}]},{"type":"paragraph","content":[{"text":"Input:","type":"text","marks":[{"type":"strong"}]},{"text":" \"Set up Vitest for all packages\"","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"json"},"content":[{"text":"{\n \"pipeline\": {\n \"test\": {\n \"dependsOn\": [\"build\"],\n \"outputs\": [\"coverage/**\"],\n \"inputs\": [\"$TURBO_DEFAULT$\", \"vitest.config.ts\"]\n },\n \"test:watch\": {\n \"cache\": false,\n \"persistent\": true\n }\n }\n}","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Example 3: Run Affected Tests in CI","type":"text"}]},{"type":"paragraph","content":[{"text":"Input:","type":"text","marks":[{"type":"strong"}]},{"text":" \"Only test changed packages in CI\"","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"pnpm run test --filter=[HEAD^]","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Example 4: Debug Cache Issues","type":"text"}]},{"type":"paragraph","content":[{"text":"Input:","type":"text","marks":[{"type":"strong"}]},{"text":" \"Why is my cache missing?\"","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Dry run to see what would be executed\nturbo run build --dry-run --filter=web\n\n# Show hash inputs\nturbo run build --force --filter=web","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Constraints and Warnings","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Node.js 18+","type":"text","marks":[{"type":"strong"}]},{"text":" is required for Turborepo","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Package manager field","type":"text","marks":[{"type":"strong"}]},{"text":" required in root ","type":"text"},{"text":"package.json","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Outputs must be specified","type":"text","marks":[{"type":"strong"}]},{"text":" for caching to work","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Persistent tasks","type":"text","marks":[{"type":"strong"}]},{"text":" cannot have dependents","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Windows","type":"text","marks":[{"type":"strong"}]},{"text":": WSL or Git Bash recommended","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Remote cache","type":"text","marks":[{"type":"strong"}]},{"text":" requires Vercel account or self-hosted solution","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Large monorepos","type":"text","marks":[{"type":"strong"}]},{"text":" may need increased ","type":"text"},{"text":"concurrency","type":"text","marks":[{"type":"code_inline"}]},{"text":" settings","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Reference Files","type":"text"}]},{"type":"paragraph","content":[{"text":"For detailed guidance on specific topics, consult:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Topic","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Reference File","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"turbo.json template","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/turbo.json","type":"text","marks":[{"type":"link","attrs":{"href":"references/turbo.json","title":null}}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Next.js integration","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/nextjs-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/nextjs-config.md","title":null}}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"NestJS integration","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/nestjs-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/nestjs-config.md","title":null}}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Vitest/Jest/Playwright","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/testing-config.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/testing-config.md","title":null}}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"GitHub/CircleCI/GitLab CI","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/ci-cd.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/ci-cd.md","title":null}}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Package configurations","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"references/package-configs.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/package-configs.md","title":null}}]}]}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"turborepo-monorepo","author":"@skillopedia","source":{"stars":264,"repo_name":"developer-kit","origin_url":"https://github.com/giuseppe-trisciuoglio/developer-kit/blob/HEAD/plugins/developer-kit-typescript/skills/turborepo-monorepo/SKILL.md","repo_owner":"giuseppe-trisciuoglio","body_sha256":"d5e77b8903205494a40adebaac4e3e18914e48f99957b22c6c85295ed7b6774b","cluster_key":"070fc2cf3f7bfbbe7817e917aabf5f9c6b08038cb34b83507525f7d4ab992f61","clean_bundle":{"format":"clean-skill-bundle-v1","source":"giuseppe-trisciuoglio/developer-kit/plugins/developer-kit-typescript/skills/turborepo-monorepo/SKILL.md","attachments":[{"id":"9d40b379-ed78-589e-a8c1-718b5f011cef","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/9d40b379-ed78-589e-a8c1-718b5f011cef/attachment.md","path":"references/ci-cd.md","size":6492,"sha256":"850d958698c9653e84a493f0f34a3ce2822db8d458f36ff2576e718288aa9234","contentType":"text/markdown; charset=utf-8"},{"id":"33748e8a-5752-5a9e-b27b-c0db1dcc5ca0","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/33748e8a-5752-5a9e-b27b-c0db1dcc5ca0/attachment.md","path":"references/nestjs-config.md","size":3147,"sha256":"ab544f6a78258e2e5ecd68ac2cd4b42200a9fa75dc2fbf09fae83854ce312f95","contentType":"text/markdown; charset=utf-8"},{"id":"23cca77d-fe5e-5742-8fbb-b5eb1f358658","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/23cca77d-fe5e-5742-8fbb-b5eb1f358658/attachment.md","path":"references/nextjs-config.md","size":1774,"sha256":"d4dbc259a2faee46b93cf5f71ce5e13e9c2564befb38f6f389d44223fe7ccc35","contentType":"text/markdown; charset=utf-8"},{"id":"465db090-e294-5216-97ad-eb14e4ceb5bc","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/465db090-e294-5216-97ad-eb14e4ceb5bc/attachment.md","path":"references/package-configs.md","size":3987,"sha256":"66bf674a8d94643a3cf92c7942dd2b3e76833149a58184d15b1cbf53d4406ce7","contentType":"text/markdown; charset=utf-8"},{"id":"df94ef1b-2981-5dfc-83b1-e8cff94ba386","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/df94ef1b-2981-5dfc-83b1-e8cff94ba386/attachment.md","path":"references/testing-config.md","size":4155,"sha256":"f601171882cd93fdd8b8b7d0c9ebed2a98f4bbbcc6df67896aeb81e842f95a4b","contentType":"text/markdown; charset=utf-8"},{"id":"7f5b7bd4-ce63-5df6-840d-b1ff661ebbef","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/7f5b7bd4-ce63-5df6-840d-b1ff661ebbef/attachment.json","path":"references/turbo.json","size":868,"sha256":"ed61f4e11faba4cd2b993cade86e6b3e0d23613b4d3cedf01483bd4571ae5842","contentType":"application/json; charset=utf-8"}],"bundle_sha256":"506812e9106dec7ebf6547b1dca0b096e50882da8afcd7e76ff523d0b727685b","attachment_count":6,"text_attachments":6,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"plugins/developer-kit-typescript/skills/turborepo-monorepo/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"testing-qa","category_label":"Testing"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"testing-qa","import_tag":"clean-skills-v1","description":"Provides comprehensive Turborepo monorepo management guidance for TypeScript/JavaScript projects. Use when creating Turborepo workspaces, configuring turbo.json tasks, setting up Next.js/NestJS apps, managing test pipelines (Vitest/Jest), configuring CI/CD, implementing remote caching, or optimizing build performance in monorepos","allowed-tools":"Read, Write, Edit, Bash, Glob, Grep"}},"renderedAt":1782989654202}

Turborepo Monorepo Overview Provides guidance for Turborepo monorepo management: workspace creation, task configuration, Next.js/NestJS integration, testing pipelines (Vitest/Jest), CI/CD setup, and build performance optimization. When to Use - Create or initialize Turborepo workspaces - Configure tasks with dependencies and outputs - Set up Next.js/NestJS apps in monorepo structure - Configure Vitest/Jest test pipelines - Build CI/CD workflows (GitHub Actions, GitLab CI) - Implement remote caching with Vercel Remote Cache - Optimize build times and cache hit ratios - Debug task dependency or…