SlideShare a Scribd company logo
GraphQL Across
the Stack
How everything fits together
Sashko Stubailo
Open Source Lead, Apollo
@stubailo
The goal of the Apollo team and community:
Make building great
applications simpler and more
straightforward, with GraphQL.
What's in GraphQL?
Best language for data
requirements
Universal schema for
capabilities
Huge ecosystem of
tools
Separation of concerns, not technologies
Client
Data requirements
API
Client
Data requirements
API
Endpoints GraphQL
client
server
We went from separating
HTML and JS to writing
unified components.
GraphQL is a component-
like approach to data.
Describing requirements vs. capabilities:
GraphQL gives frontends and
backends the correct split of
responsibility.
Today's apps can be complex
● Multiple frontends for different platforms
● Multiple backends where data lives
● Need for team coordination across different
languages, technologies, and contexts
Where do GraphQL and Apollo live?
React
Android
iOS
Angular
MongoDB
Oracle
Salesforce
PostgreSQL
Microservice
React
Android
iOS
Angular
MongoDB Oracle
Salesforce
PostgreSQLMicroservice
Vue
client
server
Apollo and GraphQL in 2017
An awesome ecosystem
Apollo Client 2.0
Universal frontend data management
GraphQL servers
in any language
CLIENT
Sends detailed data
requirements
SERVER
Provides flexible,
performant capabilities
The GraphQL Query:
A unit of data fetching
1. Send all of the requirements for a
unit of your UI in one request
2. Server can analyze and optimize
the entire query at once
3. Reduce backend fetches by
batching and caching per-request
Some of the main questions we hear:
1. CACHING
Load less data and save
resources
2. TRANSPARENCY
Understand what's
happening
3. MODULARITY
Combine parts into a
seamless whole
Example 1.
GraphQL result caching
Tradeoffs: GraphQL and caching
● HTTP caching often doesn't
support POST requests, long keys
● Greater request diversity
● GraphQL is transport independent
● Automatically fine-grained cache
control
● Declare it alongside your schema
and resolvers
Current approaches become harder to use, but there are opportunities for next
generation features that leverage GraphQL specifically.
In REST: Cache-Control header
Adding caching to GraphQL: Idea 1
Should it go inside the server?
● DataLoader not ideal for
caching across requests
● Don't want to add complexity to
your GraphQL server
Caching doesn't belong inside.
GraphQL Server Cache?
Backend
Adding caching to GraphQL: Idea 2
Cache outside of the server, both
above and below as necessary.
Keep complexity out of resolvers and
GraphQL schema.
Similar to HTTP infra, caching lives in
a separate layer.
GraphQL Server
Cache
Backend
Cache
A new component in the GraphQL stack
GraphQL Client GraphQL Server
GraphQL
Gateway
Idea: Move infra complexity out of the GraphQL server
Complexity
Apollo Engine
Gateway that mediates between
GraphQL clients and servers
Caching, tracing, and errors designed
specifically for GraphQL
Next version of Optics
apollographql.com/engine
Client ServerGateway
GraphQL result caching
Specifies cache control
info based on the
schema and backends
Reads cache controls,
stores data using
memcached
Client ServerGateway
GraphQL result caching
Complicated infrastructure and
logic lives here, not in the
GraphQL server code.
Client ServerGateway
Full stack caching
Uses controls to inform
client-side data store,
expire data
Specifies cache control
info based on the
schema and backends
Reads cache controls,
caches data using
memcached
Adding to GraphQL without taking away:
GraphQL has a specified place
to add extensions to the result,
next to data and errors.
http://facebook.github.io/graphql/October2016/#sec-Response-Format
ServerGateway
An open specification for GraphQL cache control
Client
Apollo Cache Control
apollographql/apollo-cache-control
Per-path cache hints
query {
post(id: 1) {
title
votes
readByCurrentUser
}
}
{
"data": { ... },
"extensions": {
"cacheControl": {
"version": 1,
"hints": [
{
"path": [
"post"
],
"maxAge": 240
},
{
"path": [
"post",
"votes"
],
"maxAge": 30
},
{
"path": [
"post",
"readByCurrentUser"
],
"scope": "PRIVATE"
}
]
}
}
}
github.com/apollographql/apollo-cache-control-js
Cache control in a GraphQL-focused way
Just like backend fetching, cache control is coupled to
the nature of the data, so it should be defined in the
schema and resolvers.
The final caching behavior you get depends on what data
was required by the client, and can be controlled by
changing the query.
Idea 1:
We can build on GraphQL's
core advantages and
expand them.
Caching in the API and the client
Most people use a caching
GraphQL client library.
If we're already specifying
cache controls for our
gateway, the same info can
be used for the client to
expire data.
Example 2.
Tracing + Errors
Fine-grained data, fine-grained perf
Since your client is asking for data in a detailed way, you should expect to get detailed information
about how your server is working.
/graphql 220.8ms
The first API with fine-grained insights built in
Understand how server perf affects the client
Know what is actually being
used, rather than a
dependency on an opaque
endpoint
Easily figure out which
screen a performance issue
will affect
Actionable data
Not only can you track performance,
but you can fix it on a fine-grained
level! Easy to change what fields the
client is fetching.
query getAppActivityFeed {
app {
_id
activities {
containerId
containerTypeId
containerTypeName
createdAt
featureEnabled
...
}
activityCount
}
}
Client ServerGateway
Tracing + Errors
Declares mapping from
GraphQL queries to UI
components
Collects performance
info from resolvers and
backends
Extracts metrics,
aggregates, samples,
analyzes
Client ServerGateway
Tracing + Errors
Complicated data collection and analysis lives
here, not in the server process. Also understands
caching in the same context.
ServerGateway
An open specification for GraphQL tracing
Client
Client ServerGateway
Devtools
Schema
Editor
integrations
Sketch.app
integration
Message queue
GraphiQL
Continuous
integration
Possibility for a whole world of tool integration.
Idea 2:
GraphQL enables
development tool
integration.
Concept: GraphiQL performance view
Trace
The ecosystem of tools for GraphQL
GraphQL spec is robust and
useful enough to spawn
thousands of companion tools
for every imaginable platform
Let's continue to expand on
those capabilities by building on
specified community standards
Example 3.
Schema Stitching
Correct responsibilities, part 2
GraphQL API
Data description
Service
GraphQL API
Data description
Service
Endpoints GraphQLThis time, we're talking about
communication between the
GraphQL API and the backend
services.
network
Schema Stitching: Before
ServerClient
ServerClient
ServerClient
Schema Stitching: After
Server
ServerClient
Server
Stitcher
launchpad.graphql.com/130rr3r49
Universe + Dark Sky
Jason Lengstorf, IBM
We needed a way to let multiple teams
create, test, and maintain GraphQL data
sources in isolation, but ultimately expose
them all as part of the same /graphql
endpoint on our platform.
ibm.biz/gramps-graphql
Abhi Aiyer, Workpop
We set out to work on a solution that would
combine our graphql services into one
schema. This allows the client to query APIs
across the system without worrying about
the address of any given downstream service.
apollographql.com/docs/graphql-tools/
schema-stitching.html
GraphQL Join by APIs.guru
https://blog.apis.guru/graphql-join-or-how-to-find-all-bars-a
round-graphql-summit-with-a-single-query-e2ebfe27c67c
DEVELOPER EXPERIENCE
Universal API for
the frontends
ARCHITECTURE
Modular, independently
deployed services
Client ServerGateway
Today: Single GraphQL api
Loads data from
GraphQL API
Talks to services
directly and massages
data into the schema
Caching, tracing, and
errors help you
improve your API
Client ServerGateway
Schema Stitching: Initial
Loads data from
GraphQL API, client
data, external sources
Automatically
combines GraphQL
backend services
(Still single codebase)
Helps understand the
complete system:
Tracing, errors
Client Gateway
Schema Stitching: Ideal
Loads data from
GraphQL API, client
data, external sources
Decoupled GraphQL
services describing
their own schema
Central arbiter. Stitches
backends, caches backend
results, and provides
detailed tracing and errors
Server
Server
Server
Stitching across teams
Gateway
User schema
Payment schema
Scheduling schema
Feed schema
Improve collaboration in an enterprise scenario
CLIENT QUERY
Sends detailed data
requirements
SERVER SCHEMA
Provides flexible,
performant capabilities
Conclusion
Continuously improving
1. CACHING
Load less data and save
resources
2. TRANSPARENCY
Understand what's
happening
3. MODULARITY
Combine parts into a
seamless whole
CLIENT
Apollo Client
GATEWAY
Apollo Engine
SERVER
Any GraphQL server
TOOLING
Devtools, editors
CLIENT
Apollo Client
GATEWAY
Apollo Engine
SERVER
Any GraphQL server
TOOLING
Devtools, editors
CACHING
TRACING
ERRORS
STITCHING
CLIENT
Apollo Client
GATEWAY
Apollo Engine
SERVER
Any GraphQL server
TOOLING
Devtools, editors
CACHING
TRACING
ERRORS
STITCHING
CLIENT
Apollo Client
GATEWAY
Apollo Engine
SERVER
Any GraphQL server
TOOLING
Devtools, editors
CACHING
TRACING
ERRORS
STITCHING
The NEXT THING?
What we see:
GraphQL is becoming a
transformative technology.
Taking GraphQL to
its full potential.
That's what we're all about.
Find me on Twitter/Medium/GitHub
@stubailo
Our newly relaunched site and docs
apollographql.com
Let's all build the future of GraphQL together!
apollographql.com/#slack
github.com/apollographql

More Related Content

PDF
Adding GraphQL to your existing architecture
PDF
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
PDF
GraphQL over REST at Reactathon 2018
PDF
Modular GraphQL with Schema Stitching
PDF
The Apollo and GraphQL Stack
PDF
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
PDF
GraphQL: The Missing Link Between Frontend and Backend Devs
PDF
React and GraphQL at Stripe
Adding GraphQL to your existing architecture
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
GraphQL over REST at Reactathon 2018
Modular GraphQL with Schema Stitching
The Apollo and GraphQL Stack
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
GraphQL: The Missing Link Between Frontend and Backend Devs
React and GraphQL at Stripe

What's hot (20)

PDF
Serverless GraphQL for Product Developers
PDF
GraphQL: Enabling a new generation of API developer tools
PDF
GraphQL + relay
PPT
Graphql presentation
PPTX
Taking Control of your Data with GraphQL
PDF
GraphQL
PDF
Graphql
PPTX
Into to GraphQL
PPTX
An intro to GraphQL
PPTX
GraphQL Introduction
PPTX
Introduction to GraphQL
PDF
REST vs GraphQL
PDF
GraphQL London January 2018: Graphql tooling
PDF
GraphQL & Relay
PDF
Better APIs with GraphQL
PDF
Intro to GraphQL
PDF
Performance optimisation with GraphQL
PDF
PDF
How to GraphQL
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Serverless GraphQL for Product Developers
GraphQL: Enabling a new generation of API developer tools
GraphQL + relay
Graphql presentation
Taking Control of your Data with GraphQL
GraphQL
Graphql
Into to GraphQL
An intro to GraphQL
GraphQL Introduction
Introduction to GraphQL
REST vs GraphQL
GraphQL London January 2018: Graphql tooling
GraphQL & Relay
Better APIs with GraphQL
Intro to GraphQL
Performance optimisation with GraphQL
How to GraphQL
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Ad

Similar to GraphQL across the stack: How everything fits together (20)

PDF
How easy (or hard) it is to monitor your graph ql service performance
PDF
Implementing OpenAPI and GraphQL services with gRPC
PPTX
GraphQL research summary
PDF
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
PDF
apidays LIVE Paris - GraphQL meshes by Jens Neuse
PPTX
Your API on Steroids
DOCX
Graphql for Frontend Developers Simplifying Data Fetching.docx
DOCX
How to Deploy a GraphQL API A Comprehensive Guide.docx
PPTX
GraphQL_devoxx_2023.pptx
PPTX
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
PPTX
Create GraphQL server with apolloJS
PDF
Exposing GraphQLs as Managed APIs
PDF
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
PDF
Boosting Data Fetching in Turkish Apps with React Native and GraphQL
PDF
Camunda GraphQL Extension (09/2017 Berlin)
PPTX
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
PDF
API Management for GraphQL
PDF
APIsecure 2023 - Learn how to attack and mitigate vulnerabilities in GraphQL,...
PDF
Scaling Your Team With GraphQL: Why Relationships Matter
PDF
Spring GraphQL
How easy (or hard) it is to monitor your graph ql service performance
Implementing OpenAPI and GraphQL services with gRPC
GraphQL research summary
Sashko Stubailo - The GraphQL and Apollo Stack: connecting everything together
apidays LIVE Paris - GraphQL meshes by Jens Neuse
Your API on Steroids
Graphql for Frontend Developers Simplifying Data Fetching.docx
How to Deploy a GraphQL API A Comprehensive Guide.docx
GraphQL_devoxx_2023.pptx
apidays LIVE Australia 2020 - Have your cake and eat it too: GraphQL? REST? W...
Create GraphQL server with apolloJS
Exposing GraphQLs as Managed APIs
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
Boosting Data Fetching in Turkish Apps with React Native and GraphQL
Camunda GraphQL Extension (09/2017 Berlin)
Optimization and fault tolerance in distributed transaction with Node.JS Grap...
API Management for GraphQL
APIsecure 2023 - Learn how to attack and mitigate vulnerabilities in GraphQL,...
Scaling Your Team With GraphQL: Why Relationships Matter
Spring GraphQL
Ad

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Nekopoi APK 2025 free lastest update
PPT
Introduction Database Management System for Course Database
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Transform Your Business with a Software ERP System
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
medical staffing services at VALiNTRY
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Online Work Permit System for Fast Permit Processing
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
AI in Product Development-omnex systems
PPTX
ai tools demonstartion for schools and inter college
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Odoo Companies in India – Driving Business Transformation.pdf
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Nekopoi APK 2025 free lastest update
Introduction Database Management System for Course Database
PTS Company Brochure 2025 (1).pdf.......
Transform Your Business with a Software ERP System
Wondershare Filmora 15 Crack With Activation Key [2025
medical staffing services at VALiNTRY
L1 - Introduction to python Backend.pptx
Operating system designcfffgfgggggggvggggggggg
How to Choose the Right IT Partner for Your Business in Malaysia
Softaken Excel to vCard Converter Software.pdf
Online Work Permit System for Fast Permit Processing
How Creative Agencies Leverage Project Management Software.pdf
AI in Product Development-omnex systems
ai tools demonstartion for schools and inter college

GraphQL across the stack: How everything fits together