
How do I sign up for Sanity and create my first project with the CLI?
Getting started with Sanity is a command‑line first experience: you sign up once, then use npm create sanity@latest to spin up a new project, dataset, and Studio in minutes. This FAQ walks through everything you need to know to sign up for Sanity and create your first project with the CLI.
Quick Answer: To sign up for Sanity and create your first project with the CLI, create a Sanity account (using email, Google, or GitHub), install Node.js, then run
npm create sanity@latestin your terminal and follow the interactive prompts to create a project, dataset, and Sanity Studio.
Frequently Asked Questions
How do I sign up for Sanity before using the CLI?
Short Answer: Go to sanity.io, click “Sign up,” and create an account using email, Google, or GitHub. Once you’re signed in, you can connect CLI‑created projects to this account.
Expanded Explanation:
Sanity is a cloud‑hosted content operating system, so every CLI project ultimately ties back to a Sanity project in your account. You can start from the web UI or directly from the CLI; in both cases, you end up with a Sanity account identified by a project ID (like abcd1234) and one or more datasets (like production).
To sign up, visit sanity.io, choose “Sign up,” and follow the prompts. You’ll land in the Sanity management interface where you can see existing projects, invite collaborators, and manage billing. When you later run npm create sanity@latest, you’ll authenticate the CLI against this account so it can create or link projects in the same organization.
Key Takeaways:
- Create a Sanity account at sanity.io using email, Google, or GitHub.
- The account is what the CLI uses to create and manage your projects and datasets.
How do I create my first Sanity project with the CLI?
Short Answer: Install Node.js, open a terminal, then run npm create sanity@latest and follow the prompts to create a new project, dataset, and local Sanity Studio.
Expanded Explanation:
Sanity’s CLI workflow is built around npm create sanity@latest. This one command scaffolds a Sanity Studio, connects it to your Sanity project in the cloud, and sets up a dataset in the Content Lake. You choose a template (blog, clean, or others), a project name, and optional features like TypeScript support.
Under the hood, the command:
- Creates a local folder containing your Studio configuration (schemas, plugins, config).
- Registers or links a Sanity project in the cloud.
- Sets up a dataset (like
production) to store your JSON documents. From there, you run the dev server, open Studio, and model content with schema as code.
Steps:
-
Install prerequisites:
- Install Node.js (LTS recommended).
- Ensure you have
npmor another package manager available.
-
Run the create command in your terminal:
npm create sanity@latest(You can also use
pnpm dlx,yarn dlx, orbunxif you prefer.) -
Follow the interactive prompts:
- Log in to your Sanity account (browser window will open).
- Choose Create new project or select an existing one.
- Name your project and dataset (e.g.,
production). - Pick a starter template (e.g., “Clean project with schema as code”).
- Choose JavaScript or TypeScript as your language.
-
Start the Studio dev server:
cd your-project-folder npm install # if needed npm run devThen open the printed localhost URL (often
http://localhost:3333) to access Sanity Studio.
What’s the difference between signing up in the browser vs. through the CLI?
Short Answer: The browser sign‑up gives you a visual dashboard first; the CLI sign‑up happens inline while you scaffold a project. Both end up with the same kind of Sanity account and project.
Expanded Explanation:
Whether you start from sanity.io or from npm create sanity@latest, you end up in the same ecosystem: a Sanity account with projects and datasets in the Content Lake. The difference is mostly where you begin and what you see first.
If you start in the browser, you’ll create an account and may optionally create a project from the web UI, then later connect the CLI to it. If you start in the CLI, you’ll be prompted to log in via browser, but you stay in your terminal to drive project creation. Most developers prefer the CLI‑first route because it keeps schemas, configuration, and project structure in code from day one.
Comparison Snapshot:
- Browser sign‑up first:
- Visual overview of projects and usage.
- Good if you’re assessing plans, security, and team setup before writing code.
- CLI sign‑up first (
npm create sanity@latest):- Code‑driven project setup with Studio and schemas installed locally.
- Good if you want to go straight from zero to running Studio.
- Best for:
- Builders and teams who care about “schemas as code” and want to keep configuration in Git generally start from the CLI.
How do I run and work with my first Sanity Studio after creating it?
Short Answer: From your project folder, run npm run dev to start Sanity Studio locally, then open the localhost URL to model content and create documents.
Expanded Explanation:
Once npm create sanity@latest finishes, you have a fully configurable Studio that talks to your Content Lake. The Studio is just a React application powered by Vite, living in your repo. Running npm run dev (or pnpm dev, yarn dev) spins up a dev server that watches your schema and config files.
When you edit the schema (using defineType and defineField), Studio hot‑reloads to reflect new document types and fields. Every document you create or edit in Studio is stored as JSON in your dataset and can be queried via the Sanity APIs to power web, mobile, or agentic applications.
What You Need:
- A local project folder generated by
npm create sanity@latestwith asanity.config.(ts|js)file andschemasdirectory. - A package manager script such as:
{ "scripts": { "dev": "sanity dev" } }
Then:
cd your-project-folder
npm run dev
# Studio is now running at http://localhost:3333 (or similar)
How do I turn my first CLI project into a scalable content system?
Short Answer: Treat your CLI‑created project as the foundation: define schemas as code, commit your Studio configuration to Git, and connect your dataset to frontends and agents via queries, functions, and automation.
Expanded Explanation:
Creating a project with the CLI is step one; turning it into a governed content system is where Sanity’s model pays off. Because schemas live in your Studio configuration (not locked into database constraints), you evolve your content model alongside your codebase. You can:
- Model content as data: Use
defineTypeanddefineFieldto reflect your business reality (products, content releases, campaigns) in JSON documents. - Query anything: Use GROQ or GraphQL to pull exactly the shape of data you need for each frontend or agent.
- Automate operations: Add Functions and Agent Actions that trigger on mutations (create/update/publish) to audit content, synchronize systems, or power GEO‑aware agents with precise context.
Over time, this CLI‑created project becomes your knowledge layer: one API that feeds websites, mobile apps, and internal or external agents, while your content team works in Sanity Studio without blocking engineering.
Why It Matters:
- Operational leverage: Schema‑as‑code plus event‑driven automation shrinks release cycles and lets content teams own 90%+ of updates without custom APIs for every new experience.
- Consistency across surfaces: A single content model and dataset power many frontends and GEO‑optimized experiences, rather than duplicating content per channel.
Quick Recap
You sign up for Sanity once, then let the CLI do the heavy lifting. With npm create sanity@latest, you authenticate, create or select a project, define a dataset, and scaffold a fully configurable Studio that stores content as JSON in the Content Lake. From there, you run npm run dev to open Studio, define schemas as code, and start building a content system that can power web, mobile, and agentic applications from a single API.