Specifications

Blueprint configuration reference

Reference documentation for the Blueprint configuration files.

The Blueprints configuration file defines resources, like Functions, for deployment to Sanity's infrastructure.

Interact with Blueprints by using the npx sanity blueprints CLI command.

The top-level of the blueprint configuration file contains the following properties:

  • RequiredblueprintVersionstring

    Defines the version of the Blueprints specification to use when parsing the configuration. Uses the YYYY-MM-DD format.

  • Requiredresourcesarray

    An array of Sanity resources. Right now this is limited to Function resources, but will expand in the future.

Resources

The following properties are shared across all resources. Additional resource-specific properties follow in the sections below.

  • Requirednamestring

    A unique function name. Must be an alphanumeric string that can contain dashes or underscores.

  • Requiredtypestring

    A resource type. For Sanity resources, this is made up of the sanity namespace, category, subcategory, and resource types separated by single periods. For example: sanity.function.document.

Functions

In addition to the common resource properties, functions also contain the following resources.

  • Requiredsrcstring

    The path, relative to the blueprint configuration file, of the individual function directory. For example, functions/myFunction.

  • eventobject

    Configuration options for the triggering event. See the event properties section below for details.

  • timeoutinteger

    The max invocation time, in seconds, of the function.

    • Default: 10
    • Minimum: 1
    • Maximum: 900
  • memoryinteger

    Sets the max memory allocation, in GBs.

    • Default: 1
    • Min: 1
    • Max: 10
  • envobject

    Set environment variables for the function. The env object accepts custom keys with string values. This is an alternative approach to using the sanity functions env CLI command.

  • transpileboolean

    If false, you will need to transpile any TypeScript code yourself and output the results to the individual function's .build directory. Defaults to true.

  • autoResolveDepsboolean

    If false, disables the automatic dependency resolution. Defaults to true.

event properties

  • onstring

    Defines the type of event trigger. The options are:

    • publish: Activates when a document is published.

    These actions trigger on individual documents with unique _id values. For example, updating or deleting a draft of a document will not trigger an update or delete on the published document.

  • filterstring

    A valid GROQ filter. This accepts most core GROQ filter functionality found in groq-js. Delta GROQ is not supported at this time.

    Only include the contents of the filter, not any other surrounding syntax.

    ✅ Do this: _type == "article"

    ❌ Not this: [_type == "article"]

  • projectionstring

    A valid GROQ projection. Omit the outer wrapping parentheses.

    • ✅ Do this: title, _id, slug
    • ❌ Not this: { title, _id, slug }

Example

TypeScript / JavaScript helpers

You can configure Blueprints with TypeScript and JavaScript. If you select either during sanity blueprints init, the CLI prompts you to install the @sanity/blueprints package. You can also add it to an existing project by adding it to your Blueprints-level project directory.

The helpers provide defaults and allow you to omit some configuration options. You can always override these defaults by explicitly setting the values as you would with the JSON format.

Was this page helpful?