🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Migrating the CLI

Sanity Studio comes with a command-line interface tool that lets you run a local development server, bundle the studio for production, and do operations on your Content Lake and Project.

Minimal example

In a v2 Studio project, Sanity CLI would read the sanity.json configuration to connect to the correct project and dataset. In v3, you must create a sanity.cli.js (.ts) file that exports the configuration with defineCliConfig.

In v2, you would do:

// v2
  "root": true,
  "project": {
    "name": "My Sanity Studio"
  "api": {
    "projectId": "your-project-id",
    "dataset": "development"
  // ... rest of the config

In v3, you would do:

// v3

// /sanity.cli.js (.ts)

import {defineCliConfig} from 'sanity/cli'

export default defineCliConfig({
  api: {
    projectId: 'your-project-id',
    dataset: 'production'

Feedback or questions?

These guides are under development. If you have questions or suggestions for improvement, then we want to hear from you. Get in touch via our GitHub discussions page.

Was this article helpful?