👋 Next.js Conf 2024: Come build, party, run, and connect with us! See all events

Experimental feature: Spaces

A feature request we often get is the ability to switch between datasets from within Sanity Studio. This has a number of usages:

  • Managing multiple departments within the same organization, each with their own, separate datasets, but all sharing the same schema.
  • Modifying an existing schema type and testing how it works using a staging dataset.
  • Using the same studio across multiple projects with separate sets of both documents and users.

To facilitate this, we are proposing "spaces". A space is simply a mapping from a name/title to an API config. Spaces can be configured in your studio's sanity.json (under the __experimental_spaces key). Here's an example:

{
  "project": {
    "name": "Studio with spaces"
  },
  "__experimental_spaces": [
    {
      "name": "production",
      "title": "Prod",
      "default": true,
      "api": {
        "projectId": "ppsg7ml5",
        "dataset": "production"
      }
    },
    {
      "name": "staging",
      "title": "Staging",
      "api": {
        "projectId": "ppsg7ml5",
        "dataset": "staging"
      }
    }
  ],
  "//...": "..."
}

This will render a dropdown to switch between spaces in the studio:

Switching to another space will connect to the dataset configured for that space.

Disclaimer: Experimental feature

Did we mention that this is an experimental feature? That means it may or may not become a feature in its current form. But we acknowledge the need for a feature that supports the above use cases.

Found bugs / have feedback?

Please. Do let us know, either by filing an issue on GitHub or ping us on Gitter.

List of things we'd love to get feedback on in particular:

  • Naming things is hard. Is spaces a good word the feature? Maybe configuration is better? Suggestions?
  • Would you expect to be able to search for content across spaces? Currently thats not possible.
  • UX considerations: Would you expect to use one client to query for data across spaces, or would you typically configure one frontend per space.
  • Other issues?

Was this article helpful?