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 is only focused on the installation instructions for Sanity 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, you will need to have Node.js v22.12 or later and npm installed (or an npm-compatible package manager).

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 options such as a Studio template, TypeScript, and your preferred package manager. 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 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, you can use sanity init or npm create sanity@latest. Both commands run the same initializer. When run inside an existing project using a supported framework (like Next.js), the CLI detects it and sets up Sanity within your current project directory instead of creating a new folder. Use the --output-path flag to control placement explicitly.

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 sanity.io/manage and select your project.
  • Go to Settings > API settings.
  • Under CORS Origins, add your development URL (for example, http://localhost:3000).
  • If the Studio is hosted on that origin, enable Allow credentials.

Learn more about CORS.

Was this page helpful?