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

Generate schema.json from production Sanity Studio deployment

3 repliesLast updated: Nov 30, 2025

Is there any way to download / generate / reverse-engineer the
schema.json
file from a production deployment of the studio?
Basically I lost the schema file locally and hadn't pushed it anywhere.

I do have the production access.
AI Update

Unfortunately, there's no straightforward way to download the original schema files from a deployed Sanity Studio. When you run sanity deploy, your schema files get bundled and minified into JavaScript - they're not stored separately on Sanity's servers in their original form.

However, there is a method to extract schema information from a deployed Studio, though it won't be perfect. A Sanity engineer created this gist that can help you recover schema definitions from the deployed bundle. The process involves:

Important caveats:

As mentioned in this community thread, the recovered schema will likely be "fractured" and may require significant cleanup. It won't perfectly match your original source code structure, and custom validation functions and other JavaScript logic may not be fully recoverable. It's really a last-resort option.

Why this happens:

When you deploy your Studio, the schema gets compiled into a JavaScript bundle that's served to browsers. Sanity doesn't receive or store your original schema files - only the compiled bundle. This is similar to how any web application works after being built and deployed.

Better approaches for the future:

For your current situation:

Try the gist method mentioned above, but be prepared to do manual cleanup and reconstruction. You might also want to check:

Going forward, treating your schema files as critical source code with proper version control will prevent this situation from happening again. This is a good reminder that while Sanity hosts your Studio, you're responsible for maintaining your source code.

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