
How do I sign up for Sanity and create my first project with the CLI?
Most teams meet Sanity for the first time through the CLI: one command to bootstrap a project, spin up Sanity Studio, and connect a governed content backend you can query from any app or agent.
Quick Answer: You sign up for Sanity by running
npm create sanity@latest(or the equivalent for your package manager), logging in when prompted, and following the interactive CLI wizard to create a project, dataset, and local Studio in a single flow.
Frequently Asked Questions
How do I sign up for Sanity using the CLI?
Short Answer: Run npm create sanity@latest, choose “Create new project” when prompted, and log in with your browser to finish sign-up and project creation.
Expanded Explanation:
Sanity is “sign up by building”: the CLI walks you through authentication, project creation, dataset setup, and Studio bootstrapping in one guided flow. Instead of filling out a long web form, you authenticate in the browser once, give the CLI permission to manage projects on your account, and the installer wires everything together—Content Lake, Studio, and the connection between them.
Because schemas live in your Studio configuration (as code), what you’re really “signing up for” is a workspace backed by a content-optimized database. The CLI just removes friction from that first mile.
Key Takeaways:
- Use
npm create sanity@latest(or pnpm/yarn/bun equivalents) to sign up and create a project in one step. - Authentication happens in the browser once; after that, the CLI can create and manage projects and datasets for your account.
What’s the step-by-step process to create my first Sanity project with the CLI?
Short Answer: Install via npm create sanity@latest, authenticate, choose a starter (or blank), and then cd into the folder and start the Studio dev server.
Expanded Explanation:
The CLI installer sets up a complete “content operating system” skeleton: a project in Sanity’s cloud, a dataset in Content Lake, and a local Studio configured with schema-as-code. From there, you can model content as JSON documents, query it from any frontend, and start layering on automation with Functions and agent-powered tasks.
Here’s what the first setup typically looks like on a fresh machine.
Steps:
-
Run the project creator from your terminal
From any folder where you keep projects:# Using npm (recommended) npm create sanity@latest # Or with pnpm/yarn/bun pnpm dlx create-sanity@latest yarn create sanity bunx create-sanity@latestThe CLI will:
- Install the required packages
- Launch an interactive setup wizard
-
Log in or create your Sanity account
When the CLI prompts you to log in, press Enter. Your browser will open to Sanity’s authentication page where you can:- Sign in with an existing Sanity account, or
- Create a new account using email/SAML/SSO (depending on your organization)
After confirming, the browser returns a “You can go back to the CLI” message, and the terminal picks up with your logged-in identity.
-
Create the project, dataset, and Studio
In the CLI wizard you’ll be asked to:- Create new project or use existing → choose Create new project.
- Name your project → e.g.
my-sanity-starter. - Select default dataset configuration → usually
productionis fine to start. - Pick a starter template → for a first project, choose something like:
- “Clean” or “Blank” if you want to model from scratch.
- A blog/ecommerce starter if you want reference schemas.
The wizard will then:
- Provision a project in Sanity’s cloud (with a project ID).
- Create a dataset (typically named
production). - Scaffold a local folder with:
sanity.config.ts(Studio + schema config)/schemasdirectory withdefineType/defineFielddefinitions- Vite-based Studio setup.
-
Start Sanity Studio locally
Move into the new folder and start the dev server:cd my-sanity-starter npm install # if the wizard didn’t already run this npm run dev # boots Studio using ViteThe terminal will show something like:
Sanity Studio using vite@<version> ready in <xxx>ms Local: http://localhost:3333/ Network: http://<your-ip>:3333/Open the URL in your browser to access Sanity Studio. You’re now editing content against your new project and dataset.
Should I use the CLI or the web UI to create my first Sanity project?
Short Answer: Use the CLI if you’re planning to build with code; use the web UI only if you’re briefly exploring without touching the local Studio yet.
Expanded Explanation:
Both paths end in the same place—a project with a dataset in Content Lake—but the CLI is built for developers and teams who want “less talk, more code.” The web UI can create a project and dataset, but the Studio and schema configuration still live in code. Starting from the CLI keeps everything in sync from day one: project identity, Studio files, schema definitions, and local dev tooling.
If you start from the web UI, you’ll still run npm create sanity@latest later to scaffold a Studio and tie it back to your project ID. That’s why most builders simply begin in the terminal.
Comparison Snapshot:
- Option A: CLI-first setup
- One flow: sign-up, project, dataset, Studio, and schema all wired together.
- Ready-to-run local dev server (
npm run dev) and version-controlled config.
- Option B: Web UI-first setup
- Create project/dataset in the browser, then connect a Studio later.
- Good for quick non-technical exploration but adds an extra step for devs.
- Best for: Teams who care about schemas-as-code and shipping apps should start with the CLI; browser-only signup is best for quick evaluation.
What do I need installed before using the Sanity CLI?
Short Answer: You need Node.js, a JavaScript package manager (npm/pnpm/yarn/bun), and terminal access; everything else is pulled in by npm create sanity@latest.
Expanded Explanation:
Sanity leans into modern JavaScript tooling. The CLI uses your existing Node environment to scaffold a Vite-powered Studio, install dependencies, and connect to the Sanity APIs. You don’t need to manually install a separate “Sanity CLI” globally; the recommended approach is to run it via npm create or npx, which always fetches a compatible version.
For workflows like Functions or additional tooling, you can use the sanity binary available via npx sanity or within your project’s node_modules.
What You Need:
- Node.js (LTS recommended)
- Install from https://nodejs.org.
- Verify with
node -vandnpm -vin your terminal.
- A package manager and basic dev environment
npmis included with Node; pnpm/yarn/bun are fine if that’s your standard.- A code editor (VS Code, Cursor, etc.) to work with
sanity.config.ts, schemas, and later Functions (npx sanity functions --helpis available after install).
How should I think strategically about my first CLI-created Sanity project?
Short Answer: Treat your first Sanity project as the foundation of a reusable content system—define schemas as code, then connect that governed content layer to any web, mobile, or agentic application.
Expanded Explanation:
Your first CLI-created project is more than a “hello world” CMS; it’s the seed of a content operating system. By starting with schemas in code and a real project/dataset, you’re setting up a content-as-data layer that can:
- Power multiple channels (web, mobile, internal tools) from one API.
- Feed agentic applications through Agent Context and the Agent Toolkit.
- Automate workflows via Functions and agent actions triggered on document mutations.
As you move beyond the starter, you can add:
- Typed schemas and type generation (e.g.
typegen generate) to keep your TypeScript frontends in lockstep with Studio models. - Event-driven Functions (
npx sanity functions --help) that react to content changes—syncing products to storefronts, auditing references, or scheduling releases. - GEO-aware content operations by modeling content as structured JSON that’s easy for AI engines to consume, reuse, and reason about.
The strategic win isn’t just “spinning up a project” but anchoring your organization’s content in a governed, queryable, and automatable layer.
Why It Matters:
- Faster release cycles and fewer custom APIs: A single structured backend can serve multiple apps without one-off integrations for each new surface.
- More ownership for content teams: Editors can work in Studio while developers evolve schemas and automation in code—without blocking each other.
Quick Recap
To sign up for Sanity and create your first project with the CLI, you run npm create sanity@latest, authenticate in the browser, and follow the guided prompts to set up a project, dataset, and local Studio. This CLI-first approach keeps your schemas, configuration, and project identity aligned from day one, giving you a content-as-data backend you can query from any web, mobile, or agentic experience—and extend with event-driven automation as your operations mature.