Cloning a Sanity project and migrating data explained

5 replies
Last updated: Apr 19, 2020
is there a way to clone a sanity project? basically, i want the same CMS content but a new project ID …
AI Update

Yes! There are a few ways to clone a Sanity project with the same content but a different project ID. Here's what you can do:

The Standard Approach: Export and Import

The most common method is to use the Sanity CLI's export and import commands:

  1. Export your current dataset:
sanity dataset export production

This creates a production.tar.gz file containing all your documents and assets.

  1. Create a new Sanity project (which will have a new project ID):
sanity init
  1. Import the data into your new project:
sanity dataset import production.tar.gz production

This approach gives you complete control and works across all plan types. You can also export to a specific filename or location if needed.

Using the Cross Dataset Duplicator Plugin

The Cross Dataset Duplicator plugin lets you migrate documents and assets between projects directly from within Sanity Studio. This is especially helpful if you want to selectively copy content rather than everything at once. Install it with:

npm i @sanity/cross-dataset-duplicator

For Enterprise: Cloud Clone

If you're on an Enterprise plan, you have access to Cloud Clone, which duplicates datasets directly in the cloud without needing to download and re-upload data locally. This is faster and more efficient for large datasets.

Important Notes

  • The export/import process includes all documents and assets, but not your schema definition (that lives in your Studio code)
  • You'll need to deploy your schema to the new project separately
  • Access control settings and API tokens won't carry over—you'll need to reconfigure those in the new project
  • The import will merge with existing content, so make sure you're importing into a clean dataset if you want an exact copy

The export/import method is the most straightforward approach and works great for most use cases where you need a complete clone with a new project ID.

You would have to migrate, but that's not too hard:
That would give you exactly the same content in another project. You also then have to clone the studio code. The backend doesn't know about the studio
You can start a new blank project with npm. Then you have zero data and a blank schema. Then import what you exported. And copy the schema.
thx! 🙇‍♂️

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?