🗓️ Everything *[NYC] is back. A free gathering for AI builders. Sept 9 →

How to separate local/dev/staging/prod data with shared schemas?

18 repliesLast updated: Nov 29, 2025

i might have asked before, but is there a recommended way to separate local/dev/staging/prod data?
obviously i want to keep the schemas the same and only update when necessary. but in the early days of the project, how do we do this? also with multiple devs? i don't want to be working on something that might change the schema and mess up my co-workers data
AI Update

Good news - there are several approaches depending on your plan level!

The Standard Approach: Multiple Datasets

The most common way to separate environments is to use multiple datasets within the same Sanity project. You'd typically have separate datasets like development, staging, and production.

How it works:

Setting this up:

In your sanity.config.ts, you can use environment variables to switch datasets:

export default defineConfig({
  projectId: 'your-project-id',
  dataset: process.env.SANITY_STUDIO_DATASET || 'production',
  // ... rest of config
})

Then each developer can set SANITY_STUDIO_DATASET=development locally, or you can have separate Studio deployments for each environment.

For schema changes during development: When you're actively changing schemas, each developer can either:

Enterprise Option: Hot Swapping

If you're on an Enterprise plan, Advanced Dataset Management offers "hot swapping" - you can create dataset aliases that seamlessly switch between datasets. This is perfect for testing migrations and CI/CD pipelines where you want to validate changes before promoting to production.

Workflow Recommendation

For early-stage projects with multiple developers:

The key insight is that schemas are code (they live in your repo), so you version control them like any other code. The datasets just hold the content that conforms to those schemas. When you change a schema, you're just deploying new code - the content in each dataset adapts to the new schema structure.

Show original thread
18 replies

Was this answer helpful?

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.

Related contributions