turborepo-monorepo
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
By giuseppe-trisciuoglio · 3,157 installs
npx skills add giuseppe-trisciuoglio/developer-kit --skill turborepo-monorepo
Source repository · Upstream listing
Turborepo Monorepo
Overview
Provides guidance for Turborepo monorepo management: workspace creation, turbo.json 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 turbo.json 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 cache issues
Migrate from other monorepo tools to Turborepo
Instructions
Workspace Creation
1. Create a new workspace:
2. Initialize in existing project:
3. Create turbo.json in root (minimal config):
4. Add scripts to root package.json:
5. Validate task graph before CI:
Task Configuration
1. Configure tasks in turbo.json :
2. Run tasks:
3. Parallel type checking (use transit nodes to avoid cache issues):
4. Validate before committing:
Framework Integration
Next.js: outputs ".next/ " and env ["NEXT PUBLIC "] See [references/nextjs config.md](references/nextjs config.md)
NestJS: outputs "dist/ " , dev tasks with cache: false, persistent: true See [references/nestjs config.md](references/nestjs config.md)
Testing Setup
1. Vitest configuration:
2. Run affected tests:
See [references/testing config.md](references/testing config.md) for complete testing setup.
Package Configurations
1. Create package specific turbo.json:
See [references/package configs.md](references/package configs.md) for detailed package configuration patterns.
CI/CD Setup
1. GitHub Actions with validation checkpoints:
2. Remote cache setup:
See [references/ci cd.md](references/ci cd.md) for complete CI/CD setup examples.
Task Properties Reference
Property Description Example
dependsOn Tasks that must complete first ["^build"] dependencies first
outputs Files/folders to cache ["dist/ "]
inputs Files for cache hash ["src/ / .ts"]
env Environment variables affecting hash ["DATABASE URL"]
cache Enable/disable caching true or false
persistent Long running task true for dev servers
outputLogs Log verbosity "full" , "new only" , "errors only"
Dependency Patterns
^task Run task in dependencies first (topological order)
task Run task in same package first
package task Run specific package's task
Filter Syntax
Filter Description
web Only web package
web... web + all dependencies
...web web + all dependents
...web... web + deps + dependents
[HEAD^] Packages changed since last commit
./apps/ All packages in apps/
Best Practices
Performance Optimization
1. Use specific outputs Only cache what's needed
2. Fine tune inputs Exclude files that don't affect output
3. Transit nodes Enable parallel type checking
4. Remote cache Share cache across team/CI
5. Package configurations Customize per package behavior
Caching Strategy
Task Organization
Independent tasks No dependsOn : lint, format, spellcheck
Build tasks dependsOn: ["^build"] : build, compile
Test tasks dependsOn: ["build"] : test, e2e
Dev tasks cache: false, persistent: true : dev, watch
Common Issues
Tasks not running in order
Problem: Tasks execute in wrong order
Solution: Check dependsOn configuration
Cache misses on unchanged files
Problem: Cache invalidating unexpectedly
Solution: Review globalDependencies and inputs
Type errors after cache hit
Problem: TypeScript errors not caught due to cache
Solution: Use transit nodes for type checking
Examples
Example 1: Create New Workspace
Input: "Create a Turborepo with Next.js and NestJS"
Example 2: Configure Testing Pipeline
Input: "Set up Vitest for all packages"
Example 3: Run Affected Tests in CI
Input: "Only test changed packages in CI"
Example 4: Debug Cache Issues
Input: "Why is my cache missing?"
Constraints and Warnings
Node.js 18+ is required for Turborepo
Package manager field required in root package.json
Outputs must be specified for caching to work
Persistent tasks cannot have dependents
Windows : WSL or Git Bash recommended
Remote cache requires Vercel account or self hosted solution
Large monorepos may need increased concurrency settings
Reference Files
For detailed guidance on specific topics, consult:
Topic Reference File
turbo.json template [references/turbo.json](references/turbo.json)
Next.js integration [references/nextjs config.md](references/nextjs config.md)
NestJS integration [references/nestjs config.md](references/nestjs config.md)
Vitest/Jest/Playwright [references/testing config.md](references/testing config.md)
GitHub/CircleCI/GitLab CI [references/ci cd.md](references/ci cd.md)
Package configurations [references/package configs.md](references/package configs.md)