What is the Architecture of Sanity and its Data Model?
Welcome to Sanity! 🎉 So glad you're loving it! Let me break down the architecture and data model for you.
Platform Architecture
Sanity is built as a "Content Operating System" with three main pillars:
- Content Lake - Your unified, real-time content database
- Live CDN - Global content delivery network
- Compute + AI - Serverless functions, webhooks, and AI capabilities
The Content Lake (Your Data Foundation)
The Content Lake is Sanity's content-optimized database that stores everything as structured JSON documents. Think of it as a specialized database designed specifically for content operations with built-in features like:
- Real-time capabilities - Multiple editors can work simultaneously
- Revision history - Track every change to your content
- Referential integrity - Maintain relationships between content
- Atomic mutations - Ensure data consistency
- Global distribution - Fast access worldwide via CDN
Document Structure
Every piece of content in Sanity is a document with a specific structure. Documents have system fields that Sanity manages automatically:
_id- Unique identifier for the document_type- The schema type (like "post", "author", "product")_rev- Revision identifier_createdAt- Creation timestamp_updatedAt- Last update timestamp
Datasets and Drafts
Content is organized into datasets (think of them as separate content repositories within your project). Sanity has a built-in drafts system - when you edit a published document, it creates a draft version with the ID pattern drafts.{documentId}, keeping your published content safe until you're ready to publish changes.
Querying with GROQ
You query your content using GROQ (Graph-Relational Object Queries), Sanity's powerful query language. It lets you fetch exactly the content you need with relationships and transformations. GraphQL is also supported if you prefer that approach.
Sanity Studio
The editing interface is Sanity Studio - a headless, customizable TypeScript/React CMS that connects to your Content Lake. You define your content model using schemas, and Studio automatically generates the editing interface.
Modern Features
Recent additions to the platform include:
- Sanity Functions - Serverless compute for event handlers
- Agent Actions - Built-in AI that can read/write content
- Content Releases - Stack changes and publish atomically
- Live Content API - Real-time content delivery without websockets
The beauty of this architecture is that your content lives in the Content Lake as structured data, while you can use Studio (or build custom apps with the App SDK) to edit it, and query it from any frontend framework you choose. It's truly composable!
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.