
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeBased on your question about adding "controllers/routes" to your Sanity backend, I need to clarify an important architectural point about Sanity:
Sanity Studio is a frontend application, not a traditional backend server. It's a React-based content management interface that runs in the browser and communicates with Sanity's hosted Content Lake via APIs. You don't add traditional backend routes or controllers to Studio itself.
However, you have several options depending on what you're trying to accomplish:
You can create custom Studio tools that add new top-level views with their own URL routes. These are React components that appear in Studio's navigation:
// sanity.config.ts
import {defineConfig} from 'sanity'
const myCustomTool = () => ({
title: 'My Custom Tool',
name: 'my-custom-tool', // This becomes the route: /my-custom-tool
icon: DashboardIcon,
component: (props) => <YourCustomComponent />
})
export default defineConfig({
// ... other config
tools: [myCustomTool()]
})For actual server-side logic and API endpoints, I'd strongly recommend using Sanity Functions - Sanity's modern serverless compute platform:
Benefits of Sanity Functions:
You define them in a sanity.blueprint.ts file:
import {defineBlueprint} from 'sanity/blueprint'
export default defineBlueprint({
functions: [
{
name: 'my-api-endpoint',
handler: async (req, context) => {
// Your backend logic here
return new Response(JSON.stringify({data: 'hello'}), {
headers: {'Content-Type': 'application/json'}
})
}
}
]
})Functions are deployed with sanity functions deploy and become accessible at URLs like https://YOUR-PROJECT-ID.api.sanity.io/v2025-01-01/functions/my-api-endpoint.
If Sanity Functions don't meet your needs, you can create a separate Node.js/Express server and use webhooks to connect it to Sanity, but Functions are the recommended modern approach for most use cases.
What are you trying to build? The best solution depends on your specific use case:
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