How to Setup a Netlify Studio Locally

2 replies
Last updated: Feb 16, 2021
Is there a guide or article that tells how to set up one of the starters (gridsome blog in my case) and only install the studio/web locally, so that just web/dist gets deployed to Netlify? I burnt through 10% of my free account just making a few test changes 😂
AI Update

Good news - you can absolutely set this up to avoid burning through your Netlify build minutes! The key is understanding that Sanity starters with a monorepo structure (like the Gridsome blog) have separate studio and web folders, and you only need to deploy the built website to Netlify.

Deploy Studio Separately to Sanity's Hosting

First, deploy your Studio to Sanity's free managed hosting instead of Netlify. From your studio directory, run:

cd studio
sanity deploy

This deploys your Studio to a free yourproject.sanity.studio URL and doesn't count against your Netlify build minutes at all. This is the recommended approach for hosting Studio.

Configure Netlify to Only Build and Deploy the Web Folder

For your Gridsome site on Netlify, you need to tell Netlify to only work with the web folder. Create a netlify.toml file in your project root:

[build]
  base = "web"
  publish = "web/dist"
  command = "npm run build"

Or configure these settings in the Netlify UI:

  • Base directory: web
  • Build command: npm run build (or gridsome build)
  • Publish directory: web/dist

Local Development

For local development, you can run them separately:

# Terminal 1 - Studio
cd studio
npm run dev

# Terminal 2 - Gridsome site
cd web
npm run develop

This way, the Studio runs locally on one port, and your Gridsome site on another. You only deploy the compiled static files from web/dist to Netlify, which should be a simple, fast static file upload with no build process eating up your minutes.

The beauty of this setup is that your Studio is completely separate from your frontend deployment, so content editors can use the Studio at yourproject.sanity.studio without triggering any Netlify builds at all. You'll only use Netlify builds when you actually update your frontend code!

You could just work on it locally and only commit when you have changes done.
Also, Netlify is hooked up to a specific branch, so if you create a new branch for working on Studio, then if you commit your changes, they won't build on Netlify. When you are done making changes, you can merge the branches and it will then build on Netlify.
That makes sense. I think I was overthinking the problem. Thanks!

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?