Sanity Studio

The connector for this framework has undergone end-of-life. Usage of this guide is restricted to Edgio v7.5.x or lower. However, we strongly recommend that you integrate this framework through our generic Node.js connector instead.
This guide shows you how to deploy a Sanity Studio application to Edgio.
Sanity Studio is a single page app (SPA) written in React, where you can configure the document types and input fields, with simple JavaScript objects. This guide will walk you through how to deploy Sanity Studio with Edgio.


This framework has a connector developed for Edgio. See Connectors for more information.


Setup requires:

Install the Edgio CLI

If you have not already done so, install the Edgio CLI.
1npm i -g @edgio/cli@latest

Create a new Sanity Studio app

The command below will help you set up Sanity Studio:
1npm create @sanity/latest

Configuring your Sanity Studio app for Edgio

Initialize your project

In the root directory of your project run edgio init:
1edgio init --connector=@edgio/sanity-studio
This will automatically update your package.json and add all of the required Edgio dependencies and files to your project. These include:
  • The @edgio/core package
  • The @edgio/cli package
  • The @edgio/sanity-studio package
  • edgio.config.js- Contains various configuration options for Edgio.
  • routes.js - A default routes file that sends all requests to the Sanity Studio. Update this file to add caching or proxy some URLs to a different origin.


The default routes.js file created by edgio init sends all requests to Sanity Studio server via a fallback route.
1const { Router } = require('@edgio/core/router')
2const { sanityRoutes } = require('@edgio/sanity-studio')
4export default new Router().use(sanityRoutes)

Running Locally

To test your app locally, run:
1edgio run
You can do a production build of your app and test it locally using:
1edgio build && edgio run --production
Setting --production runs your app exactly as it will be when deployed to the Edgio cloud.

Deploy to Edgio

Deploy your app to the Edgio cloud by running the following command in your project’s root directory:
1edgio deploy
Your initial CDN-as-code deployment will generate system-defined origin configurations along with those defined within your edgio.config.js. Learn more about system-defined origins.
Learn more about deployments.

Post Deployment Whitelisting

Once Sanity Studio is deployed, you will need to add it’s URL to Sanity’s CORS origins settings. You can do this from the command line:
1sanity cors add https://your-url.edgio.link --credentials
Alternatively, you can navigate to manage.sanity.io, find your project and under Settings > API, add the Studio URL to the CORS origins list. You should allow credentials as the Studio requires authentication for added security.