
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, there's a well-defined method for embedding Sanity Studio on a subroute like /admin in your React application! Here's how to do it:
Sanity Studio is distributed as a single npm package that you can embed in any React application. The key steps are:
npm install sanity@latestIn your Studio configuration, set the basePath to match your desired route:
// StudioRoute.tsx
import { defineConfig, Studio } from "sanity";
const config = defineConfig({
projectId: "your_project_id",
dataset: "your_dataset",
basePath: "/admin" // This is the key setting!
});
export default function StudioRoute() {
return <Studio config={config} />
}This is crucial - you need to ensure all sub-routes under /admin redirect to the page where Studio is mounted. Most modern frameworks support this:
[[...index]].tsx or catch-all routes in App Router/admin/*The Studio needs to take full viewport dimensions. Add this CSS to the container:
#app {
height: 100vh;
max-height: 100dvh;
overscroll-behavior: none;
-webkit-font-smoothing: antialiased;
overflow: auto;
}Don't forget: Add your domain to your project's CORS origins settings with authenticated requests enabled.
If you're using Next.js, the next-sanity library makes this even easier and includes additional features like live preview. It's the recommended approach for Next.js projects.
The basePath configuration is exactly what you need to avoid separate hosting at admin.* - it allows Studio to live happily alongside your main application on the same domain!
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 operations
Content backend


The only platform powering content operations
By Industry


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