Menu

1 / 5

Sanity staging and production on one dataset: how to split it safely

DEV Community: nextjs·Nayan Kyada·14 days ago
#HVxrbqsI
#devtonextjs#devto#dev#production#staging
Reading 0:00
15s threshold

If your Sanity staging and production environments read from the same dataset, you are one bad script or one half-finished edit away from a public mistake. I see this setup on inherited projects constantly: a Vercel preview URL that looks like staging but is wired to the live dataset. This post covers the symptoms, what it costs to ignore, and the safe path to a proper split.

Symptoms that you share one dataset

You probably have this problem if any of these sound familiar:

Editors are afraid to create a draft because "it might show up on the site".

The developer tests a schema change by editing live documents.

The staging site and the production site show identical content, always.

There is one .env file, or the preview and production environment variables in Vercel have the same dataset value.

Nobody can say which documents are test data. Titles like "test 2" or "DELETE ME" are live.

Check it in two minutes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.