Sanity,
GROQ &
GraphQL

GraphQL is not a general
query language

GROQ
is a general
query language


*[_type == "author"
  && name match "Edgar"
  && debutYear < 1900] {
  name,
  debutYear,
  "bookCount": count(books)
}

INSERT THINGY HERE



*[_type == "movie"  &&
  genre == "action"
].director.name

β€œIn a Sanity/GraphQL environment, you would carefully craft a specific GraphQL API powered by GROQ under the hood.”

β€œIn the future we will provide this facility as a standard component in our stack.”

The future is...
soon?

insert demo here

Purpose-built API

  • Predefine and name queries
    • Easier discoverability
    • Expose only the queries you want
  • Visibility on a per-query basis

Utilize tooling

  • GraphiQL, GraphQL playground
  • Apollo, Relay, Vulcan etc
  • Graph visualizers
  • Clients and helpers for many environments

Mutations

  • By default; same mutations as in Sanity
  • If self hosted; build custom mutations based on Sanity mutation primitives

Subscriptions

  • To be decided. No "de-facto" transport/client implementations yet
  • Probably same listener format as in Sanity, but subscribe through GraphQL

Sanity, GROQ & GraphQL

By Espen Hovlandsdal

Sanity, GROQ & GraphQL

  • 933