
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeGreat question! Setting up multiple datasets with staging and production workflows is a common pattern in Sanity. Let me walk you through how to do this.
You can use Workspaces to manage multiple datasets within a single Studio deployment. This lets you switch between your staging and production datasets right from the Studio UI without touching the CLI.
Here's how to set it up in your sanity.config.ts:
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'
import {schemaTypes} from './schemas'
export default defineConfig([
{
name: 'production',
title: 'Production',
projectId: 'your-project-id',
dataset: 'production',
plugins: [structureTool()],
schema: {
types: schemaTypes,
},
},
{
name: 'staging',
title: 'Staging',
projectId: 'your-project-id',
dataset: 'staging',
plugins: [structureTool()],
schema: {
types: schemaTypes,
},
},
])Once configured, you'll see a dropdown in the top-left corner of your Studio that lets you switch between "Production" and "Staging" workspaces. Each workspace connects to its respective dataset, and you can switch between them instantly in the browser - no CLI needed!
Now for the trickier part: moving edited content from staging to production. Unfortunately, Sanity doesn't have a built-in "promote to production" button for moving content between datasets. Here are your options:
The Cross Dataset Duplicator plugin lets you copy individual documents and their assets between datasets directly from the Studio UI:
npm i @sanity/cross-dataset-duplicatorThis is great for your blog post scenario - you can edit a post in staging, then use the plugin to copy it to production when you're ready to publish. However, it's more manual and works best for copying individual documents rather than bulk operations.
You can export specific content from staging and import it to production using the CLI:
# Export from staging
sanity dataset export staging staging-backup.tar.gz
# Import to production (merges with existing content)
sanity dataset import staging-backup.tar.gz productionFor selective migration of specific documents (like just blog posts), you can use GROQ queries:
sanity documents query --dataset staging "*[_type == 'post']" | jq -c ".[]" > posts.ndjson
sanity dataset import posts.ndjson productionIf your goal is more about "draft vs published" workflow rather than true environment separation, consider using Content Releases instead. This feature (available on Growth plans and above) lets you bundle multiple document changes and publish them atomically within the same dataset. It's designed for the exact use case you described - editing content and then making it public when ready.
The workspaces approach gives you the best "switch between datasets in the Studio" experience, while the Cross Dataset Duplicator plugin provides the easiest way to move individual pieces of content between them when you're ready to go live.
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