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.compnpm dlx sanity@latest deploy --external --url https://studio.example.comyarn dlx sanity@latest deploy --external --url https://studio.example.combunx sanity@latest deploy --external --url https://studio.example.comThe command builds your studio, registers it with the Dashboard at that address, and uploads the studio's manifest. Because the manifest is uploaded, the Dashboard doesn't fetch /mf-manifest.json from your host. The remoteEntry-*.js file and the /static/ folder still load from your domain. 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 the
/remoteEntry-*.jsfile and the/static/folder from there. Your build also contains/mf-manifest.json, but the Dashboard uses the copy uploaded at deploy time, so it doesn't need to be served from your host. 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 your host serves the
remoteEntry-*.jsfile and the/static/folder from the root of your domain, and that both responses include theAccess-Control-Allow-Originheader for the Dashboard's address.
Was this page helpful?
Feedback submitted, thanks for helping us improve the docs. Have you tried these alternatives?