Skip to content

sanity

Use when working with Sanity CMS — content modeling, GROQ queries, Sanity Studio customization, or real-time content. Also use when choosing a headless CMS or integrating Sanity with Next.js or Astro.

ModelSource
sonnetpack: cms
Full Reference

┏━ 🔧 sanity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when working with Sanity CMS — content mod… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Sanity (Studio v3/v4, API version 2025-05-16) is a headless CMS with a structured content model, GROQ query language, and a fully customizable React-based Studio. Content lives in the hosted Content Lake. React 19.2 required as of December 2025.

ItemValue
Installnpm create sanity@latest
Next.js toolkitnpm install next-sanity
Astro integrationnpx astro add @sanity/astro @astrojs/react
Studio URL/studio (Next.js), /admin (Astro)
API version2025-05-16
Studio versionv4 (v3 still supported)
TypeGennpx sanity typegen generate
Key env varsNEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, SANITY_API_TOKEN
Docshttps://www.sanity.io/docs
I want to…File
Set up the project, configure the client, and integrate with Next.js or Astroreference/setup.md
Define document types, object types, and Portable Text schemasreference/schemas.md
Write GROQ filters, projections, joins, and parameterized queriesreference/groq-queries.md
Fetch content, run mutations, use transactions, or subscribe to live updatesreference/client.md
Handle images — URL builder, transformations, next/imagereference/image-handling.md
Customize Studio structure, add plugins, and build custom input componentsreference/studio.md
Configure webhooks, enable draft mode, set up live preview, or check pricingreference/webhooks.md

Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.