Compute and AI

Blueprints introduction

Learn what Blueprints are, how they work, and how to get started.

Blueprints enable infrastructure-as-code level management of Sanity resources. At this time, Blueprints are limited to managing Functions.

Experimental feature

Requirements

  • The latest version of Sanity CLI (sanity@latest) is recommended to interact with Blueprints and Functions as shown in this guide. You can always run the latest CLI commands with npx sanity@latest.
  • Write access to your organization and project settings.

Core concepts

Blueprint

Like a configuration file, a blueprint lets you define and customize Sanity resources.

Resource

Core Sanity components are resources. For the time being, Functions are the only resource supported by Blueprints.

Stack

A stack is a collection of resources that are managed as a single unit. These are linked to a project and can be multiple deployments of the same sanity.blueprint.ts configuration, or deployments for different blueprint configurations entirely.

For example, marketing might have a sanity.blueprint.ts that defines resources deployed to the marketing stack, while the commerce team may have their own sanity.blueprint.ts that deploys resources to the commerce stack.

You can view stacks with the sanity blueprints stack command, and switch stacks by running sanity blueprints init or sanity blueprints config --edit in an existing blueprints project

Limitations

Stack limit

Projects have a limit of 3 stacks. If you reach your limit and want to remove a stack, see the Remove a stack steps below.

No nested blueprints

When creating multiple blueprints in a single project, you cannot nest blueprints in subdirectories of a directory containing a sanity.blueprint.ts file.

❌ For example, don't do this:

✅ Instead, do this:

Troubleshooting

View stacks for a project

If you're unsure which stacks are deployed, run the blueprints stacks command.

View current stack

To view the currently selected stack, run the blueprints info command.

Remove a stack

To remove a deployed stack, run the following commands from a directory containing a configured blueprint for the same project as the stack you want to delete.

First, retrieve the stack identifier (it starts with ST-):

Next, run the following command with the stack identifier from the previous step.

Was this page helpful?