Installation
The Sanity CLI comes bundled with thesanity package:
Getting Started
Create a new Sanity project:Available Commands
The Sanity CLI provides the following commands:Core Commands
sanity init- Initialize a new Sanity Studio and/or projectsanity dev- Start a local development server with live reloadingsanity build- Build the Studio into a static bundle for productionsanity deploy- Build and deploy Studio to Sanity hosting
Authentication
sanity login- Authenticate the CLI for access to Sanity projectssanity logout- Log out from the current user session
Project Management
sanity manage- Open project management interface in browsersanity projects list- List all projects you have access tosanity projects create- Create a new project
Documentation
sanity docs browse- Open Sanity documentation in browsersanity docs search- Search the Sanity documentationsanity docs read- Read documentation in the terminal
Development Tools
sanity install- Install a Sanity pluginsanity debug- Gather information for debugging purposessanity versions- Show installed versions of Sanity packagessanity typegen generate- Generate TypeScript types from schema
Advanced Commands
sanity codemod- Run codemods to transform your codesanity functions- Manage Sanity Functions (dev, test, logs, env)sanity blueprints- Manage infrastructure blueprintssanity openapi- Interact with OpenAPI specificationssanity telemetry- Manage telemetry settingssanity mcp configure- Configure AI editor integration (MCP)
Getting Help
Display help for any command:Common Usage Patterns
Configuration
The CLI reads configuration from:sanity.cli.tsorsanity.cli.js- CLI-specific configurationsanity.config.tsorsanity.config.js- Studio configuration
Environment Variables
The CLI respects several environment variables:SANITY_STUDIO_PROJECT_ID- Override project IDSANITY_STUDIO_DATASET- Override datasetSANITY_AUTH_TOKEN- Authenticate without interactive login
Next Steps
Initialize Project
Learn how to create a new Sanity project
Development Server
Start developing with the local dev server
Build for Production
Create production-ready static bundles
Deploy Studio
Deploy your Studio to Sanity hosting