Getting started

πŸš€ Simple 6-step setup

Table of Contents
  1. 1. Initialize the template
  2. 2. Set environment variables
  3. 3. Install and start local server
  4. 4. Add content into your Sanity Studio
  5. 5. Set up deployments
  6. 6. Customize

1. Initialize the template#

Click the Sanity template link -- OR -- install with the Sanity CLI:

  • npm create sanity@latest -- --template=nuotsu/sanitypress-with-typegen
    Sanity template link: https://www.sanity.io/get-started?template=sanitypress-with-typegen&ref=templates-sanitypress-with-typegen

    2. Set environment variables#

    If initialized via the Sanity template link, the .env.local file should be created automatically.

    If initialized via the CLI, duplicate the .env.example file as .env.local and assign the variables to your project:

  • .env.local
  • NEXT_PUBLIC_BASE_URL="https://example.com" # your website's domain
    
    NEXT_PUBLIC_SANITY_PROJECT_ID="abcd1234" # Sanity project id
    NEXT_PUBLIC_SANITY_DATASET="production" # Sanity dataset name
    
    SANITY_API_READ_TOKEN="..." # API token with "Viewer" permissions
    ⚠️ Required: Set NEXT_PUBLIC_BASE_URL to your production domain.

    3. Install and start local server#

    Install required packages and dependencies with your desired package manager (e.g. npm, pnpm, deno, bun, etc.).

  • npm run install

    Once installed, run the development script to start the local server:

  • npm run dev

    and open:

    4. Add content into your Sanity Studio#

    Publish the required documents: site and page (with the slug "index"). More details below:

    Document Slug or Path Usage Required? Notes
    site Global settings Yes
    page index Homepage route Yes
    page 404 Not found route
    page blog Blog listing route Add the Blog frontpage module
    global-module blog/ Blog post template Add the Blog post content module

    5. Set up deployments#

    Add a Vercel (default) or Netlify widget to enable deployments from the Studio.

    6. Customize#

    Adjust frontend styles to your liking, edit or add new schema and modules, etc.

    Ship your next site faster and type safer

    Built for developers who love clean structure and fast launches.