| name | turborepo-monorepo |
| description | Turborepo monorepo structure and pnpm workspace conventions. Use when adding packages, configuring build pipelines, managing dependencies, running scripts, or working with the monorepo root config. Triggers on tasks involving workspace setup, package management, turbo.json, pnpm-workspace.yaml, or cross-package dependencies. |
| frameworks | ["turborepo"] |
| languages | ["typescript"] |
| category | tooling |
| updated | "2026-03-06T00:00:00.000Z" |
Turborepo Monorepo Skill
Quick Reference
When to Use: Adding workspace packages, configuring build pipelines, managing dependencies, or cross-package operations
Package Manager: pnpm 10.27+ (NEVER use npm or yarn)
Runtime: Node.js โฅ22.20.0
Workspace Structure
turbo-template-laravel/
โโโ apps/
โ โโโ web/ # Next.js 16 frontend (port 3001)
โ โโโ laravel/ # Laravel 12 API (PHP-FPM + Nginx in Docker, port 8000)
โ โโโ mobile/ # Flutter mobile app
โโโ packages/
โ โโโ api-client/ # @repo/api-client โ Orval-generated TanStack Query hooks
โ โโโ e2e-web/ # Playwright end-to-end tests
โโโ tooling/
โ โโโ eslint/ # @repo/eslint-config โ ESLint configs
โ โโโ prettier/ # @repo/prettier-config โ Prettier config
โ โโโ typescript/ # @repo/typescript-config โ TSConfig bases
โโโ turbo.json # Task pipeline configuration
โโโ pnpm-workspace.yaml # Workspace definition + catalogs
โโโ package.json # Root scripts
pnpm Workspace Config
packages:
- apps/*
- packages/*
- tooling/*
catalog:
"@tanstack/react-query": ^5.90.16
next: 16.1.1
react: 19.2.3
tailwindcss: ^4.1.18
typescript: ^5.9.3
zod: ^4.3.5
Common Scripts
Development
pnpm dev
pnpm dev:web
pnpm dev:mobile
Build & Quality
pnpm build
pnpm lint
pnpm lint:fix
pnpm format
pnpm format:fix
pnpm typecheck
Laravel (via pnpm -F @repo/laravel)
pnpm -F @repo/laravel test
pnpm -F @repo/laravel lint
pnpm -F @repo/laravel format
pnpm -F @repo/laravel typecheck
pnpm -F @repo/laravel openapi:generate
API Client
pnpm -F @repo/api-client generate
Turbo Pipeline Configuration
{
"tasks": {
"build": {
"dependsOn": ["^build", "^lint", "^typecheck"],
"outputs": [".cache/tsbuildinfo.json", "dist/**"],
"cache": true
},
"dev": { "cache": false, "persistent": false },
"lint": {
"dependsOn": ["^topo", "^build"],
"outputs": [".cache/.eslintcache"],
"cache": true
},
"typecheck": {
"dependsOn": ["^topo", "^build"],
"outputs": [".cache/tsbuildinfo.json"],
"cache": true
}
},
"globalPassThroughEnv": ["NODE_ENV", "CI", "VERCEL", "VERCEL_ENV", "VERCEL_URL"]
}
Key points:
^build = build dependencies first (topological)
build depends on ^lint + ^typecheck for quality gate
dev is not cached (live reload)
globalPassThroughEnv passes env vars to all tasks
Package Cross-References
Importing Workspace Packages
{
"dependencies": {
"@repo/api-client": "workspace:*"
}
}
import { useGetApiV1Todos, configureFetcher } from "@repo/api-client"
Package with Sub-Path Exports
{
"name": "@repo/api-client",
"exports": {
".": { "types": "./src/index.ts", "default": "./src/index.ts" }
}
}
Next.js transpilePackages
const config: NextConfig = {
transpilePackages: [
"@repo/api-client",
"@t3-oss/env-core", "@t3-oss/env-nextjs",
],
}
Creating a New Package
-
Create directory structure:
packages/[name]/
โโโ src/index.ts
โโโ package.json
โโโ tsconfig.json
-
Package manifest:
{
"name": "@repo/[name]",
"version": "0.0.0",
"private": true,
"type": "module",
"exports": { ".": "./src/index.ts" },
"scripts": { "build": "tsc", "dev": "tsc --watch" }
}
-
TypeScript config:
{ "extends": "@repo/typescript-config/pkg.json", "include": ["src"], "exclude": ["node_modules"] }
-
Add to consumers:
{ "dependencies": { "@repo/[name]": "workspace:*" } }
-
Run pnpm install to link the new package.
Tooling Config Sharing
ESLint
import nestConfig from "@repo/eslint-config/nest.mjs"
export default [...nestConfig]
TypeScript
{ "extends": "@repo/typescript-config/next.json" }
Prettier
{ "prettier": "@repo/prettier-config" }
Key Rules
- Always use
pnpm โ never npm or yarn
- Use
workspace:* for internal package dependencies
- Use pnpm catalog for shared version pinning
- Packages MUST have
index.ts โ exception to no-barrel-files rule
- Apps must NOT have barrel files โ import directly from specific files
- Run
pnpm lint && pnpm typecheck before committing
- Add
transpilePackages in Next.js for workspace packages
- Update
.env.example when adding environment variables