The Content Operating System
Build content-powered applications faster
Developer-first and endlessly flexible, Sanity gives you a fully customizable content backend and a React-powered editing workspace tailored to your needs. Model your content like a database schema, collaborate in real-time, and set up visual editing for your live site.
By integrating Sanity with Vercel, you can deploy a managed content backend in seconds. Sanity also integrates with your AI development tools through our Agent Toolkit – including an MCP server, agent rules, and agent skills.
Start on our generous Free plan with unlimited content types, up to 20 user seats, and high API quotas. Our paid plan supports pay-as-you-go for higher usage.
Start by connecting to an existing Next.js project on Vercel. If you don't have one yet, create a new Next.js project by running:
npx create-next-app@latest my-app --yescd my-appvercel linkSee Automatic Installation in the Next.js documentation for more details. This guide uses App Router, so select that option if creating a new project. The vercel link command uses the Vercel CLI.
Pull your Sanity environment variables down to your local environment using the Vercel CLI:
vercel link # If you didn't link to Vercel in the previous stepvercel env pull .env.localIf you created a new Sanity account through the Vercel integration, you'll need to connect an additional sign-in method. The Sanity CLI and Studio require Google or GitHub as an authentication provider.
Click Open in Sanity at the top of this page, then click your avatar in the top-right corner and go to Account settings. From there, connect either your Google or GitHub account.
If you already had a Sanity account before installing the integration, you can skip this step.
Run this command in your Next.js project folder:
npm create sanity@latest -- --dataset production --typescript --template cleanYou'll be prompted to log in to your Sanity account. Once logged in, select the Sanity project you connected to your Vercel project. When prompted:
.env.local?" – select No (you already pulled these from Vercel)This installs next-sanity, configures your client, and adds Sanity Studio at /studio.
Create a document type in the schemaTypes folder created by the CLI:
// ./sanity/schemaTypes/postType.tsimport { defineField, defineType } from 'sanity'
export const postType = defineType({ name: 'post', title: 'Post', type: 'document', fields: [ defineField({ name: 'title', type: 'string' }), defineField({ name: 'body', type: 'array', of: [{ type: 'block' }] }), ],})Register postType in the schema index:
// ./sanity/schemaTypes/index.tsimport { type SchemaTypeDefinition } from 'sanity'import { postType } from './postType'
export const schema: { types: SchemaTypeDefinition[] } = { types: [postType],}npm run devVisit http://localhost:3000/studio to access your embedded Sanity Studio. Click + to create and publish your first Post.
Update your homepage to fetch and display your content:
// src/app/page.tsximport { client } from "@/sanity/lib/client";
type Post = { _id: string; title: string;};
export default async function Home() { const posts = await client.fetch<Post[]>(`*[_type == "post"]{ _id, title }`); return ( <ul> {posts.map((post) => ( <li key={post._id}>{post.title}</li> ))} </ul> );}Visit http://localhost:3000 to see your content.
Start by connecting to an existing Astro project on Vercel. If you don't have one yet, create a new project by running:
npm create astro@latest my-app -- --template basics --install --gitcd my-appvercel linkSee Install Astro with the Automatic CLI in the Astro documentation for more details. The vercel link command uses the Vercel CLI.
Pull your Sanity environment variables down to your local environment using the Vercel CLI:
vercel link # If you didn't link to Vercel in the previous stepvercel env pull .env.localIf you created a new Sanity account through the Vercel integration, you'll need to connect an additional sign-in method. The Sanity CLI and Studio require Google or GitHub as an authentication provider.
Click Open in Sanity at the top of this page, then click your avatar in the top-right corner and go to Account settings. From there, connect either your Google or GitHub account.
If you already had a Sanity account before installing the integration, you can skip this step.
Install the Sanity and React integrations (React is required for the embedded Studio):
npx astro add @sanity/astro @astrojs/reactUpdate your Astro config file:
// astro.config.mjsimport { defineConfig } from "astro/config";import { loadEnv } from "vite";
import sanity from "@sanity/astro";import react from "@astrojs/react";
// Load environment variablesconst { PUBLIC_SANITY_PROJECT_ID, PUBLIC_SANITY_DATASET } = loadEnv(process.env.NODE_ENV, process.cwd(), "");
export default defineConfig({ integrations: [ sanity({ projectId: PUBLIC_SANITY_PROJECT_ID, dataset: PUBLIC_SANITY_DATASET, useCdn: false, studioBasePath: "/studio", // Required for an embedded Sanity Studio }), react(), ],});Create sanity.config.ts at your project root:
// sanity.config.tsimport { defineConfig } from "sanity";import { structureTool } from "sanity/structure";import { schemaTypes } from "./schemaTypes/index";
export default defineConfig({ projectId: import.meta.env.PUBLIC_SANITY_PROJECT_ID, dataset: import.meta.env.PUBLIC_SANITY_DATASET, plugins: [structureTool()], schema: { types: schemaTypes },});Add TypeScript support in tsconfig.json:
{ "compilerOptions": { "types": ["@sanity/astro/module"] }}Create a schemaTypes folder at your project root and add these two files:
// schemaTypes/postType.tsimport { defineField, defineType } from "sanity";
export const postType = defineType({ name: "post", title: "Post", type: "document", fields: [ defineField({ name: "title", type: "string" }), defineField({ name: "body", type: "array", of: [{ type: "block" }] }), ],});// schemaTypes/index.tsimport { postType } from "./postType";
export const schemaTypes = [postType];npm run devVisit http://localhost:4321/studio to access your embedded Sanity Studio. You may be asked to “Connect your studio to your project”. You’ll need to Add development host, and follow the prompt to Sanity Manage where you’ll add http://localhost:4321 as a CORS origin. Check the box to Allow credentials.
Once you open your Sanity Studio, Click + to create and publish your first Post.
Update your homepage to fetch and display your content:
// src/pages/index.astro---import type { SanityDocument } from "@sanity/client";import { sanityClient } from "sanity:client";import Layout from "../layouts/Layout.astro";
const posts = await sanityClient.fetch<SanityDocument[]>( `*[_type == "post"]{ _id, title }`,);---
<Layout> <h1>Posts</h1> <ul> {posts.map((post) => <li>{post.title}</li>)} </ul></Layout>Visit http://localhost:4321 to see your content.
Start by connecting to an existing SvelteKit project on Vercel. If you don't have one yet, create a new project by running:
npx sv create --template minimal --types ts --install npm my-appcd my-appSee Creating a project in the SvelteKit documentation for more details.
Pull your Sanity environment variables down to your local environment using the Vercel CLI:
vercel link # If you didn't link to Vercel in the previous stepvercel env pull .env.localIf you created a new Sanity account through the Vercel integration, you'll need to connect an additional sign-in method. The Sanity CLI and Studio require Google or GitHub as an authentication provider.
Click Open in Sanity at the top of this page, then click your avatar in the top-right corner and go to Account settings. From there, connect either your Google or GitHub account.
If you already had a Sanity account before installing the integration, you can skip this step.
npm i @sanity/sveltekit sanity -DCreate your Sanity config file in a new sanity folder:
// src/lib/sanity/sanity.config.tsimport { defineConfig } from "sanity";import { structureTool } from "sanity/structure";import { PUBLIC_SANITY_PROJECT_ID as projectId, PUBLIC_SANITY_DATASET as dataset,} from "$env/static/public";import { schemaTypes } from "./schemaTypes";
export default defineConfig({ basePath: "/studio", // `basePath` must match the route of your Studio projectId, dataset, plugins: [structureTool()], schema: { types: schemaTypes },});Add Sanity Studio to the /studio route:
// src/routes/studio/[...catchall]/+page.svelte<script lang="ts"> import config from "$lib/sanity/sanity.config"; import { SanityStudio } from "@sanity/sveltekit";</script>
<SanityStudio {config} />Create a schemaTypes folder in your sanity folder and add these two files:
// src/lib/sanity/schemaTypes/postType.tsimport { defineField, defineType } from "sanity";
export const postType = defineType({ name: "post", title: "Post", type: "document", fields: [ defineField({ name: "title", type: "string" }), defineField({ name: "body", type: "array", of: [{ type: "block" }] }), ],});// src/lib/sanity/schemaTypes/index.tsimport { postType } from "./postType";
export const schemaTypes = [postType];npm run devVisit http://localhost:5173/studio to access your embedded Sanity Studio. You may be asked to “Connect your studio to your project”. You’ll need to Add development host, and follow the prompt to Sanity Manage where you’ll add http://localhost:5173 as a CORS origin. Check the box to Allow credentials.
Once you open your Sanity Studio, Click + to create and publish your first Post.
Create a Sanity client:
// sveltekit-app/src/lib/sanity.tsimport { createClient } from "@sanity/client";import { PUBLIC_SANITY_PROJECT_ID, PUBLIC_SANITY_DATASET,} from "$env/static/public";
export const client = createClient({ projectId: PUBLIC_SANITY_PROJECT_ID, dataset: PUBLIC_SANITY_DATASET, apiVersion: "2026-01-01", useCdn: true, // token: process.env.SANITY_API_TOKEN, // Required if your dataset is private. Set token at https://www.sanity.io/manage});Create a server route to fetch and then display your content in a client route:
// src/routes/+page.server.tsimport type { PageServerLoad } from "./$types";import { client } from "$lib/sanity/client";
export const load: PageServerLoad = async () => { const posts = await client.fetch(`*[_type == "post"]{ _id, title }`); return { posts };};
<!-- src/routes/+page.svelte --><script lang="ts"> import type { PageProps } from "./$types";
let { data }: PageProps = $props();</script>
<h1>Posts:</h1><ul> {#each data.posts as post} <li>{post.title}</li> {/each}</ul>Visit http://localhost:5173 to see your content.
Start by connecting to an existing Nuxt project on Vercel. If you don't have one yet, create a new project by running:
npm create nuxt@latest my-app -- --modules sanity --template minimalcd my-appvercel linkSee Installation in the Nuxt documentation for more details. The vercel link command uses the Vercel CLI.
If you created a new Sanity account through the Vercel integration, you'll need to connect an additional sign-in method. The Sanity CLI and Studio require Google or GitHub as an authentication provider.
Click Open in Sanity at the top of this page, then click your avatar in the top-right corner and go to Account settings. From there, connect either your Google or GitHub account.
If you already had a Sanity account before installing the integration, you can skip this step.
Create a Sanity Studio in a separate folder alongside your Nuxt app:
cd../npm create sanity@latest -- --output-path studio --template clean --typescript --dataset productionYou will be prompted to log in to your Sanity account. Once logged in, select the Sanity project you connected to your Vercel project.
Your folder structure should now look like:
├── my-app/ # Nuxt app└── studio/ # Sanity StudioIn your studio folder, create a document type:
// studio/schemaTypes/postType.tsimport { defineField, defineType } from "sanity";
export const postType = defineType({ name: "post", title: "Post", type: "document", fields: [ defineField({ name: "title", type: "string" }), defineField({ name: "body", type: "array", of: [{ type: "block" }] }), ],});Register it in the schema index:
// studio/schemaTypes/index.tsimport { postType } from "./postType";
export const schemaTypes = [postType];From the studio folder, start the Studio:
npm run devVisit http://localhost:3333 to access Sanity Studio. Click + to create and publish your first Post
Inside your Nuxt project (the my-app folder), pull your Sanity environment variables down to your local environment using the Vercel CLI:
cd ../my-appvercel link # If you didn't link to Vercel in the previous stepvercel env pull .envUpdate your Nuxt config:
// nuxt.config.tsexport default defineNuxtConfig({ compatibilityDate: "2026-01-26", devtools: { enabled: true }, modules: ["@nuxtjs/sanity"], sanity: { projectId: process.env.NUXT_PUBLIC_SANITY_PROJECT_ID, dataset: process.env.NUXT_PUBLIC_SANITY_DATASET, apiVersion: "2026-01-01", }, vite: { optimizeDeps: { include: ["react-compiler-runtime", "react", "react-dom"], }, },});# in my-app/npm run devUpdate your homepage to fetch and display your content:
<!-- app/pages/index.vue --><script setup lang="ts">interface Post { _id: string; title: string;}
const query = groq`*[_type == "post"]{ _id, title }`;const { data: posts } = await useSanityQuery<Post[]>(query);</script>
<template> <div> <h1>Posts</h1> <ul> <li v-for="post in posts" :key="post._id"> {{ post.title }} </li> </ul> </div></template>Enable your app to use page routes:
<!-- app/app.vue --><template> <div> <NuxtRouteAnnouncer /> <NuxtPage /> <!-- Add this --> </div></template>Visit http://localhost:3000 to see your content.
Deploy your Sanity Studio by running the following from the studio folder:
# in studio/npx sanity deployChoose a hostname (e.g., my-project) and your Studio will be available at https://my-project.sanity.studio.
Start by connecting to an existing React Router project on Vercel. If you don't have one yet, create a new project by running:
npx create-react-router@latest my-app -ycd my-appvercel linkSee Automatic Installation in the React Router documentation for more details. The vercel link command uses the Vercel CLI.
If you created a new Sanity account through the Vercel integration, you'll need to connect an additional sign-in method. The Sanity CLI and Studio require Google or GitHub as an authentication provider.
Click Open in Sanity at the top of this page, then click your avatar in the top-right corner and go to Account settings. From there, connect either your Google or GitHub account.
If you already had a Sanity account before installing the integration, you can skip this step.
Create a Sanity Studio in a separate folder alongside your React Router app:
cd ../npm create sanity@latest -- --output-path studio --template clean --typescript --dataset productionYou will be prompted to log in to your Sanity account. Once logged in, select the Sanity project you connected to your Vercel project.
Your folder structure should now look like:
├── my-app/ # React Router app└── studio/ # Sanity StudioIn your Studio folder, create a document type:
// studio/schemaTypes/postType.tsimport { defineField, defineType } from "sanity";
export const postType = defineType({ name: "post", title: "Post", type: "document", fields: [ defineField({ name: "title", type: "string" }), defineField({ name: "body", type: "array", of: [{ type: "block" }] }), ],});Register it in the schema index:
// studio/schemaTypes/index.tsimport { postType } from "./postType";
export const schemaTypes = [postType];Start the Studio:
# in studio/npm run devVisit http://localhost:3333 to access Sanity Studio. Click + to create and publish your first Post.
Inside your React Router app folder, pull your Sanity environment variables down to your local environment using the Vercel CLI:
cd ../my-appvercel link # If you didn't link to Vercel in the previous stepvercel env pull .envNavigate to your React Router app and install the Sanity client:
# in my-app/npm install @sanity/clientCreate a client configuration file:
// app/sanity/client.tsimport { createClient } from "@sanity/client";
export const client = createClient({ projectId: process.env.SANITY_PROJECT_ID, dataset: process.env.SANITY_DATASET, apiVersion: "2026-01-01", useCdn: true,});# in my-app/npm run devUpdate your home route to fetch and display your content:
// app/routes/home.tsximport type { SanityDocument } from "@sanity/client";import { client } from "~/sanity/client";import type { Route } from "./+types/home";
const POSTS_QUERY = `*[_type == "post"]{ _id, title }`;
export async function loader() { const posts = await client.fetch<SanityDocument[]>(POSTS_QUERY); return { posts };}
export default function Home({ loaderData }: Route.ComponentProps) { const { posts } = loaderData;
return ( <main> <h1>Posts</h1> <ul> {posts.map((post) => ( <li key={post._id}>{post.title}</li> ))} </ul> </main> );}
Visit http://localhost:5173 to see your content.
Deploy your Sanity Studio by running:
# in studio/npx sanity deployChoose a hostname (e.g., my-project) and your Studio will be available at https://my-project.sanity.studio.
To get started with the integration, you can either create a new Sanity account or connect an existing one:
Both options provision the same environment variables for your Vercel project.
Starter Templates
View all templates