Schema Types

The schema describes the types of documents editors may author in the content studio. This is the reference documentation. We also have a human-friendly tutorial covering the basics.

By default the studio loads the schema from the file schemas/schema.js in your studio project. Sanity expects this file to provide a ready to use compiled schema. This is an example of a minimal schema.js file:

import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'

export default createSchema({
  name: 'default',
  types: schemaTypes.concat([
    // Add your own types here
      title: "My Example Document Type",
      name: "exampleDocumentType",
      type: "document",
      fields: [
          title: "Greeting",
          name: "greeting",
          type: "string"

The studio loads the schema by importing the part named part:@sanity/base/schema. You can relocate the schema according to your needs by changing the part definition in you content studio sanity.json file:

  // ... other config ...
  "parts": [
      "name": "part:@sanity/base/schema",
"path": "./schemas/schema.js"
} ] }

A plug-in may also provide types in the schema by providing its uncompiled types as part:@sanity/base/schema-type.

// In deweyClassification.js
  title: "Dewey Classification",
  name: "deweyClassification",
  type: "string"

// In the sanity.json-file of the plug-in
  parts: [
"implements": "part:@sanity/base/schema-type",
"path": "./deweyClassification.js"
// Implement the part again if you need to provide more types: // { // "implements": "part:@sanity/base/schema-type", // "path": "./anotherType.js" // }, ] }

Previous: ReferenceNext: Document