Content Studio Deployment

Using Sanity Deploy

Our hosted service will give you a https://<my-studio> URL, and will make deployments super-simple and snappy. To use it, simply type:

sanity deploy

This will build your Studio into a static bundle of files and ship it all to the Sanity API. Hang on for a couple of seconds, and the Studio should be available at https://<my-studio>

If you have not assigned a Studio hostname, you'll be given the option to do so during deploy. Note that the hostname cannot be changed after you have assigned it.


The sanity deploy command works by building the source files in your studio project to static files, which is then uploaded and served from your chosen domain.

Note that there's no authentication involved when serving the built source files, so make sure to not include any sensitive data in your studio code (schema files, package.json, config files, custom inputs, etc).

Hosting the studio yourself

The Content Studio is a client-side web application. It communicates directly with the Sanity API and can in theory be hosted anywhere. There are a couple of prerequisites:

  1. The server that delivers the Sanity Studio build assets needs to be configured for single-page application routing. Basically, if the requested URL path doesn't exist on the filesystem, it should serve index.html to allow the frontend router to handle the request.
  2. The domain where the Studio is hosted must be white-listed as a valid domain for the project. The Sanity API ensures that only cross-origin requests with the correct origins are allowed to read and modify data for your project.

If you use our Content Studio hosting service described above, these things are handled for you.

When hosting yourself you might need to change the base path of the studio from / to a path of your choosing. Just can do this by specifying a basePath in the sanity.json file found in the root of your project:

"project": {
  "name": "<yourProjectName>",
  "basePath": "/<yourBasePath>"

First, build your Studio to a static bundle of files. Type sanity build within the project directory to do so. This will (by default) output the files to dist/.

Once that's done, set up a server to host the files. There are many ways to do this - Apache and NGINX are general-purpose webservers that can be configured to serve single-page applications with a bit of URL-rewriting.

Another option is to use Node.js to serve the bundle. You'll find a simple example using Node and Express to serve the bundle on GitHub.

Once you've got your Studio hosted somewhere, you just need to add the hostname to the list of allowed origins for your project using (read more on configuring CORS origins here).

You can also build studio in with a continuous integration tool. Add @sanity/cli as a dependency and add the command sanity build as one of the steps.

Previous: Methods Reference Next: Extending