Sanity

AI editing for your Sanity site.

Avocado Studio puts an AI editor and a click-to-edit live preview on top of a site whose content lives in Sanity. Sanity stays your content store: Avocado reads from it, drafts on its own working copy, and publishes back only the fields that changed.

Content store
Sanity — a template and a working example are included
Rich text
Portable Text, read and written back
Publishing
Field-level patches, list items addressed by _key
Images
The editor’s image picker searches your Sanity assets
Framework
Next.js 15 or 16, App Router
Licence
Apache-2.0, free to self-host

Sanity stays the source of truth

Publish a diff, not a snapshot

import { diffPage, groupPatches } from "@avocadostudio-ai/site-sdk/publish"

// …diff the edited page against what Sanity held when you read it…
for (const { documentId, set } of groupPatches(diff.patches)) {
  await client.patch(documentId).set(set).commit()
}

Portable Text survives the round trip

Your Sanity media library in the editor

import { cmsMediaSource, type CmsAdapter } from "@avocadostudio-ai/site-sdk/server"

export function sanityAdapter(): CmsAdapter {
  return {
    id: "sanity",
    getPages: (options) => getSanityPages(options?.perspective),
    getMedia: cmsMediaSource({
      provider: "sanity",
      projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!,
      dataset: process.env.NEXT_PUBLIC_SANITY_DATASET,
      token: process.env.SANITY_API_TOKEN,
    }),
  }
}

FAQ

Sanity: common questions

Does Avocado Studio replace Sanity or Sanity Studio?

No. Sanity remains your CMS and your schema stays as it is. Avocado Studio reads your documents and writes changes back as patches; it adds an AI and visual editing layer on the website, not a new content store.

Is Avocado Studio made by Sanity?

No. Avocado Studio is an independent open-source project, licensed Apache-2.0, that works with Sanity through its API.

Will AI edits overwrite my Portable Text?

No. Publishing sends only changed fields, unchanged Portable Text blocks are written back exactly as stored, and custom block types pass through untouched.

Can editors change content without touching Sanity Studio?

Yes. They describe the change in chat or click the block on the page, review it in the live preview of the real site, and publish; the change lands in Sanity as a patch.

Which AI models does it use with Sanity?

Whichever you bring: an Anthropic, OpenAI or Google Gemini API key. Avocado runs on your key and never resells tokens.

Try it on a real site in one command.

Scaffold the demo site with the editor, or run it inside an existing Next.js project to wire Avocado Studio in. Open source under Apache-2.0; bring your own Anthropic, OpenAI or Gemini key.

npm create avocado-site@latest