How to undeploy a Sanity hosted CMS after refactoring to Vercel

2 replies
Last updated: May 29, 2024
What is the opposite of
sanity deploy
? For example, I have a sanity hosted CMS but have since refactored this into a monorepo hosted on Vercel and do not want the client to access the Sanity hosted version anymore
AI Update

Perfect! The opposite of sanity deploy is sanity undeploy.

To remove your Sanity-hosted Studio, simply run this command from your Studio directory:

sanity undeploy

This command will remove the hosted version of your Studio from Sanity's servers. The command reads the studio hostname from your sanity.cli.ts file to know which deployment to remove.

After running sanity undeploy, the Sanity-hosted URL (typically something like yourproject.sanity.studio) will no longer be accessible, which is exactly what you want since you've moved to a self-hosted setup on Vercel.

A few things to note:

  • This only removes the hosted Studio - it doesn't affect your Content Lake, datasets, or any content
  • Your Vercel-hosted version will continue working normally
  • You can always redeploy later with sanity deploy if needed
  • If you have multiple studios in your project, make sure you're in the correct directory when running the command

Since you've already migrated to a monorepo on Vercel, running sanity undeploy is the clean way to remove the old hosted version and ensure clients only access your new Vercel-hosted Studio. Once undeployed, that studio name becomes publicly available again, and your local instances are not affected.

Ha! Thank you -- this is perfect

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?