Init Sanity project from CLI without creating files using custom template

13 replies
Last updated: Jan 28, 2026
Hi there! Is there the option to init a new project from the cli without creating all the files? Ideally it would even work with a custom template created using sanity-template....
AI Update

Yes! There are actually a couple of options for initializing a Sanity project without creating all the Studio files:

The --bare Flag

As of Sanity CLI v3.9.0 (April 2023), the sanity init command supports a --bare flag that does exactly what you're looking for:

sanity init --bare

or with npm create:

npm create sanity@latest -- --bare

What --bare does:

  • Skips the installation of a Sanity Studio
  • Takes you through the project and dataset creation process
  • Prints the project ID and dataset names to the console
  • Perfect when you want to integrate with an existing application or have your own Studio code ready

The --env Flag

The same update also introduced the --env flag, which is useful when setting up environment variables:

sanity init --env

This flag:

  • Detects the framework used in your current directory
  • Creates a .env file with the correct prefix for environment variables
  • You can specify a custom path like --env .env.local.example

Using with Custom Templates

While the documentation doesn't explicitly cover using --bare with custom templates created via sanity-template, you can combine these approaches:

  1. Use --bare to create just the project/dataset
  2. Then use your custom template or existing Studio code
  3. Configure it with the project ID that was printed to the console

The sanity projects create Command

For even more control, you can use the sanity projects create command directly to create just a project without any Studio files at all, then set up your Studio or application separately.

These flags are particularly useful when you're integrating Sanity into an existing application, working with custom templates, or when you only need the Content Lake capabilities without a full Studio setup.

Show original thread
13 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?