How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Sanity project missing schema.js file after installation with clean template

32 repliesLast updated: Nov 29, 2025

I've started multiple times from the tips on the sanity page which is to create a project like this but it still installs without a schema.js file:
npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production

AI Update

This is actually expected behavior for the clean template! The --template clean option is specifically designed to create a Sanity project without predefined schemas, giving you a blank slate to start from.

When you run:

npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production

You'll get a project structure with a schemaTypes folder that contains only an index.ts file with an empty array:

// src/schemaTypes/index.ts
export const schemaTypes = []

This is intentional! The clean template is meant for developers who want to build their schema from scratch without any example content types.

What you should do next

You now need to create your own schema types. Here's how to add your first one:

// src/schemaTypes/postType.ts
import {defineField, defineType} from 'sanity'

export const postType = defineType({
  name: 'post',
  title: 'Post',
  type: 'document',
  fields: [
    defineField({
      name: 'title',
      type: 'string',
    }),
  ],
})
// src/schemaTypes/index.ts
import {postType} from './postType'

export const schemaTypes = [postType]

About schema.js vs schemaTypes/index.ts

There is no schema.js file in modern Sanity projects because:

If you want example schemas instead

If you'd prefer to start with pre-built example schemas to learn from, use the blog template instead:

npm create sanity@latest -- --template blog

This will give you a complete blog setup with example document types like post, author, and category that you can learn from and modify.

The clean template is working exactly as designed - it provides the basic project structure but leaves all schema definition up to you!

Show original thread
32 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