Deploy multiple Sanity Studios with different datasets in same project

3 replies
Last updated: Nov 29, 2025
Hello! How would you go about deploying several studio’s with different datasets in the same project? More specifically we want to isolate the development, testing, and production datasets in different studios with different URL's, if possible. Cheers.
AI Update

Great 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/dev
  • yourstudio.sanity.studio/test
  • yourstudio.sanity.studio/production

Users can switch between workspaces using a dropdown in the Studio UI. This approach is cost-efficient since you maintain one codebase and deployment.

Option 2: Separate Studio Instances with Different URLs

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.

Environment Variables Approach

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.

Important Considerations

  • All datasets exist within the same project, so they share authentication and project-level settings
  • If your datasets have different schemas, you'll need to define all possible schemas in your configuration and potentially use conditional desk structures to show only relevant content per workspace
  • Permissions can be scoped per dataset using Sanity's role-based access control

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!

Show original thread
3 replies

Sanity – Build the way you think, not the way your CMS thinks

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.

Was this answer helpful?