
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! You have a couple of options for isolating development, testing, and production datasets with different URLs. Let me walk you through the approaches:
Workspaces let you configure multiple isolated Studio environments within a single codebase. Each workspace can point to a different dataset and have its own schema configuration, tools, and UI customization.
In your sanity.config.ts, you'd configure it like this:
import {defineConfig} from 'sanity'
export default defineConfig([
{
name: 'development',
basePath: '/dev',
projectId: 'your-project-id',
dataset: 'development',
// ... schema, plugins, etc.
},
{
name: 'testing',
basePath: '/test',
projectId: 'your-project-id',
dataset: 'testing',
// ... schema, plugins, etc.
},
{
name: 'production',
basePath: '/production',
projectId: 'your-project-id',
dataset: 'production',
// ... schema, plugins, etc.
}
])With this setup, you'd access each environment at:
yourstudio.sanity.studio/devyourstudio.sanity.studio/testyourstudio.sanity.studio/productionUsers can switch between workspaces using a dropdown in the Studio UI. This approach is cost-efficient since you maintain one codebase and deployment.
If you want completely separate URLs (like dev.yourstudio.com, test.yourstudio.com, prod.yourstudio.com), you'll need to self-host multiple Studio deployments. Each deployment would have its own sanity.config.ts pointing to a different dataset:
// In your production Studio
export default defineConfig({
name: 'production',
projectId: 'your-project-id',
dataset: process.env.SANITY_STUDIO_DATASET || 'production',
// ... rest of config
})You can use environment variables to control which dataset each deployment connects to. This gives you complete URL isolation but requires managing multiple deployments.
You can also use a single Studio configuration that selects the dataset based on environment variables:
export default defineConfig({
name: process.env.SANITY_STUDIO_ENV || 'production',
projectId: 'your-project-id',
dataset: process.env.SANITY_STUDIO_DATASET || 'production',
// ... rest of config
})Then deploy to different hosting platforms (Vercel, Netlify, etc.) with different environment variables set for each deployment.
The workspaces approach with basePath is generally the easiest to maintain, but if you need completely separate URLs for security or organizational reasons, the multiple deployment approach works well too!
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