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.
If you haven't already, click the button below to deploy:
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.
Clone the repository that was created in your GitHub account and install dependencies:
git clone <your-new-repo-url>
cd <your-repo-name>
npm installLink 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.localFrom the project root, start both the Next.js app and Sanity Studio:
npm run dev- Next.js runs on http://localhost:3000
- Sanity Studio runs on http://localhost:3333
Sign in to the Studio with the same account you used during the Vercel/Sanity setup.
To get started quickly with pre-built content, run:
npm run import-sample-dataDeploy the Studio so your team can access it online:
cd studio && npx sanity deployYou 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).
Visit sanity.io/manage, select your project, and click "Invite project members" to collaborate with your team.