How to clone/retrieve schema from deployed Sanity Studio?
Unfortunately, you cannot retrieve your source code, schemas, or configuration files from a deployed *.sanity.studio instance. When you run sanity deploy, it compiles your Studio into a static bundle (HTML, CSS, and JavaScript) that gets hosted on Sanity's infrastructure. This is a built production artifact, not your original source code.
Think of it like this: the deployed Studio is similar to a compiled application - you can use it, but you can't "decompile" it back into your original schema definitions, custom components, or configuration files.
What You Should Do
Yes, you absolutely should use Git or another version control system to track your Sanity Studio project! This is considered a best practice for several reasons:
- Source code preservation: Your schema definitions, custom components, and configuration are valuable code that needs to be versioned
- Team collaboration: Multiple developers can work on the Studio simultaneously
- Rollback capability: If something breaks, you can revert to a previous working state
- Deployment automation: You can set up CI/CD pipelines to automatically deploy when you push changes
What IS Available from Sanity
While you can't retrieve your Studio source code, you can access:
- Your content data: All documents in your dataset are always accessible via the Sanity CLI using GROQ queries or through the API
- Your deployed schema: When you run
sanity deploy, it also deploys your schema definitions to Sanity's platform (used by features like Agent Actions and Canvas), but this is for platform features, not for retrieving your source code
Recovery Options
If you've lost your local files but have a deployed Studio:
- Check if you have any backups on other machines or cloud storage
- Look for any previous deployments to other services (Vercel, Netlify) that might have the source
- If you're working with a team, check if anyone else has the repository
- As a last resort, you'd need to manually recreate your schema by examining your deployed Studio's behavior and document structure in your dataset
Bottom line: Always use version control for your Sanity Studio project. The deployed *.sanity.studio is just the compiled output, not a backup of your source code.
Show original thread5 replies
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.