| name | monorepo-management |
| description | Nx, Turborepo, and Lerna workflows for monorepo management. Use for large-scale projects with multiple packages. |
📦 Monorepo Management Skill
Tools Comparison
| Feature | Nx | Turborepo | Lerna |
|---|
| Caching | ✅ Local + Remote | ✅ Local + Remote | ❌ |
| Affected | ✅ Built-in | ⚠️ Manual | ⚠️ Limited |
| Generators | ✅ Rich | ❌ None | ❌ None |
| Learning | Steep | Easy | Easy |
Turborepo Setup
npx create-turbo@latest
turbo.json
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**"]
},
"lint": {},
"test": {
"dependsOn": ["build"]
}
}
}
Commands
turbo run build
turbo run build --filter=web
turbo run lint test
Nx Setup
npx create-nx-workspace@latest myorg
nx.json
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"cache": true
}
}
}
Commands
nx build web
nx affected:build
nx graph
nx generate @nx/react:component button --project=ui
Package Structure
monorepo/
├── apps/
│ ├── web/ # Next.js app
│ ├── admin/ # Admin dashboard
│ └── api/ # Backend API
├── packages/
│ ├── ui/ # Shared components
│ ├── utils/ # Shared utilities
│ └── config/ # Shared configs
├── turbo.json
└── package.json
Workspace Setup
pnpm-workspace.yaml
packages:
- 'apps/*'
- 'packages/*'
Internal Packages
{
"name": "@myorg/ui",
"main": "./src/index.ts"
}
{
"dependencies": {
"@myorg/ui": "workspace:*"
}
}
Checklist