Joint session with Vercel: How to build intelligent storefronts (May 15th)

How to turn Sanity + Next.js project into reusable template?

4 repliesLast updated: Nov 29, 2025

Hey, I’ve just created a new Sanity project. I create a really simple studio with 2 documents (works and tags) and a singleton (home). I also created a custom body field using portable text.I connected this studio to a Next 13 brand new project that fetch data from my studio. My main folder is name
next-sanity-starter
and it includes a
studio
and a
web
folder that correspond to the sanity studio and my next.js application. Also, I want to use Vercel to host my
web
folder.
Is there a way to turn this project into a template I can re-use for any future project? Thanks!
AI Update

Absolutely! You can definitely turn your project into a reusable template. Here's how to create a template that you (and others) can use for future projects:

Creating a GitHub Template Repository

The simplest approach is to turn your repository into a GitHub template repository:

Now anyone (including you) can click "Use this template" to create a new project based on your setup. This is great for personal reuse and sharing with others.

Adding a Vercel Deploy Button

To make deployment even easier, you can add a Vercel Deploy Button to your repository's README. This allows one-click deployment to Vercel with environment variable prompts.

Add this to your README.md:

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/YOUR_USERNAME/YOUR_REPO&project-name=my-sanity-project&repository-name=my-sanity-project&env=NEXT_PUBLIC_SANITY_PROJECT_ID,NEXT_PUBLIC_SANITY_DATASET,SANITY_API_TOKEN&envDescription=Required%20Sanity%20environment%20variables&envLink=https://www.sanity.io/docs/api-versioning)

Key parameters you can customize in the Deploy Button URL:

When someone clicks the Deploy Button, Vercel will:

Creating an Official Sanity Template

If you want to share your template with the broader Sanity community, you can submit it as an official template. According to the Sanity documentation on creating templates, here's the process:

The validator checks for:

Project Structure Best Practices

For your monorepo structure with studio and web folders, make sure to:

# studio/.env.example
SANITY_STUDIO_PROJECT_ID=your-project-id
SANITY_STUDIO_DATASET=production

# web/.env.example
NEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id
NEXT_PUBLIC_SANITY_DATASET=production
SANITY_API_READ_TOKEN=your-read-token
{
  "name": "next-sanity-starter",
  "private": true,
  "scripts": {
    "dev": "concurrently \"npm run dev --prefix studio\" \"npm run dev --prefix web\"",
    "install:all": "npm install --prefix studio && npm install --prefix web"
  },
  "devDependencies": {
    "concurrently": "^8.0.0"
  }
}

Quick Personal Setup

For quick personal reuse, you could also create a simple setup script:

#!/bin/bash
# setup.sh - Run this after cloning

echo "Setting up your new Sanity + Next.js project..."

# Install dependencies
cd studio && npm install && cd ..
cd web && npm install && cd ..

# Copy environment templates
cp studio/.env.example studio/.env.local
cp web/.env.example web/.env.local

echo "✅ Setup complete! Next steps:"
echo "1. Add your Sanity project credentials to studio/.env.local and web/.env.local"
echo "2. Run 'npm run dev' to start both studio and web"

For your use case, I'd recommend:

The GitHub template + Vercel Deploy Button combination is the most user-friendly approach and exactly what you're looking for. When you want to start a new project, just click "Use this template" on GitHub, then click the Deploy Button to get it live on Vercel in minutes!

Show original thread
4 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions