Skip to content

Latest commit

 

History

History
81 lines (50 loc) · 3.52 KB

File metadata and controls

81 lines (50 loc) · 3.52 KB

Vercel Deployment Instructions

This guide is for users who deployed this template using the Sanity + Vercel Integration or one-click Vercel deploy button. It walks you through setting up your local development environment and deploying Sanity Studio.

Step 1. Deploy to Vercel

If you haven't already, click the button below to deploy:

Deploy with Vercel

Follow the instructions on Vercel to complete the deployment. This will clone the repo to your GitHub account, deploy the Next.js frontend, and create a Sanity project via the Vercel integration.

Step 2. Clone and install locally

Clone the repository that was created in your GitHub account and install dependencies:

git clone <your-new-repo-url>
cd <your-repo-name>
npm install

Step 3. Pull environment variables

Link your local project to your Vercel project and pull the environment variables:

cd frontend && npx vercel link && npx vercel env pull .env.local && cd ..

The Vercel integration provisions environment variables for both the Next.js frontend (NEXT_PUBLIC_SANITY_PROJECT_ID, NEXT_PUBLIC_SANITY_DATASET, SANITY_API_READ_TOKEN, etc.) and Sanity Studio (SANITY_STUDIO_PROJECT_ID, SANITY_STUDIO_DATASET, etc.). Since each app only reads the variables it needs, you can use the same .env.local file for both:

cp frontend/.env.local studio/.env.local

Step 4. Run locally

From the project root, start both the Next.js app and Sanity Studio:

npm run dev

Sign in to the Studio with the same account you used during the Vercel/Sanity setup.

Step 5. Import sample data (optional)

To get started quickly with pre-built content, run:

npm run import-sample-data

Step 6. Deploy Sanity Studio

Deploy the Studio so your team can access it online:

cd studio && npx sanity deploy

You will be prompted to choose a hostname (e.g., your-project.sanity.studio).

After deploying, update the NEXT_PUBLIC_SANITY_STUDIO_URL environment variable in your Vercel project settings to point to your deployed Studio URL (e.g., https://your-project.sanity.studio).

Step 7. Invite collaborators (optional)

Visit sanity.io/manage, select your project, and click "Invite project members" to collaborate with your team.

Resources