Index
Edit

Deployment

Using Sanity Deploy

Our hosted service will give you a https://<my-studio>.sanity.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>.sanity.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.

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 below, these things are handled for you.

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 a 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 sanity.io/manage (read more on configuring CORS origins here).

Previous: LocalizationNext: Extending