GROQ projections let you shape Sanity query results server-side — flattening references, generating excerpts, and matching your component props exactly. Here's a worked example plus the trade-offs.
Bare Sanity queries over-fetch and force extra round-trips for references. Learn how GROQ projections and the -> dereference operator let you shape exactly the JSON your components need, server-side.
Sanity keeps drafts in the same dataset as published content. The minimal design: one query set, two clients, and the published vs. previewDrafts perspectives as the trust boundary.
GROQ paginates with an inclusive slice operator applied after filtering and ordering. Here's the query shape, a working route handler, and the offset pitfalls to check before shipping.
Stop over-fetching data from your headless CMS. Learn how to use GROQ projections to shape your API responses and implement stable pagination for your content feeds.
Stop over-fetching data from Sanity. Learn to use GROQ projections to transform content on the server, reducing payload size and improving app performance.
Stop fighting HTML strings in your CMS. Learn how Sanity's Portable Text uses JSON to decouple content structure from presentation for multi-platform delivery.
Portable Text lets you store rich text in a structured, platform‑agnostic way. This guide walks through schema setup, GROQ querying, and rendering with a React serializer, plus trade‑offs and a practical checklist to get you started.