Index
Edit

sanity.json

sanity.json is a configuration file for Sanity components. There's one in the root of your project that contains the basic configuration for your studio.

Here's an example:

{
  "root": true,
  "project": {
    "name": "Movies",
    "basePath": "/studio"
  },
  "api": {
    "projectId": "<yourProjectID>",
    "dataset": "production"
  },
  "plugins": [
    "@sanity/base",
    "@sanity/components",
    "@sanity/default-layout",
    "@sanity/default-login",
    "@sanity/desk-tool",
    "@sanity/google-maps-input"
  ],
  "parts": [
    {
      "name": "part:@sanity/base/schema",
      "path": "./schemas/schema.js"
    }
  ]
}

Here is a short explanation for each key:

  • root defines whether this is the root sanity.json file of your project. Plugins and components can have sanity.json configuration files as well to define their named parts.
  • project defines the name of the studio displayed to the user. Optionally is may also contain a basepath that defines the root path for the studio. This lets you build the studio to a static bundle with sanity build and embed it in existing management interfaces.
  • api defines the projectId and dataset that this content studio will be connected to. You can find the projectId on sanity.io/manage when looking at your project. A project can have multiple datasets so you need to configure that as well.
  • plugins defines the basic plugins for your studio. These plugins themselves define their own plugins with their own sanity.json files. If you want to provide your own implementations for any of these you may do so below under parts.
  • parts defines named parts for the plugin system. We only define a single part here – our schema that define the data model for this studio.

Previous: Project StructureNext: Localization