Create your own Sanity template
Guide on creating, validating, and submitting a Sanity template for community use.
Ready to submit your template?
Submit your template for review, then join the #template-creators Slack channel to connect with others and share your work.
Sanity templates are reusable, pre-configured projects that come with an integrated, customizable front-end. They're a great way to streamline your development process, ensuring consistency across different projects, and reducing the time required to get a new project off the ground.
Creating a template for the Sanity community is a great way to share your expertise with other developers and make starting future Sanity projects a breeze.
This guide shows you how to create and submit a new Sanity template.
Prerequisites
- A GitHub account. The Sanity template kit is a GitHub template repository, and every submitted template needs a public repository.
- Node.js 18 or later, and npm. This is the floor for the template kit and
@sanity/template-validator; the front-end framework you choose may require a newer version. - A Sanity account and project. See Getting started with Sanity.
Before you start
Submitting a template requires a Sanity community profile. The submission form's Author(s) field only accepts profiles that already exist, so create yours before you start. In the Community Studio, select Your profile, add your handle and short bio, then publish it.
Step 1: Create a repository from the Sanity template kit
The easiest way to get started creating a Sanity template is by using the official Sanity template kit as a starting point.
This repo provides all the necessary boilerplate for creating a template; including a generic studio configuration, a folder to generate your front-end framework of choice, and the @sanity/template-validator GitHub action to ensure your template meets Sanity's technical requirements.
Click the Use this template button in GitHub to create a new repository from the Sanity template kit.
Step 2: Initialize your front end
After creating your repository from the Sanity template kit, initialize your preferred front end inside a directory called frontend.
The following command initializes a new app with Next.js, but you can use any front-end framework to build out your template.
npx create-next-app@latest frontendpnpm dlx create-next-app@latest frontend
yarn dlx create-next-app@latest frontend
bunx create-next-app@latest frontendProtip
If you're prompted to initialize a new git repository for your project, say 'No' since you're initializing the front-end inside of an existing git repository.
Step 3: Build out your template
Now, the fun part! After initializing your project, it's time to build out your template.
Before you start, familiarize yourself with the Opinionated Guide to Sanity Studio.
This guide provides best practices for:
- File organization for schemas and plugins
- Defining reusable and extensible content schemas
- Formatting GROQ queries for readability and performance
For advice on building a front end that works well with Sanity, look at Sanity's official, framework-specific templates for Next.js, Astro, Nuxt, Angular, SvelteKit, and Remix.
These templates show how to use advanced Sanity features like the Presentation tool and the Live Content API to build powerful experiences into your template like:
If you need help or inspiration, join the #template-creators channel in the Slack community. Other template creators and the Sanity team can help.
Step 4: Validate your template
Once you're ready to submit your Sanity template, you can validate it using the @sanity/template-validator package.
From the repository root, install dependencies with npm install, then run the validator:
npm run validatepnpm run validateyarn run validatebun run validateThis script ensures your template complies with Sanity's technical requirements. You can find a full list of validation rules, but in general the script checks for:
- A
package.jsonwithsanity,next-sanity, or@sanity/clientindependencies. - A
sanity.config.js,.ts, or.tsxfile and asanity.cli.jsor.tsfile. - One of
.env.template,.env.example,.env.local.template, or.env.local.example, containingSANITY_PROJECT_ID(orSANITY_STUDIO_PROJECT_ID) andSANITY_DATASET(orSANITY_STUDIO_DATASET).
See the current list of featured templates for examples of well structured template projects.
Common errors
Environment template in root package contains invalid environment variable syntax. Please see https://dotenvx.com/docs/env-file for proper formatting.
This error is usually due to whitespace before the = in your .env.template, .env.example, .env.local.template, or .env.local.example file.
Invalid package.json file in frontend
This error means the package.json in that package could not be parsed — check for malformed JSON (trailing comma, missing brace). If instead you see At least one package must include "sanity" as a dependency in package.json, add a Sanity-related dependency such as sanity, next-sanity, or @sanity/client to dependencies (devDependencies are not checked).
Step 5: Submit your template
Once your template passes the validator, submit your template for review in the Community Studio.
You'll need to provide:
- A title and description of your template.
- A relative address (slug) for your template's page under sanity.io/templates.
- A link to your template's GitHub repository, which must be public and start with
https://github.com/. A repository link is optional only if you provide a purchase URL for a commercial template. - A 1200px x 750px image or screenshot of your template.
- At least one author. Each author must already have a Sanity community profile.
- The application frameworks your template uses, such as Next.js.
- The CSS frameworks your template uses, such as Tailwind CSS.
- At least one use case, such as e-commerce.
Although optional, add a link to a deployed example application that shows your template in action.
A deployed example lets readers preview your template and decide whether it fits their use case.
The Sanity team reviews your submission to ensure it meets Sanity's quality standards and provides value to the community. For reference, a good template is:
- Purposeful: Clearly communicates the use case, for example an e-commerce store with Sanity and Shopify, or a documentation site with search powered by Algolia.
- Configurable: Includes sensible defaults but stays customizable.
- Documented: Provides clear setup instructions in a
README.md. The templates gallery renders your README on your template's listing page, so write it for readers deciding whether to use your template. The Sanity template kit includes one to start from.
If changes are needed, the Sanity team reaches out with feedback on how to improve your template.
Next steps
Congratulations! Once your template is approved, it is listed in the official Sanity templates gallery in Sanity Exchange. After approval, be sure to:
- Promote your template: Share your template with the Sanity community on LinkedIn, X, and Bluesky and tag us @sanity.
- Iterate and improve your template: Address user feedback by checking in on your template in Sanity Exchange. Keep your template updated as dependencies and best practices evolve.
- Contribute other templates: Don't stop with just one! Build additional templates or join discussions in the
#template-creatorschannel on Slack.
By sharing your work, you’re empowering the community to create amazing projects with Sanity.

