How to Set Up Sanity Studio and Publish Your First Content in 2026
Sanity Studio is a React app you run locally and deploy yourself; it talks to a hosted Content Lake dataset over the API. Setup takes about 20 minutes: npm create sanity@latest, log in, pick a project name, then add your first schema and publish.
Sanity is a headless CMS, not a website builder. That distinction matters more than any feature list. You get a database with a query API and an editing UI, and you still have to build the front end. If you want a CMS that ships pages for you, this is the wrong tool.
What Is Sanity and What Does It Actually Give You?
Sanity is a content platform made of three parts: the Content Lake (hosted document database queried with GROQ), the Studio (open-source React editor you host), and the Asset Pipeline for images and files. Content lives as JSON documents. No rendered pages, no themes.
The free plan includes 10 GB of assets, 100,000 API requests per month, and two datasets. That covers a small blog or a marketing site comfortably. A content-heavy site with 50 editors will hit the request quota, and the next tier is usage-based, so budget it before you commit.
How Do I Install Sanity Studio Step by Step?
You need Node.js 20 or newer. Then run these commands in a terminal.
npm create sanity@latest— scaffoldsstudio/with a project name you type in.- Choose the dataset name (
productionis the default) and confirm the schema template (“Clean project with no predefined schemas”). - Log in through the browser window that opens. Google, GitHub, or email all work.
cd studio && npm run dev— the Studio starts onhttp://localhost:3333.
If npm create hangs on a proxy, set npm config set proxy and npm config set https-proxy first. That failure mode looks like a frozen install but is really a network block.
How Do I Define a Schema and Add Fields?
Schemas live in schemaTypes/. Create post.ts with a defineType call:
export default defineType({
name: 'post',
title: 'Post',
type: 'document',
fields: [
defineField({ name: 'title', type: 'string', validation: r => r.required() }),
defineField({ name: 'slug', type: 'slug', options: { source: 'title' } }),
defineField({ name: 'body', type: 'array', of: [{ type: 'block' }] }),
],
})
Register it in schemaTypes/index.ts, save, and the Studio hot-reloads with a “Post” item in the sidebar. The slug type auto-generates from the title when you click Generate, which saves you from writing a slugify function.
How Do I Publish Content and Query It From My Front End?
Click the pencil icon, create a Post document, fill in the title and body, then hit Publish. Drafts autosave every few seconds; Publish is what makes the document visible to the API.
Query it with GROQ over the CDN endpoint:
https://YOUR_PROJECT_ID.api.sanity.io/v2024-10-01/data/query/production?query=*[_type=="post"]{title,slug}
Add your project ID to .env as SANITY_PROJECT_ID rather than hardcoding it. If a query returns an empty array while the Studio clearly shows content, you almost certainly queried the wrong dataset name or forgot _type.
How Do I Deploy Sanity Studio for a Team?
Run npx sanity deploy. It asks for a hostname and publishes the Studio to your-name.sanity.studio. Your editors get a real URL and never touch Git.
The tradeoff is that every schema change needs a redeploy, so batch schema edits. Also remember the deployed Studio is public by default — turn on the project’s member roles before you share the link with outside writers.
Is Sanity Free, and Who Should Skip It?
Free tier: 10 GB assets, 100k API requests/month, 2 datasets, 3 users. Pricing beyond that is per-seat plus usage, and costs climb faster than a flat WordPress host once you add a dozen editors.
Skip Sanity if you want a working blog today with zero front-end work, or if your team only edits long-form pages and has no developer. Sanity earns its place when content gets reused across a website, a mobile app, and a docs site, because one document feeds all three.
Quick Summary
- Sanity Studio is a React editor you install locally and deploy with
npx sanity deploy; content sits in the hosted Content Lake. - Setup is four commands plus one schema file; you need Node.js 20+.
- The free plan gives 10 GB assets and 100,000 API requests per month.
- You must build your own front end — Sanity renders nothing for you.
- Query the CDN API endpoint, not the write endpoint, for public reads.
