Studio

Installation

How to install and initiate a new Sanity Studio project

If you’re new to Sanity, we recommend exploring the different ways of getting started as this article won't go into any detail beyond the installation instructions for Studio.

Initiating a new Studio from the CLI

Launching a studio from the CLI is typically useful when you:

  • are starting a new project
  • prefer to figure tools out on your own
  • need to set up a content backend quickly

To install and run the Sanity Studio development server locally v4 or later, you will need to have Node v20+ and npm installed (or an npm-compatible JavaScript runtime).

To initiate a new Studio, you can run the following command using a package manager:

Dataset visibility

The CLI will take you through creating or signing into an account and choosing a studio template, TypeScript, preferred package manager, etc. It will make a new folder on the desired path and bootstrap a studio with the necessary configuration.

Once the CLI has installed the studio, you can cd go into the studio folder and run npm run dev to start the local development server.

Adding Sanity to an existing project

If you have an existing application and want to add Sanity to it, use sanity init instead of npm create sanity@latest. The init command sets up Sanity within your current project directory rather than creating a new folder.

The CLI walks you through connecting to a project, choosing a dataset, and generating a sanity.config.ts file. If you want the Studio files in a subfolder, use the --output-path flag:

Embedding Studio in a framework

You can embed Sanity Studio directly in a framework application as a route. See the framework-specific quickstart guides for step-by-step instructions:

CORS configuration

When embedding Studio or making API requests from a browser, add your application's origin to the project's CORS settings. Go to manage.sanity.io, select your project, then go to API > CORS origins, and add your development URL (for example, http://localhost:3000). Enable Allow credentials if the Studio is hosted on that origin.

Was this page helpful?