Studio

Workspaces

Learn about working with multiple workspaces within a single studio setup

Running more than one workspace is useful when different teams, datasets, or regions need their own tailored editing environment without maintaining separate studios. Sanity Studio can accommodate multiple workspaces, each with its own configuration. To set up a studio with more than one workspace, supply an array of configurations to defineConfig instead of a single config object.

Prerequisites

  • A Sanity Studio project. If you're setting up a studio for the first time, see Configuration.
  • Familiarity with studio configuration properties. For a complete list, see the Configuration API reference.

Add a second workspace

To add a workspace, pass an array of workspace configurations to defineConfig. When there's more than one workspace, each one needs a unique name and basePath. This example sets up separate workspaces for US and EU content:

The Studio picks up each workspace in the array and displays a dropdown next to the Studio title in the navbar, so you can switch between workspaces.

Loading...

Workspace configuration properties

Studio configurations and workspace configurations are the same thing. We refer to them as studio configs when there's only one configuration, and as workspace configs when there are multiple configurations.

In practice, all configuration properties are workspace configuration properties. A few of them only matter when there's more than one workspace: name and basePath are required for every workspace and must be unique, and title, subtitle, and icon identify each workspace in the workspace menu. A single studio config can set them too, but doesn't need to. For more information, see the Configuration API reference.

A workspace's name also sets the ID of its deployed schema, _.schemas.<workspaceName>. Running sanity schemas deploy deploys a schema for every workspace in the config. Workspace names can only contain letters, numbers, underscores, and hyphens, so a workspace's schema ID is always _.schemas. followed by its exact name. For the schema commands and their options, see Schema deployment.

Hiding workspaces

The hidden property on a workspace configuration controls whether that workspace is visible in the workspace menu and chooser. When hidden evaluates to true, the workspace is removed from the workspace menu and chooser, and direct URL navigation to it shows a not-found screen. The property accepts either a boolean or a callback that receives {currentUser}.

hidden doesn't restrict data access

When the user is not yet authenticated in a workspace, currentUser is null. Callbacks should handle this case explicitly. The example above returns false in this case, so unauthenticated users can still see the workspace and sign in to it. Returning true when currentUser is null instead hides the workspace from unauthenticated users and prevents them from signing in to it. Before auth state resolves, callback-hidden workspaces are treated as visible and the Studio shows a loading screen.

Was this page helpful?