Sanity

Configure sanity CMS with a single click

Usage

npx next-inject add sanity

Setup Sanity Project

  1. Create a sanity account
  2. Create a new sanity project
  3. Make sure to select "From scratch with CLI."

Setup Environment Variables

  1. Now we need to find your projectId and dataset.
  1. Paste your projectId and dataset into your code as follows:
src/sanity/env.ts
export const apiVersion = "2024-07-31"
 
export const dataset = "YOUR_DATASET"
 
export const projectId = "YOUR_PROJECT_ID"

Configure The Sanity CLI

  1. Download the sanity CLI globally:
npm install -g sanity@latest
  1. Login with the sanity CLI:
sanity login
  1. Deploy Sanity Studio locally for testing:
sanity dev
  1. Once you are ready, you can now deploy your studio to the web:
sanity deploy
Note

There are many more CLI commands that you may find useful. Visit the cli reference to learn more.

Bonus Features
Blog schema
Demo component to fetch and render data

Any further questions?
Please do not hesitate to contact us by email or twitter
Also, If you are enjoying Next Inject, feel free to share a testimonial here!

On this page