Guide for managing TypeScript monorepos with Turborepo and pnpm workspaces. Covers package creation, dependencies, pipeline configuration, and common patterns.
Turborepo orchestrates builds across packages in a monorepo. pnpm workspaces manage dependencies. Together they enable efficient multi-package TypeScript projects.
project/
├── package.json # Root package.json (workspaces config)
├── pnpm-workspace.yaml # pnpm workspace definition
├── turbo.json # Turborepo pipeline configuration
├── packages/
│ ├── types/ # Shared types
│ ├── core/ # Core logic
│ └── client/ # Client library
└── apps/
├── server/ # Server application
└── cli/ # CLI application
{
"name": "my-monorepo",
"private": true,
"scripts": {
"build": "turbo build",
"dev": "turbo dev",
"lint": "turbo lint",
"test": "turbo test",
"check-types": "turbo check-types"
},
"devDependencies": {
"turbo": "^2.0.0",
"typescript": "^5.0.0"
}
}