Logo for Hosted backend

Hosted backend

Sanity is powered by a secure and scalable real-time database.

Illustration of how studio and API is connected

Apps, not ops

Focus on building business value, not running operations.

  • GDPR compliant

    GDPR compliant

    • Fully GDPR compliant
    • Hosted in the EU
  • Cloud based

    Cloud based

    • Hosted and fully managed
    • Auto-scaling backends
  • Performant

    Performant

    • Global load balancing with geo-routing
    • Optimized backend
    • Edge cached assets
    • Geo-routed API cache
  • Durable and reliable

    Durable and reliable

    • Continuous DB backups
    • Versioned asset backups
    • Isolated offsite backups
  • Secure

    Secure

    • Physical access staff background vetted
    • Data encrypted at rest and in transit
    • APIs are TLS / SSL only
  • Global CDN

    Global CDN

    • Distributed & Redundant infrastructure
    • Geographically distributed
Illustration of devices using sanity

Real world, real time

Unfortunately the world happens all at once. Systems should respond to events as they unfold. Sanity is therefore built as a real-time architecture from the bottom-up.

Real-time

Patch-based updates

Transactional writes

Configurable consistency

Get notified

Install webhooks

Listeners: Get streaming updates to queries

Hundreds of thousands of clients to listeners

Powerful Query Language

GROQ - Graph Oriented Query Language

Ask for exactly the information your application needs. Join together information from several sets of documents. Stitch together a very specific response the exact fields you need.

  • Follow references
  • Relational joins on key-value data
  • Get exactly the data structures you need by reprojecting attributes
  • Bundle multiple queries in the same request and get it all cached.
  • Query on structured block text

Everything

*

Movies released after 1979

*[_type == 'movie' && releaseYear > 1979]

… ordered by release year and only certain fields

*[_type == 'movie' && releaseYear >= 1979]
  | order(releaseYear) {
    _id, title, releaseYear
  }

Get actors and join in arrays of the titles of the movies they played in

*[_type == "person"]{
  _id, name,
  "movies":
    *[
      _type == "movie"
      && references(^._id)
    ].title
}

Enterprise comforts

Sanity is Enterprise ready

  • Handle millions of densely connected documents
  • Connect hundreds of thousands of real-time listeners
  • Single-sign-on (SSO) / Third party login integration
  • Free form security rules
  • Geographically cached endpoints
  • Service Level Agreement (SLA) available

A gnuA gnu

Command Line Goodness

Sanity ships with a command line interface that makes it easy to create new projects and set up, import and tear down datasets.

  • Get started

    npm install -g @sanity/cli && sanity init
  • Create and run new project

    sanity init && sanity start
  • Create a new dataset

    sanity dataset create myDataset
  • Export a dataset and associated assets

    sanity dataset export myDataset
  • Install a webhook

    sanity hook create myHook myDataset https://myCallbackURL
  • Query, slice and color it prettily

    sanity documents query '*[_type == "movie"][0...5]' --pretty
  • Import your document

    sanity import myJSON.json myDataset
  • Get the title, and have a cow say it

    sanity documents get myDocId | jq .title | cowsay

Image pipeline

Deliver and transform images for any device

Sanity allows you to upload 268 megapixel archival originals. A flexible image pipeline will resize, crop and reformat on the way to clients. Set image hot-spots to recrop for any aspect ratio.

  • Hot-spots: Automatically crop for different aspect-ratios
  • Store archival grade originals
  • Ingest JPG, PNG & TIFF. GIF too (kittehs!).
  • Output JPG, PNG & WebP.
  • Pass-through for SVG & GIF or transcode to other formats.
  • HTTP2 CDN

<img
  src={
    urlFor(mysteryPerson.mugshot)
    .width(200)
    .height(500)
    .blur(50)
    .url()
  }
/>

Read more about the Image URL Builder Client or the image URLs