Joint session with Vercel: How to build intelligent storefronts (May 15th)

Deploy Sanity Studio to Netlify - Setup Help

17 repliesLast updated: Nov 29, 2025

hi, I followed the Sanity-Gatsby tutorial below and was able to deploy to Netlify, but couldn’t figure out the part about deploying the Studio to Netlify:
https://www.sanity.io/blog/how-to-quickly-set-up-a-gatsby-js-jamstack-website-with-a-headless-cms
AI Update

Great question! Deploying Sanity Studio to Netlify is definitely doable. Since the tutorial focuses on deploying your Gatsby site, I'll walk you through the Studio deployment part.

Quick Overview

Sanity Studio is a React Single Page Application (SPA), so you can self-host it on Netlify. You'll need to build the Studio into static files and configure Netlify to handle SPA routing properly.

Step-by-Step Deployment

1. Build Configuration

In your Netlify settings (or netlify.toml file), configure:

If you're working with a monorepo where your Studio is in a subdirectory (like studio/), you'll need to:

Here's an example netlify.toml for a monorepo setup:

[build]
  base = "studio/"
  command = "sanity build"
  publish = "dist"

2. SPA Redirect Configuration

Since Sanity Studio is an SPA, you need to tell Netlify to redirect all routes to index.html. Create a _redirects file in your Studio's static folder (create the folder if it doesn't exist):

/*    /index.html   200

This ensures that navigating directly to Studio routes (like /desk or /vision) works correctly instead of returning 404 errors.

3. CORS Origins Setup

This is crucial! After your Studio is deployed to Netlify, you need to add the Netlify URL to your Sanity project's CORS origins:

Without this step, your Studio won't be able to authenticate and access your content.

Alternative: Use sanity deploy

Just a heads up—while self-hosting on Netlify works great, Sanity also offers hosted Studio deployment with the sanity deploy command. This gives you a *.sanity.studio URL with automatic SSL, no CORS configuration needed, and it's the recommended approach since it automatically deploys your schema for features like AI Agent Actions.

You can run both! Many teams use sanity deploy for their production Studio while keeping Netlify for the Gatsby frontend.

Troubleshooting Tips

Hope this helps you get your Studio deployed! Let me know if you run into any issues with these steps.

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