Request for a TypeScript starter studio with desk structure example in Slack thread.
Good news! The Sanity team provides several official TypeScript starter templates, and the best part is that TypeScript is now the default for all new Sanity projects.
When you run sanity init (the official CLI command for creating new projects), it will automatically set up a TypeScript-based Studio unless you explicitly opt out with the --no-typescript flag. The CLI will walk you through an interactive setup where you can choose templates like "clean" (minimal starter) or "blog" (pre-configured content types).
Official Starter Templates
The Sanity team maintains several official TypeScript templates on GitHub:
- sanity-template-nextjs-clean - Next.js + Sanity Studio
- sanity-template-astro-clean - Astro + Sanity Studio
- sanity-template-nuxt-clean - Nuxt + Sanity Studio
All of these include TypeScript configuration out of the box and serve as excellent reference projects.
TypeScript Type Generation
For transitioning your existing studio, you'll want to use the sanity typegen CLI command. This generates TypeScript types from your schemas automatically:
# Extract your schema
npx sanity@latest schema extract
# Generate types
npx sanity@latest typegen generateThis creates a sanity.types.ts file with types for all your schema types, which you can then import throughout your project. The generated types work great with the Sanity client for type-safe queries and mutations.
Sanity also offers a free course called "Typed content with Sanity TypeGen" that covers schema extraction, type generation, and working with GROQ query types using the defineQuery helper.
For a quick start with a clean TypeScript Studio, just run npx sanity@latest init and follow the prompts!
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.