Logo
Sign in
Product Logo
FunctionsSanity

Sanity Functions is a serverless compute platform for automating, validating, and enriching content workflows directly in Sanity projects.

Vendor

Vendor

Sanity

Company Website

Company Website

Product details

Sanity Functions is a serverless compute environment that allows developers to run custom logic in response to content events within the Sanity platform. Functions are small, single-purpose pieces of code that execute on Sanity’s cloud infrastructure when content changes occur, such as document creation, updates, or publishing. This enables automation, validation, enrichment, and integration with external systems without requiring developers to manage their own infrastructure. Functions are managed and deployed using Blueprints, which define when and how each function should be triggered. All function code is organized as self-contained projects, can access the full Sanity API, and is designed to be reusable and maintainable across multiple datasets and projects.

Key Features

Event-driven automation Run code automatically on content changes.

  • Trigger on document create, update, delete, or publish events.
  • Use GROQ to filter and project relevant data for each function.

Full API access Interact with all content and assets in your Sanity project.

  • Manipulate any document or dataset.
  • Integrate with external APIs or services.

Reusable, modular code Package logic as reusable modules.

  • Maintain consistent results across workflows.
  • Reduce code duplication and improve maintainability.

Blueprint-based deployment Manage triggers and configuration declaratively.

  • Define when and where each function runs using Blueprints.
  • Functions are linked to projects, not datasets, for broad applicability.

Local development and testing Develop and test functions locally before deployment.

  • Use the CLI to emulate, test, and manage functions.

Secure, managed execution Runs on Sanity’s infrastructure with project-level security.

  • No need for separate hosting or permission management.

Benefits

Streamlined content operations Automate repetitive and error-prone tasks.

  • Reduce manual intervention in content workflows.
  • Ensure consistency and reliability in operations.

Extensible content management Customize and extend Sanity to fit any workflow.

  • Integrate with third-party systems (e.g., trigger builds, send notifications).
  • Enrich content with AI, localization, or custom validation logic.

Developer productivity Faster iteration and deployment of workflow logic.

  • No infrastructure setup or maintenance required.
  • Modular codebase improves reusability and testing.