Dataset vs Studio: Do I need separate Sanity projects for each environment?

18 replies
Last updated: May 19, 2022
Hi,
we have set up our Sanity Studio like this, companyname.sanity.studio - 4 datasets:
Dev
QA
Stag
Prod

But we found out that when doing changes to the studio in one dataset it changes to all datasets in the same Studio.

Now
user H
tells me we need 4 different environments and studios to avoid this, is this how Sanity has built this?
We only use this for one website, so I think it is a bit strange to have 4 different projects.

Please explain how you have built this. Thanks
AI Update

I understand your confusion! Let me clarify what's happening and how Sanity workspaces actually work.

What's Actually Happening

You have one Sanity project with one Studio deployment at companyname.sanity.studio. When you configured workspaces, you set up four different environments (Dev, QA, Stag, Prod) that you can switch between using a dropdown in the Studio.

Here's the key thing to understand: Each workspace CAN have its own independent schema, configuration, and plugins. The workspaces feature is specifically designed to provide "isolated Studio configurations" within a single codebase. However, you're deploying all of these configurations together as one Studio deployment.

Why Changes Affect All Datasets

When you run sanity deploy, you're deploying your entire Studio codebase to companyname.sanity.studio. This means:

  • All workspace configurations get deployed together
  • Any schema changes you make in your code affect all workspaces when you redeploy
  • You can only have one hosted Studio per project on the *.sanity.studio domain

So while each workspace can have different schemas and configurations in your code, when you deploy, you're deploying all of them at once. If you change a schema definition and redeploy, that change goes live for all workspaces simultaneously.

Two Approaches to Solve This

Option 1: Self-Host Separate Studio Instances

If you need to test Studio/schema changes in isolation before they hit production:

  • Keep your one Sanity project with multiple datasets
  • Deploy separate Studio instances to different hosting providers (Vercel, Netlify, etc.)
  • Example: studio-dev.yourcompany.com → Dev dataset, studio-prod.yourcompany.com → Prod dataset
  • Each deployment can have different code/schema versions

Note: You can only have one Studio on *.sanity.studio, so additional environments must be self-hosted elsewhere.

Option 2: Use Workspaces as a Dataset Switcher (Most Common)

Most teams actually want schema consistency across environments. The typical workflow:

  1. Develop schema changes locally
  2. Test thoroughly in your Dev workspace
  3. Deploy once to companyname.sanity.studio
  4. All workspaces get the updated schema simultaneously
  5. Content flows through environments: Dev → QA → Stag → Prod

This ensures your production environment has the exact same schema you tested in development.

Do You Need 4 Separate Projects?

No, definitely not. Separate projects are for completely different applications or clients. One website with multiple environments should use one project with multiple datasets—which is exactly what you have.

The Real Question

Do you need to test Studio code changes in Dev before deploying them to Prod? Or do you just need to separate content between environments?

  • Just separating content? Your current setup is perfect. Understand that schema/Studio changes deploy to all workspaces together.
  • Need to test Studio changes in isolation? You'll need to self-host separate Studio deployments pointing to different datasets.

For most teams, having consistent Studio configuration across all environments (with only content being different) is actually the desired and recommended approach.

Show original thread
18 replies
At Gorillas, we do use 2 different projects for the 2 environments of the same website, indeed. And we have a script to backport production data onto the development environment to make it easier to work on actual data.
But we found out that when doing changes to the studio in one dataset it changes to all datasets in the same Studio.
Could you elaborate on this? Are you saying that changes you make in the studio is reflected in all datasets? (The studio can’t do requests to multiple datasets at once)
user Y
-
user H
will elaborate on this.
There are different ways of slicing and dicing projects/datasets/studios. The most common way is to have one studio, one project, and use datasets for dev/staging/prod environments.
In these cases, it’s often better to deploy the studio to another hosting solution (like Vercel or Netlify) and use environment variables to control its dataset configuration. Then you can access the studio on
dev|qa|taging.domain.tld/studio
or something along those lines.
Yeah, that is what I was hoping for also.
let me correct the question a bit, so we have 4 datasets that we have created for seperate environments. but as sanity only has one studio instance. any dev change that we do to sanity scheme is reflected in studio before even getting qa tested. so my proposed solution is to host multiple sanity studio instances so that devs can do changes and deploy to that particular env to test without changing the production schema
I see. Then I’d look at hosting the studio on e.g. Vercel that also supports PR and branch deployments. This is what we do internally at Sanity 🙂
yup. thank you. this is whats proposed internally from our dev team as well. 🙂
Our
sanity.studio
hosting is made for simple use cases to get started quickly.
Great. We are using Vercel as well
So we move the studio hosting to vercel, then it will be resolved. Any good resources on migration or moving or is it easy peasy?
It should be enough to point Vercel to the studio repo. It should have automatic config support
user E
its fairly straightforward process to deploy sanity in Vercel
Great stuff, thanks for your quick feedback Knut 👍
Thank You again for quick support and feedback. 🙂

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?