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.
| Model | Source |
|---|---|
| sonnet | pack: cms |
Full Reference
┏━ 🔧 sanity ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when working with Sanity CMS — content mod… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Sanity CMS
Section titled “Sanity CMS”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.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Install | npm create sanity@latest |
| Next.js toolkit | npm install next-sanity |
| Astro integration | npx astro add @sanity/astro @astrojs/react |
| Studio URL | /studio (Next.js), /admin (Astro) |
| API version | 2025-05-16 |
| Studio version | v4 (v3 still supported) |
| TypeGen | npx sanity typegen generate |
| Key env vars | NEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, SANITY_API_TOKEN |
| Docs | https://www.sanity.io/docs |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Set up the project, configure the client, and integrate with Next.js or Astro | reference/setup.md |
| Define document types, object types, and Portable Text schemas | reference/schemas.md |
| Write GROQ filters, projections, joins, and parameterized queries | reference/groq-queries.md |
| Fetch content, run mutations, use transactions, or subscribe to live updates | reference/client.md |
| Handle images — URL builder, transformations, next/image | reference/image-handling.md |
| Customize Studio structure, add plugins, and build custom input components | reference/studio.md |
| Configure webhooks, enable draft mode, set up live preview, or check pricing | reference/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.