Deployment
Deploying your application
1. Deploy to Vercel
Deploy your website to Vercel:
- Create a new repository on GitHub.
- Push your code to GitHub
- Create a new Vercel project
- Connect your GitHub repository and import the project. Make sure to set the root directory to
/frontend
. - Copy the environment variables from the
.env.local
file and paste them to your Vercel project settings. Vercel supports pasting all variables at once. - Deploy
Deploy the Sanity Studio to Vercel:
- Create a new Vercel project
- Connect your GitHub repository and import the project. Make sure to set the root directory to
/studio
. - Copy the environment variables from the
.env.local
file and paste them to your Vercel project settings. Vercel supports pasting all variables at once. - 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:
- In your Vercel project dashboard, go to the Domains section
- Click Add Domain and enter your subdomain (e.g.,
sanity.yourwebsite.com
) - Vercel will automatically handle the DNS configuration since your main domain is already connected
- No additional DNS records are required on your domain provider’s end