Skip to content

Sanity

Author: Anne-Serine ([title](https://github.com/Anne-Serine))

sanity logo

Introduction

Sanity is a cloud-based, open-source content management platform designed to handle structured content across various devices and channels. It operates as a headless CMS, meaning it separates content management from content presentation, allowing developers to deliver content anywhere, including websites, apps, and other digital platforms, through APIs.

Sanity offers a fully customizable, real-time backend and a flexible user interface called Sanity Studio, which developers can tailor to specific needs. The platform supports integration with other technologies and frameworks, making it a versatile tool for managing and distributing content efficiently. Trusted by major brands, Sanity is designed for flexibility, scalability, and collaboration, making it suitable for both small teams and large enterprises.

Brief History

Sanity originated from a Norwegian digital agency called Bengler, and it was founded in 2017 by Øyvind Rostad, Simen Svale Skogsrud, Magnus Hillestad, and Even Westvang. The company started as a response to the limitations they encountered while building digital products and managing content for clients.

The idea for Sanity emerged during a project for Amedia, a group of 60 Norwegian newspapers. The team built a system to manage content in a flexible way, treating content as structured data that could be easily reused and adapted for different channels. This was a new approach compared to traditional content management systems, which were often rigid and hard to customize.

Their success with Amedia and other projects showed them that this structured content approach could change how digital products were built. While working on a project for the Dutch architectural firm OMA, they developed an early version of Sanity. The project needed an archive for hundreds of projects and contributors, and Sanity’s flexibility allowed the creation of both a dynamic website and print-on-demand books without needing to reformat the content.

After two years of refining the platform and testing it with customers, Sanity was officially launched in November 2017. It was designed to overcome the shortcomings of existing content management systems, which were often complex and not well-suited for modern needs.

The founders designed Sanity to evolve with future content needs, enabling real-time collaboration and easy integration with various digital platforms. The company has continued to grow, especially in the U.S., and is building a strong community around its open-source tools.

Main Features

FeatureDescription
Structured ContentIn Sanity, content is stored as structured data, typically in JSON format. This means that every piece of content, whether it’s text, images, or metadata, is treated as data that can be easily queried, manipulated, and reused.
Real-Time CollaborationReal-time collaboration in Sanity allows multiple users to work on the same document at the same time. Changes made by one user are instantly visible to others, making it easier to work together without having to wait or worry about overwriting someone else’s work.
API-First ApproachMakes Sanity incredibly flexible, powerful, and adaptable for modern content needs. The API-first approach allows you to query exactly the content you need, optimizing performance and reducing unnecessary data load. Sanity uses GROQ (Graph-Relational Object Queries) or GraphQL-API to fetch the content.
Sanity StudioSanity Studio is the customizable content management interface of Sanity.io, providing a unique and flexible way to manage content. Unlike traditional CMS dashboards, Sanity Studio is built as a React single page application (SPA), making it highly adaptable to fit specific project needs.

Comparison

Sanity vs. WordPress (Traditional CMS platform)

A headless CMS like Sanity provides a backend-only approach where content is delivered via APIs to any frontend, offering flexibility to use any technology or framework. It’s ideal for developers who want full control over their frontend and need to deliver content across multiple platforms (web, mobile, etc.). While more scalable and secure, it requires more setup and technical skills.

In contrast, a traditional CMS like WordPress is an all-in-one solution that includes both backend and built-in frontend capabilities. It is user-friendly and designed for non-developers, with themes and plugins for easy setup. However, it’s less flexible, and performance can suffer without careful management. WordPress is best suited for simpler websites, blogs, or quick projects that don’t require much coding.

Overall, Sanity offers greater flexibility and control for complex projects, while WordPress is perfect for simpler, faster setups with minimal technical overhead.

Architecture of a monolithic CMS - ref. Sanity Website Architecture of a monolithic CMS - ref. Sanity Website

Sanity vs. Crystallize (Headless Commerce platform)

While Sanity and Crystallize are both headless CMSs, Sanity is more flexible and general-purpose, suitable for various types and channels, while Crystallize is tailored specifically for eCommerce.

Crystallize provides advanced product management features, such as product variants, rich descriptions, pricing, and inventory. It’s optimized for fast content delivery with a powerful GraphQL API, making data fetching quick and efficient. Crystallize also includes built-in support for eCommerce functionalities like subscriptions, payments, and checkout processes. It is ideal for businesses focused on online retail, offering robust product catalog management, quick setup for selling online, and seamless integration with eCommerce tools.

Architecture of a headless CMS - ref. Sanity Website Architecture of a headless CMS - ref. Sanity Website

Comparison table

Sanity, Crystallize, and WordPress

FeatureSanityCrystallizeWordPress
APIGROQ (native query language)GraphQL API for granular data fetchingRESTful API
GraphQL API supportGraphQL support via plugins
Structured DataStrong focus on structured contentOptimized for structured eCommerce dataPrimarily for unstructured content
Suitable for both eCommerce and general content managementIncludes Product Information Management (PIM)Structured data possible with plugins or custom development
Data StorageSchemaless document store, flexible content modelingStructured data for products, categories, and variantsMySQL relational database
PIM capabilitiesCustom fields require plugins or code
Content ManagementReal-time collaborationProduct and category managementFull content creation and management
Rich text, images, documentsPrice rules, assets, descriptions, technical detailsSupport for posts, pages, custom post types
Highly customizable content types
HostingFully cloud-based, managed by SanityCloud-based, managed by CrystallizeSelf-hosted or managed hosting solutions
Globally distributed CDNIncludes CDN and performance optimizationsRequires PHP and MySQL
InfrastructureDecoupled and modular servicesDecoupled architectureIntegrated, monolithic structure
Separate and replaceable services (CMS, search, media)Modular services (CMS, PIM, checkout)Extensible with plugins
FrontendNo built-in frontendNo built-in frontendBuilt-in frontend with themes and templates
Headless CMS, requires custom frontend (React, Vue, etc.)Headless approach, custom frontend development requiredSupports headless architecture with REST or GraphQL
CustomizationHighly customizable with Sanity StudioCustomizable through APIs, webhooks, and SDKsExtensive customization via themes, plugins, and custom code
Plugin supportFocused on enhancing eCommerce capabilitiesSupports child themes for more control
React-based SPA (Single Page Application) support
Ecosystem and PluginsGrowing ecosystemLimited plugin ecosystemVast ecosystem with thousands of plugins and themes
Official and community pluginsFocused on integrations with eCommerce tools (payment, shipping)Covers nearly every use case
SEO CapabilitiesCustom setup or third-party integration required for SEOSEO handled via custom development or third-party toolsStrong SEO capabilities with plugins like Yoast SEO
Built-in permalink structure customization
ScalabilityHighly scalable, supports high traffic with real-time updatesDesigned for scalability in large eCommerce applicationsScalable, but performance depends on hosting and management
Cloud infrastructureCan handle extensive catalogs and transactions
PerformanceOptimized for performanceHigh performance for eCommercePerformance varies
Real-time updates, CDN integration, flexible data queryingOptimized data fetching and deliveryCan be optimized with caching plugins, CDNs, proper hosting
SecurityManaged by SanityManaged by CrystallizeRequires regular updates to core, themes, and plugins
Regular updates, encryption, compliance with security standardsSSL, regular updates, data protection built-inCommon target for attacks but can be secured with best practices
MaintenanceLow maintenanceMinimal maintenanceHigh maintenance
Updates handled by SanityUpdates managed by CrystallizeFrequent updates needed for core, plugins, themes
PricingTiered pricing based on usagePricing based on usageOpen-source and free to use
Free tier for small projectsPlans suited for different eCommerce needsCosts for hosting, premium plugins, and themes can add up
Scalable with enterprise plans
Community and SupportGrowing communitySmaller communityLarge, active community
Official documentationStrong support for eCommerce usersExtensive resources, forums, tutorials, third-party support
Enterprise-level support availableOfficial documentation and customer support
Use CasesIdeal for content-driven websitesBest for large-scale eCommerce platformsSuitable for blogs, small to medium-sized websites
Suitable for eCommerce with customizationMulti-channel retail, robust product managementContent-heavy sites, basic eCommerce
Real-time collaboration platforms
Projects requiring structured content
InternationalizationSupports multiple languages and localesDesigned with international eCommerce in mindMulti-language support through plugins
Custom setups needed for complex internationalizationSupports multiple currencies, languages, tax rulesRequires additional setup for global eCommerce
Integration CapabilitiesIntegrates with various services via APIIntegrates with popular eCommerce toolsExtensive integration options with CRM, eCommerce, marketing
Supports eCommerce platforms, marketing tools, analyticsPayment gateways, shipping providersAutomation, social media through plugins and APIs
Real-Time CollaborationBuilt-in real-time editing and collaboration featuresNo real-time collaboration featuresNo native real-time collaboration
Suitable for teams working on content simultaneouslyFocused on eCommerce workflowsPossible through third-party plugins or services
VersioningContent versioning and history built-inVersioning focused on product and pricing data changesBasic content revision history
Easy rollback to previous versionsNot as comprehensive as Sanity’s content versioningNot as robust as Sanity’s versioning
Learning CurveModerate learning curveModerate learning curveRelatively low learning curve for basic use
Especially if unfamiliar with headless CMS concepts and GROQEspecially for developers new to GraphQL or headless eCommerceHigher for advanced customization or headless implementations

Getting Started

Sanity account

You will need a Sanity account, this is free and you can create one at Sanity´s website:
Sanity - create account

Node and npm

To install and run the Sanity Studio development server locally, you need Node and npm installed (or an npm-compatible JavaScript runtime)
For more information how to do this:
npm Docs - downloading and installing Node.js and npm

Create a new project from the command line

This command creates a new project and dataset, and sets up a new project folder with all the files and dependencies you need to get started.
Open terminal, and type:

npm create sanity@latest
  • Agree to install Sanity package (create-sanity@current-version-number)
  • Log in with Google, GitHub or email/password
  • Answer the following questions (select project, create project name, template, package manager for installation etc.)

When this is done, navigate to the correct folder

cd new-example-project-path

For opening it in VScode:

code .

When you are inside the project in VScode open the terminal. To get it up and run locally, type:

npm run dev

Click the link, and it will open Sanity Studio in the browser.

Deployment

In order to deploy you need to install the Sanity CLI

npm i -g sanity@latest
npm run build
npm run deploy

Other helpful commands

To open the documentation in a browser

npm run docs

To open the project settings in a browser

npm run manage

To explore the CLI manual

npm run help

You can add these as scripts in package.json

example:

"scripts": {
"docs": "sanity docs"
}

Conclusion

To sum it up, when looking at Sanity, Crystallize and WordPress, each of these CMS platforms has its own strengths depending on what you need. Sanity stands out for its flexibility, real-time collaboration, and the way it handles data, making it easy to use across different devices via API. This makes it a solid choice for developers who want to create uniqe, dynamic content experiences on any platform.

Crystallize shares many of Sanity´s strengts, particulary in terms of data structuring and API-driven content delivery. However, it is more specialized, with a strong focus on eCommerce. This makes Crystallize an attractive option for developers who are building online stores and need robust product management, inventory, and checkout features built right in.

WordPress, on the other hand, is a more traditional CMS that provides a complete package with both backend and frontend services. Its ease of use and extensive plugin ecosystem make it accessible to users with minimal development experience.

In the end, the choice between these platforms really comes down to what your project needs and how much control you want over the frontend. For developers, headless CMSs like Sanity can be especially appealing because they offer the freedom and customization to build things exactly how you want, even if it means a bit more setup and development work upfront.

References

Logo and pictures

Additional Resources