
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeWhen deploying a monorepo with Sanity Studio and Next.js in separate folders to Vercel, you'll need to configure each project individually. Here's how to handle your structure:
For your setup:
my-project/ ├── studio/ └── web/
You'll create two separate Vercel projects, each pointing to the same GitHub repository.
Set Root Directory: In Vercel project settings, set the Root Directory to studio
Add vercel.json in your studio folder:
{
"version": 2,
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }]
}This configures the SPA fallback so all routes work correctly.
Update package.json build script:
{
"scripts": {
"build": "sanity build"
}
}Install Sanity CLI as dependency: Add @sanity/cli to your package.json devDependencies (not globally). This was the key fix that solved deployment issues.
Output Directory: Set to dist (Sanity's default build output)
Add CORS: After deploying, run:
sanity cors add https://your-studio-url.vercel.app --credentialswebThis approach works well for learning and smaller projects. For production monorepos, consider using tools like Turborepo for better dependency management and build caching.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store