Dashboard beta

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:

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 CLI also prints a deployment.appId. Add it to sanity.cli.ts so later deploys update this studio.

The first deploy always builds

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-*.js file, and the /static/ folder from there. Hosting the studio on a path such as https://example.com/studio isn't supported.
  • Send the Access-Control-Allow-Origin header 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 --external again. Add --no-build if you already ran sanity 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 --url with your studio's address.
  • A first deploy cannot skip the build (--no-build): Remove --no-build for the first deploy.
  • --url must be an origin with no path, query or hash: Pass only the domain, for example https://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.json loads in a browser, and that the response includes the Access-Control-Allow-Origin header.

Was this page helpful?