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:
- 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.htmlto allow the frontend router to handle the request.
- 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, these things are handled for you.
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:
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
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
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
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.