External hosted Studios
Host a studio on your own domain and open it in the Dashboard.
You can host a studio that runs in the Dashboard on your own domain instead of on Sanity hosting. Building and uploading the studio works the same way as for any self-hosted studio. See Self-host the studio. This guide covers what the Dashboard needs on top of that: registering your domain, and the headers your host must send.
Prerequisites:
- A studio set up for the Dashboard. See Get started.
- A web host you control, with HTTPS, for example
https://studio.example.com. - Sanity CLI vX.Y.Z or later.
Register your studio
From your studio folder, run:
npx sanity@latest deploy --external --url https://studio.example.com
pnpm dlx sanity@latest deploy --external --url https://studio.example.com
yarn dlx sanity@latest deploy --external --url https://studio.example.com
bunx sanity@latest deploy --external --url https://studio.example.com
The command builds your studio and registers it with the Dashboard at that address. It uploads a description of what the studio contains, so the Dashboard can show it, and nothing else. When it finishes, the CLI prints what your host needs to do:
The Dashboard loads this studio from your host, which must: 1. Serve dist/ unchanged at the root of its URL (/mf-manifest.json, /remoteEntry-*.js, /static/*) 2. Send Access-Control-Allow-Origin for https://YOUR_ORGANIZATION_ID.sanity.run 3. Respond without cookies or a sign-in This deploy rebuilt dist/: copy it to your host before opening the studio in the Dashboard.
The CLI also prints a deployment.appId. Add it to sanity.cli.ts so later deploys update this studio.
The first deploy always builds
The studio's ID is written into the build, so the first deploy can't use --no-build. It works on later deploys.
Configure your host
Your host must meet three requirements. The CLI output lists them with the values for your organization.
- Serve the files at the root of the domain, unchanged. The Dashboard loads
/mf-manifest.json, the/remoteEntry-*.jsfile, and the/static/folder from there. Hosting the studio on a path such ashttps://example.com/studioisn't supported. - Send the
Access-Control-Allow-Originheader with the Dashboard's address,https://YOUR_ORGANIZATION_ID.sanity.run. This lets the Dashboard load files from your domain. It's separate from the CORS origins in your project settings, which let your studio call the Sanity API. - Respond without asking for a login. The Dashboard loads the files from your browser without cookies, so a host behind a VPN, a firewall, or single sign-on doesn't work.
Deploy a new version
- Run
npx sanity@latest deploy --externalagain. Add--no-buildif you already ransanity build. - Upload the new
dist/folder to your host.
The Dashboard shows the new version the next time it opens the studio.
Errors you might see
These are the messages the CLI prints for the most common mistakes, and what to do about each:
A first external deploy needs the URL your host serves the build from: Add--urlwith your studio's address.A first deploy cannot skip the build (--no-build): Remove--no-buildfor the first deploy.--url must be an origin with no path, query or hash: Pass only the domain, for examplehttps://studio.example.com.Deploying an app to an external host is not supported.: Only studios can be hosted on your own domain. SDK apps deploy to Sanity hosting.- The studio opens in the Dashboard but shows nothing: Check that
https://studio.example.com/mf-manifest.jsonloads in a browser, and that the response includes theAccess-Control-Allow-Originheader.