Their data, not yours, revisited: what leaving Sanity actually takes

In June 2024 I wrote a short post saying I would rather choose where my data lives myself, however fancy the lake. Sanity does not let you self-host the content store, people had asked, and I read that as a business decision about who owns what. Call me old fashioned.

That post still describes the situation accurately. Nothing about the architecture has changed. What has changed is that I have now built a site on it, from an empty folder to a deployed blog with an AI assistant writing drafts into it, and I understand the other side of the trade better. So here is the honest version: what the convenience buys you, what it still costs, and what I found when I tried to walk out the door.

What you get for giving up the database

No database. Not one you install, back up, upgrade, secure or restore at two in the morning. For a client blog that alone removes most of the operational work a PHP CMS carries with it, and it removes it for the client too, who will never call about a broken update.

Nothing running in production. The site is static files on any web server. The admin is a folder of static files that Sanity will host for free. When the site's server is down, editors can still work. When the editor's laptop is off, the site still serves. Those two things are decoupled in a way a traditional CMS never manages.

The parts that are genuinely hard to build yourself: real-time collaboration in the editor, a full revision history on every document, an image pipeline that crops and resizes from URL parameters, and an API that lets a query shape exactly the fields the page needs. And, newer, a hosted connector that lets an AI tool read the schema and write drafts. I used it for every post on this blog so far.

The price of all that for a small site is zero. Twenty editors, ten thousand documents, a hundred gigabytes of images on the free plan. I have written that sentence three times this week and it still surprises me.

What it still costs

It is still their servers. If Sanity has an outage, your editors are locked out, and if the site is server-rendered rather than static, your visitors are too. If Sanity changes the pricing, the free tier, or the rules on what counts as a request, you find out by email. The company is venture funded, and the 2024 post's suspicion about incentives has not gone away; the free plan is generous because it is a funnel.

Some of the convenience is also lock-in in a nicer coat. GROQ, the query language, is open source but nothing else speaks it. Every image URL on the site points at Sanity's CDN. The studio is your code, but it is code that only makes sense against Sanity. And your content's history, the thing that makes the editor feel safe, lives only in the lake.

Data residency is the concern I would take most seriously for client work. The content sits in Sanity's regions, under Sanity's terms. For a Norwegian company with a legal department, that is a conversation, not a footnote.

The exit test

So what if I want out in two years? I did not want to guess, so this morning I ran the export on this blog's dataset. One command, done in under a second, and it produces a tar archive. Inside it: a file of documents, one JSON object per line, exactly as they are stored, including drafts if you want them; a JSON index of every asset with its metadata; and the original image and file uploads, at full resolution, named by their content hash.

That is the whole content store, on my disk, in a format I can read with any programming language. There is no proprietary binary, no partial export, no plan gate. It is the same command Sanity uses for moving between their own datasets, so it is not going to be neglected.

What the export gives you and what it does not:

StatusWhat it means when moving to Payload, Kirby or anything else
Documents and fieldsCleanPlain JSON, one object per document. A script maps your fields to the new schema.
Rich textNeeds a converterPortable Text is an open, documented JSON format. Converting to HTML, Markdown or Lexical is a known problem with existing libraries.
Images and filesCleanOriginal uploads in the archive. Re-upload them to the new system and rewrite the references.
Image crops and hotspotsPartialStored as numbers on the document. The new system has to support the same idea or you lose the crops.
SchemaYoursIt is TypeScript in your repo. Useful as documentation, not runnable elsewhere.
QueriesRewriteGROQ has no equivalent anywhere. Every query becomes REST, SQL or the new system's API.
Image URLsRewriteAnything hard-linking cdn.sanity.io breaks. A static site rebuilds them; external links to images do not.
Revision historyLostThe export is the current state. Years of document history stay in the lake.
Real-time editing, hosted studio, webhooksLostPlatform features. The replacement either has its own or it does not.
What survives an export, what needs work, and what stays behind.

For this blog, a move to Payload would be a weekend: a script that reads the export line by line, turns Portable Text into Lexical, uploads the images and posts each document to the new API. I know that because I am building the Payload twin of this site next, and the port is on the list. For a large site with a rich content model, it is weeks, but the weeks go into the destination, not into prying data out of Sanity.

What I would do differently from 2024

The 2024 post treated ownership as a question of where the database physically runs. I now think that is the wrong test, at least for small and medium sites. The better test is: can I get everything out, in an open format, whenever I want, without asking? Sanity passes that test. Plenty of self-hosted systems fail it in practice, because nobody ever wrote the export script.

The practical answer to my own post is a cron job. A nightly export of every dataset to a box I control turns the lake into a cache with a hosted editor in front of it. If Sanity vanishes, doubles its prices or has a bad week, yesterday's content is on my disk in a format I can rebuild from. That is the level of ownership I actually need, and it costs one line in a crontab.

Still old fashioned. Now with backups.

Back to all blog posts