Skip to content
@sanity-io

Sanity

A fully customizable all-code backend for content-driven websites and apps. Get started for free.
Sanity

Sanity - Content Operating System

npm npm downloads Discord MIT License


Sanity is a Content Operating System that turns content into structured, reusable data. We give developers complete control over how content is modeled, managed, and delivered.

Quick Links

🚀 Get started • 📚 Documentation • 💬 Community • 🎓 Learn • 📦 Exchange

Why Developers Choose Sanity

  • Content Lake: Real-time database for structured content - query with GROQ, access via HTTP APIs from any language
  • Schema-as-code: Define content models in TypeScript/JavaScript, version control them, get automatic type generation
  • Real-time: Live queries, collaborative editing, instant previews built-in
  • Customizable: React-based Studio you can customize completely, plus App SDK for organization-wide applications
  • Framework agnostic: Works with Next.js, Remix, Astro, or any framework
  • AI-ready: Structured content with rich context that AI can use effectively
See code examples

Schema-as-code

// schemaTypes/articleType.ts
import { defineType, defineField } from "sanity";

export const articleType = defineType({
  name: "article",
  type: "document",
  fields: [
    defineField({
      name: "title",
      type: "string",
      validation: (Rule) => [
        Rule.required(),
        Rule.max(80).warning(
          "Titles over 80 characters may be truncated in search results"
        ),
      ],
    }),
    defineField({
      name: "excerpt",
      type: "text",
      validation: (Rule) =>
        Rule.custom((value, context) => {
          // Cross-field validation
          const isFeatured = context.document?.featured;
          return isFeatured && !value
            ? "Featured articles need an excerpt"
            : true;
        }),
    }),
  ],
});

GROQ query language

import { defineQuery } from "groq";

export const ARTICLES_QUERY = defineQuery(`*[_type == "article"] {
  _id,
  title,
  "author": author->name,
  "categories": categories[]->title,
  "wordCount": length(pt::text(body))
}[0...10]`);

GraphQL is also available if you prefer it.

Getting Started

npm create sanity@latest

This creates a Sanity project with Studio and connects you to the Content Lake. You'll get:

  • A customizable content management interface
  • Real-time APIs for your content
  • Automatic TypeScript types
  • Generous free tier with hosting and bandwidth included (no credit card required)

Pricing: Start free, pay-as-you-go for overages. View pricing →

Trusted By

Sanity powers content operations for teams at Figma, Spotify, Shopify, Riot Games, Linear, Cloudflare, Netlify, Replit, PUMA, Nike, Supreme, Condé Nast, AT&T, Samsung, and thousands more.

Community & Resources

Key Repositories

Contributing

We welcome contributions to our open source projects. Check each repository's CONTRIBUTING.md for guidelines, or report bugs in the relevant issue tracker.


Built by developers, for developers. We treat content as a strategic asset and give technical teams the tools to work without constraints.

Pinned Loading

  1. sanity sanity Public

    Sanity Studio – Rapidly configure content workspaces powered by structured content

    TypeScript 5.9k 498

  2. GROQ GROQ Public

    Specification for GROQ - The Query Language for JSON

    JavaScript 429 16

  3. next-sanity next-sanity Public

    Sanity toolkit for Next.js

    TypeScript 904 104

  4. litter litter Public

    Litter is a pretty printer library for Go data structures to aid in debugging and testing.

    Go 1.6k 59

  5. groq-js groq-js Public

    JavaScript implementation of GROQ, the query language for JSON

    TypeScript 327 25

  6. mendoza mendoza Public

    Differ for structured documents (JSON)

    Go 274 5

Repositories

Showing 10 of 355 repositories
  • locales Public

    A repository of user-contributed locale/language packs for Sanity Studio

    sanity-io/locales’s past year of commit activity
    TypeScript 33 MIT 16 6 36 Updated Dec 9, 2025
  • sanity Public

    Sanity Studio – Rapidly configure content workspaces powered by structured content

    sanity-io/sanity’s past year of commit activity
    TypeScript 5,900 MIT 498 346 142 Updated Dec 9, 2025
  • sanity-plugin-internationalized-array Public

    A plugin to register array fields with a custom input component to store field values in multiple languages, queryable by using the language ID as an array `_key`.

    sanity-io/sanity-plugin-internationalized-array’s past year of commit activity
    TypeScript 57 MIT 16 23 2 Updated Dec 9, 2025
  • groq-js Public

    JavaScript implementation of GROQ, the query language for JSON

    sanity-io/groq-js’s past year of commit activity
    TypeScript 327 MIT 25 22 12 Updated Dec 9, 2025
  • sanity-plugin-mux-input Public

    An input component that integrates Sanity Studio with MUX.com video encoding/hosting service.

    sanity-io/sanity-plugin-mux-input’s past year of commit activity
    TypeScript 74 MIT 72 12 8 Updated Dec 9, 2025
  • visual-editor-react-native Public

    An example repository on how to use Sanity's Visual Editing/Presentation tooling with React Native (built on expo)

    sanity-io/visual-editor-react-native’s past year of commit activity
    TypeScript 4 1 0 2 Updated Dec 9, 2025
  • use-effect-event Public

    Ponyfill of the experimental `React.useEffectEvent` hook

    sanity-io/use-effect-event’s past year of commit activity
    TypeScript 25 MIT 2 1 3 Updated Dec 9, 2025
  • sanity-io/ui-workshop-plugin-sanity’s past year of commit activity
    TypeScript 6 MIT 0 1 7 Updated Dec 9, 2025
  • ui-workshop Public

    An environment for designing, reviewing, and quality-testing React components.

    sanity-io/ui-workshop’s past year of commit activity
    TypeScript 12 MIT 2 1 8 Updated Dec 9, 2025
  • ui Public

    UI building blocks for Sanity.

    sanity-io/ui’s past year of commit activity
    TypeScript 155 MIT 21 14 17 Updated Dec 9, 2025