Sanity is a headless CMS that treats your content as structured data instead of pages. You define what a blog post or a product looks like, your editors fill it in, and your website fetches it through an API.
How does it work? You describe your content types in code — a post has a title, a slug, a body, and an author. Sanity gives your team a clean editing studio based on that schema, and stores everything as JSON. Your frontend queries it with GROQ, Sanity's query language.
// A Sanity schema for a blog post
export default {
name: 'post',
title: 'Post',
type: 'document',
fields: [
{ name: 'title', title: 'Title', type: 'string' },
{ name: 'slug', title: 'Slug', type: 'slug', options: { source: 'title' } },
{ name: 'body', title: 'Body', type: 'array', of: [{ type: 'block' }] },
],
}
// Fetch the latest posts with GROQ
const posts = await client.fetch(
`*[_type == "post"] | order(_createdAt desc) { title, slug, _createdAt }`
);
Sanity is great for beginners because the free tier is generous and the studio is genuinely pleasant to use. Content editors get a proper interface with live preview, while developers get clean JSON instead of HTML soup. Real-time collaboration is built in — two editors can work on the same document at once.
When should you use it? For a blog, a documentation site, a marketing site, or any project where non-developers need to edit content without touching code. If your content is structured and reused in several places — a website and an app, for example — Sanity shines.
The limits are worth knowing. It is a hosted service, so your content lives on Sanity's cloud, and the query language GROQ is new to learn. For a tiny personal blog, a simpler setup like Markdown files might be enough. Sanity pays off when a team edits content regularly.
Start today: create a free Sanity project, define one content type with three fields, and fetch it from a small script. Seeing your own text come back as JSON is the moment the headless idea makes sense.
Top comments (0)