Next.js quickstart

Defining a schema

The Sanity Studio can only interact with documents in a dataset for which it has schema types registered in its configuration. It currently has none.

1Create a new document type

Create a new file in your Studio’s schemaTypes folder called postType.ts with the code below which contains a set of fields for a new post document type.

2Register the post schema type to the Studio schema

Now you can import this document type into the schemaTypes array in the index.ts file in the same folder.

3Publish your first document

When you save these two files, your Studio should automatically reload and show your first document type. Click the + symbol at the top left to create and publish a new post document.

Was this page helpful?