Migrate a studio or SDK app to Dashboard 2.0
Move an existing Sanity-hosted studio or SDK app to Dashboard 2.0: switch to defineApplication, deploy it as a new application, and undeploy the old one.
Where your app or studio renders now
Your App SDK app rendered into a single full-page surface. In Dashboard 2.0 that surface is called the window view, and it is still the default. If you set entry in defineApplication, the CLI creates the window view for you and your app renders exactly where it used to.
What changes is that defineApplication is now a container rather than a single app surface. One application has one job, but it can render parts of that job on several surfaces: a window view, one or more panel views in the column beside the dock, a tile view on the home page, and web workers running in the background. You opt into the extra surfaces only when you need them.
A studio moves the same way, with one difference: it gets its window automatically, so it never sets entry. A Sanity-hosted studio that people open at your-studio.sanity.studio today opens inside the Dashboard once you migrate it. To serve the build from your own domain instead, see External hosted Studios. Panel and tile views declared by a studio aren't supported yet: the CLI reports App views for studios are not implemented yet.
Prerequisites
- A studio or SDK app with a
sanity.cli.tsfile. - Your organization ID. An SDK app's
sanity.cli.tsalready has it asapp.organizationId. For a studio, copy it from your organization's settings in Manage. - SDK apps: React 19.2 or later.
- Studios: a recent
sanityrelease, withsanityas a dependency in the studio project.
Upgrade to SDK v3 (SDK apps)
Studios skip this step. There's no App SDK dependency to upgrade: update sanity to the latest release and move on to the next step.
Dashboard 2.0 signs your app in and passes it the current organization over its message bus. SDK 3.9.0 and later support this. If you're upgrading from v2, follow App SDK v2 to v3 for the breaking changes.
npm install @sanity/sdk@latest @sanity/sdk-react@latest react@latest react-dom@latest
npm install --save-dev sanity@latestpnpm add @sanity/sdk@latest @sanity/sdk-react@latest react@latest react-dom@latest
pnpm add --save-dev sanity@latestSwitch the configuration to defineApplication
Set app to a defineApplication call with slug, name, and title, and remove deployment.appId if you have one:
organizationId: Keep your existing value, or add the organization that owns the studio.entry: SDK apps only, and you have to set it explicitly,defineApplicationdoesn't default to./src/App.tsx. Studios get their window automatically and don't acceptentry.slug: The address in Dashboard and the hostname it deploys to. Note, slugs must be unique across all organizations, and your original Studio or SDK app will remain unchanged so you can roll back to the old Dashboard experience if needed. Be sure to choose a unique slug specific to your migrated app or studio.name: The stable identity. You can't change it after the first deploy. Defaults toslug.title: The label on the Dashboard dock button.
Nothing else changes. An SDK app keeps src/App.tsx as it is, including its default export and the SanityApp config that sets the project and dataset it reads from, and a studio keeps its sanity.config.ts workspaces. Before and after examples for both:
The studio keeps its api block. slug is the address the new application deploys to, and it takes over the role studioHost played for the standalone studio. Your existing studioHost deployment stays up until you undeploy it.
import {defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
app: {
organizationId: 'your-organization-id',
entry: './src/App.tsx',
},
deployment: {
appId: 'your-app-id',
},
})import {defineApplication, defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
app: defineApplication({
organizationId: 'your-organization-id',
slug: 'content-app',
name: 'content-app',
title: 'Content app',
entry: './src/App.tsx',
}),
})import {defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
api: {
projectId: 'your-project-id',
dataset: 'production',
},
studioHost: 'your-studio',
})import {defineApplication, defineCliConfig} from 'sanity/cli'
export default defineCliConfig({
api: {
projectId: 'your-project-id',
dataset: 'production',
},
app: defineApplication({
organizationId: 'your-organization-id',
slug: 'content-studio',
name: 'content-studio',
title: 'Content studio',
}),
})Run it in the Dashboard
The CLI starts a local Dashboard on the configured port (3333 by default). Open the Dashboard URL the CLI prints. You no longer need --load-in-dashboard; the CLI ignores it for these apps. If you run several apps or studios locally, they all connect to the same local Dashboard.
npx sanity devpnpm dlx sanity devyarn dlx sanity devbunx sanity devDeploy the new application
The first deploy creates a new application and prints its URL. The CLI then prints a deployment.appId. Add it to sanity.cli.ts so later deploys update this application instead of creating another.
If you want to keep this new app or studio hidden from users while you migrate and test, set visibility: 'unlisted' in the defineApplication function. See Application Visibility for more information.
Deploying creates a new application
You can't convert an application you've already deployed. Deploying with defineApplication creates a new application at a new URL. The existing application, or the existing *.sanity.studio deployment, stays in your organization until you undeploy it.
Apps and studios you don't migrate keep working in Dashboard 2.0, but they won't receive new features.
An application deployed with defineApplication only appears in Dashboard 2.0, at your-app.sanity.run. It does not appear in the current Dashboard at sanity.io/@organizationId, even after a successful deploy.
npx sanity deploypnpm dlx sanity deployyarn dlx sanity deploybunx sanity deployUndeploy the existing app or studio (optional)
Until you remove it, the existing app or studio appears in the Dashboard next to the new one. To remove it with the CLI, run sanity undeploy from a copy of the project that still has the old configuration: deployment.appId for an SDK app, or studioHost for a studio. Once sanity.cli.ts uses defineApplication, sanity undeploy targets the new application instead:
npx sanity undeploypnpm dlx sanity undeployyarn dlx sanity undeploybunx sanity undeployNext steps
Was this page helpful?
Feedback submitted, thanks for helping us improve the docs. Have you tried these alternatives?