✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

Clarification on different ways to set up a Sanity project

3 replies
Last updated: Dec 21, 2022
Hi, Sanity newbie here!
I'm currently working through the Sanity Documentation to get Sanity up and running but I've discovered several ways to do this and I'm finding it confusing. For instance, in the section
Getting Started, the following commands are used:

npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production

npm run dev

then in the section
Setting up with Sanity, these commands:

npm install -g @sanity/cli

sanity init

sanity start

and the video tutorial:


npm create sanity@latest


I was wondering if anyone could help me to gain some clarity with this and explain the differences between the approaches?
Please forgive me if this question seems really simple
😳
Thanks!
Dec 21, 2022, 12:36 AM
Hey
user G
! Welcome! I can definitely see how this is confusing 🙂
This command installs the CLI tooling and allows you to run Sanity commands from your command line:

npm install --global sanity@latest
The simplest command you can run to create a project is that last one:

npm create sanity@latest
This will then take you through the process of configuring your project by asking you questions in the command line.

If you already know the answer to those questions, though, you can skip them entirely by adding those flags, like in this command:

npm create sanity@latest -- --template clean --create-project "Sanity Project" --dataset production
To break it down:

npm create sanity@latest
- create a Sanity project on the latest version
-- --template clean
- use a blank Studio with no prepopulated schema or data
--create-project "Sanity Project"
- make a new project (instead of selecting an existing on) and name it 'Sanity Project'
--dataset production
- create a dataset named production and add it to the project config.
Note: that middle set of commands you shared is for a V2 Studio and are considered deprecated.
Dec 21, 2022, 12:46 AM
Thanks for the prompt response.
Your comment, '_*Note: that middle set of commands you shared is for a V2 Studio and are considered deprecated.'*_ cleared it all up for me! Maybe it would help others to mention this information about Version 2 here:
https://www.sanity.io/docs/getting-started-with-sanity-cli ?
Thanks again for the concise explanation.
Dec 21, 2022, 12:58 AM
For sure! Thanks for pointing it out!
Dec 21, 2022, 1:16 AM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?