Skip to content

Deployment

Deploying your application

1. Deploy to Vercel

Deploy your website to Vercel:

  1. Create a new repository on GitHub.
  2. Push your code to GitHub
  3. Create a new Vercel project
  4. Connect your GitHub repository and import the project. Make sure to set the root directory to /frontend.
  5. Copy the environment variables from the .env.local file and paste them to your Vercel project settings. Vercel supports pasting all variables at once.
  6. Deploy

Deploy the Sanity Studio to Vercel:

  1. Create a new Vercel project
  2. Connect your GitHub repository and import the project. Make sure to set the root directory to /studio.
  3. Copy the environment variables from the .env.local file and paste them to your Vercel project settings. Vercel supports pasting all variables at once.
  4. Deploy

2. Configure CORS settings

Add your domain names to the CORS Origins in your Sanity project settings to allow your deployed site to communicate with Sanity:

Frontend (Credentials - Not Allowed):

  • https://yourwebsite.com - example for your frontend main website

Studio (Credentials - Allowed):

  • https://sanity.yourwebsite.com - example for your studio site if you want to use a subdomain.

To set up a subdomain in Vercel:

  1. In your Vercel project dashboard, go to the Domains section
  2. Click Add Domain and enter your subdomain (e.g., sanity.yourwebsite.com)
  3. Vercel will automatically handle the DNS configuration since your main domain is already connected
  4. No additional DNS records are required on your domain provider’s end