Sanity Pioneers: Get early access to betas, extra AI credits, and a direct line to the engineering team. Apply now

Deploy Studio and Frontend Separately with Existing Dataset

39 repliesLast updated: Nov 29, 2025

Hi all, has anyone had luck deploying their studio and frontend to different locations? I’ve created a new project and want to use an existing dataset, but I’m having a lot of trouble. Can anyone point me in the right direction?
AI Update

Good news - deploying your Studio and frontend to different locations is totally doable and actually quite common! Here's what you need to know to get this working smoothly.

The Basic Setup

When connecting a new Studio to an existing dataset, you need to configure your Studio's sanity.config.js (or .ts) file with the correct project ID and dataset name. This is your main configuration file where all Studio settings are defined:

import { defineConfig } from 'sanity'
import { deskTool } from 'sanity/desk'

export default defineConfig({
  projectId: 'your-project-id',
  dataset: 'your-existing-dataset',
  plugins: [deskTool()],
  // ... other config
})

Your frontend application uses the same projectId and dataset values when initializing the Sanity client, but they're completely separate deployments.

CORS Configuration - This is Likely Your Issue!

The most common problem when deploying to different locations is CORS (Cross-Origin Resource Sharing) configuration. When your Studio and frontend are on different domains, you need to explicitly allow those domains to access your Sanity project.

Head to manage.sanity.io, navigate to your project, then go to Settings > API > CORS Origins. You'll need to add:

Important: Make sure to check the "Allow credentials" box if you're using authentication tokens. This is required when the Access-Control-Allow-Credentials header needs to be set to 'true'.

Deployment Options for Studio

You have a few options for deploying your Studio:

Option 1: Sanity's Hosted Platform (Recommended)

Use the sanity deploy command to deploy to Sanity's hosting:

sanity deploy

This gives you a *.sanity.studio domain, automatically handles schema deployment for platform features like AI Agent Actions, and requires minimal configuration.

Option 2: Self-Hosted

Since Studio is just a React SPA, you can deploy it to Vercel, Netlify, or any other hosting provider. Just make sure to add your deployment URL to CORS origins.

Working with Existing Datasets

If you're specifically trying to copy data from an existing dataset to a new project, you have a couple of options:

Quick Troubleshooting Checklist

The separate deployment approach is actually ideal - it lets you deploy your Studio independently from your frontend, which is perfect for content teams who need Studio access without touching your production site!

Show original thread
39 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