
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI can see you're trying to embed Sanity Studio directly into an Astro page using renderStudio, but there are a few important things you should know about this approach.
The renderStudio function you're using from esm.sh is part of an older, deprecated approach to embedding Studio. While it technically exists in the Sanity codebase, it's not officially supported or documented for modern implementations, especially not for framework integrations like Astro. Loading Sanity Studio via CDN imports like this creates several problems:
According to the Astro quickstart documentation, the official and recommended pattern is to deploy your Studio separately from your Astro application. Here's how:
If you haven't already, create a Sanity Studio project:
npm create sanity@latest -- --dataset production --template clean --typescript --output-path studioYour sanity.config.ts (in the Studio directory) should look like:
import { defineConfig } from 'sanity'
import { deskTool } from 'sanity/desk'
export default defineConfig({
name: 'project-name',
projectId: 'your-project-id',
dataset: 'production',
plugins: [deskTool()],
schema: {
types: [
// your schema types here
]
}
})Deploy the Studio to get a hosted URL:
cd studio
npm run deployThis gives you a yourproject.sanity.studio URL where your editors can manage content. This is covered in the deployment documentation.
In your Astro project, install the Sanity integration to query content (not embed Studio):
npx astro add @sanity/astro -yConfigure it in astro.config.mjs:
import sanity from "@sanity/astro";
export default defineConfig({
integrations: [
sanity({
projectId: "your-project-id",
dataset: "production",
useCdn: false,
}),
],
});Now your Astro site can query content from Sanity, while editors use the separate Studio URL.
If you don't want to use sanity.studio hosting, you can deploy your Studio folder to any hosting provider (Vercel, Netlify, etc.) as a separate application. The Studio is just a React app that can be built and deployed independently.
While the quickstart documentation mentions that Studio can be embedded as a React component at a route, this approach has significant limitations in Astro:
The separate deployment approach is simpler, more reliable, and what most production Astro + Sanity sites use. Your Astro site focuses on displaying content, while Studio remains a dedicated content management interface.
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.
Content backend


The only platform powering content operations


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store