skills/vercel-cli/references/monorepos.md
Vercel auto-detects monorepo tools (Turborepo, Nx) and workspace managers (pnpm, Yarn, npm). Each project in the monorepo gets its own Vercel project, linked via vercel link --repo.
vercel link --repo # link the whole repo
vercel pull # pull env vars
vc dev # local development
vercel deploy # deploy
Use vercel link --repo to create .vercel/repo.json, which maps directories to Vercel projects:
{
"orgId": "org_xxxxx",
"projects": [
{ "id": "prj_xxxxx", "name": "web", "directory": "apps/web" },
{ "id": "prj_yyyyy", "name": "api", "directory": "apps/api" }
]
}
Running from a project subdirectory (e.g., apps/web/) skips the "which project?" prompt.
Set rootDirectory in vercel.json when your app isn't at the repo root:
{
"rootDirectory": "apps/api"
}
Turborepo requires an explicit build task. Define it in turbo.json:
{
"tasks": {
"build": {
"dependsOn": ["^build"],
"env": ["VERCEL"],
"outputs": [".next/**", "!.next/cache/**", ".vercel/output/**", "dist/**"]
}
}
}
Vercel automatically generates the right build command — you don't need to configure it. If you need a manual override in vercel.json:
{
"buildCommand": "turbo run build --filter={packages/my-app}..."
}
Vercel auto-sets npx turbo-ignore as the "Ignored Build Step" command, which skips builds when a project's dependencies haven't changed.
Nx requires a build target. Define it in nx.json:
{
"targetDefaults": {
"build": {
"dependsOn": ["^build"]
}
}
}
root/
├── turbo.json
├── package.json
├── pnpm-workspace.yaml
├── vercel.json
├── apps/
│ └── api/
│ ├── package.json
│ └── server.ts
└── packages/
└── shared/
├── package.json
└── src/index.ts
pnpm-workspace.yaml:
packages:
- 'apps/*'
- 'packages/*'
vercel.json:
{
"rootDirectory": "apps/api"
}
apps/api/server.ts:
import { Hono } from 'hono';
import { greet } from '@repo/shared';
const app = new Hono();
app.get('/', c => c.text(greet('world')));
export default app;
vercel link instead of vercel link --repo: Creates project.json which only tracks one project. Use --repo for monorepos.build task in turbo.json/nx.json: Vercel requires an explicit build task. Without it, the build fails.build script to package.json for transpilation: Vercel handles TypeScript compilation. The turbo.json build task is for orchestration, not transpilation.vercel whoami to check, vercel teams switch to change.