Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Introduction to GraphQL (Reactathon)
Search
jnwng
March 20, 2018
Technology
0
160
Introduction to GraphQL (Reactathon)
Talk given at Reactathon 2018 3/20/2018
jnwng
March 20, 2018
Tweet
Share
More Decks by jnwng
See All by jnwng
Evolving the Graph
jnwng
1
260
An Introduction to GraphQL (ReactJS SF Bay Area)
jnwng
0
120
Providing Flexibility Through Constraint
jnwng
0
63
Introduction to GraphQL
jnwng
1
520
Going GraphQL First - ReactSF
jnwng
0
170
Going GraphQL First
jnwng
5
700
keeping up with javascript
jnwng
3
1k
Presentations 101
jnwng
1
220
SViOS Meetup: HTTP Live Streaming
jnwng
2
400
Other Decks in Technology
See All in Technology
さくらのIaaS基盤のモニタリングとOpenTelemetry/OSC Hokkaido 2025
fujiwara3
2
230
「良さそう」と「とても良い」の間には 「良さそうだがホンマか」がたくさんある / 2025.07.01 LLM品質Night
smiyawaki0820
1
430
20250625 Snowflake Summit 2025活用事例 レポート / Nowcast Snowflake Summit 2025 Case Study Report
kkuv
1
370
Github Copilot エージェントモードで試してみた
ochtum
0
130
AWS Organizations 新機能!マルチパーティ承認の紹介
yhana
1
220
Zephyr RTOSを使った開発コンペに参加した件
iotengineer22
0
130
Claude Code Actionを使ったコード品質改善の取り組み
potix2
PRO
6
2.6k
250627 関西Ruby会議08 前夜祭 RejectKaigi「DJ on Ruby Ver.0.1」
msykd
PRO
2
370
How Community Opened Global Doors
hiroramos4
PRO
1
130
KubeCon + CloudNativeCon Japan 2025 Recap Opening & Choose Your Own Adventureシリーズまとめ
mmmatsuda
0
230
fukabori.fm 出張版: 売上高617億円と高稼働率を陰で支えた社内ツール開発のあれこれ話 / 20250704 Yoshimasa Iwase & Tomoo Morikawa
shift_evolve
PRO
1
110
Should Our Project Join the CNCF? (Japanese Recap)
whywaita
PRO
0
290
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
How GitHub (no longer) Works
holman
314
140k
A better future with KSS
kneath
239
17k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
How to Think Like a Performance Engineer
csswizardry
24
1.7k
RailsConf 2023
tenderlove
30
1.1k
Side Projects
sachag
455
42k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.4k
Become a Pro
speakerdeck
PRO
28
5.4k
Why You Should Never Use an ORM
jnunemaker
PRO
58
9.4k
Transcript
An Introduction To GraphQL Reactathon, March 20, 2018
Jon Wong Frontend Infrastructure, Coursera @jnwng 2
Runtime ▪ Clients ▪ Servers ▪ Tools What We’re Covering
in GraphQL Language ▪ Schemas ▪ Queries 3
What is GraphQL? Taken straight from GraphQL.org
Describe your Data type Project { name: String tagline: String
contributors: [User] } 5
Ask for What You Want query { project(name: "GraphQL") {
tagline } } 6
Get Predictable Results query { project(name: "GraphQL") { tagline }
} 7 { "project": { "tagline": "A query language for APIs" } }
Schemas Describing possible data
Describe everything that is possible ▪ All possible data results
are described by the server. 9
Validation ▪ Every query is validated against the GraphQL schema
▪ No runtime errors for query documents 10
The GraphQL Schema gives us the basis of everything that
is possible when communicating to the server from the client. 11
Queries Reading your data
13 A simple query query { project(name: "GraphQL") { tagline
} } { "project": { "tagline": "A query language for APIs" } }
14 A simple query query { project(name: "GraphQL") { tagline
author } } { "project": { "tagline": "A query language for APIs", “author”: “jnwng” } }
Fragments fragment MyFancyFragment on MyResource { someField } 15 These
are required!
Spreading a fragment in a query query { someResource {
...MyFancyFragment } } 16 These two types should match
17 A typical React application
18 … broken down into components ...
19 A complex query
20 A complex query
21 A complex query query CoursePage { course(slug: “Machine Learning”)
{ title description ...University ...Instructor } }
22 ▪ Components can be more portable ▪ Components are
more self-sufficient. Every component can declare its own data requirements
GraphQL queries allow the client to declare exactly what it
needs, in the form that it needs it in. 23
Clients Managing your data
Clients make it easier to manage data Relay Apollo 25
Caching ▪ Clients provide advanced caching for GraphQL queries. 26
Caching query ListView { allBooks { id name } }
27 query DetailView ($id: ID) { bookById(id: $id) { name } }
Clients make adopting GraphQL in your application a breeze. 28
Servers Serving your data
Mapping types to resolvers 30 const schemaDefinition = ` type
Query { books: [Book] } type Book { title: String author: String } `; const resolvers = { Query: { books: () => fetch('https://api.com/books') }, };
Every field can be resolved separately. 31 const resolvers =
{ Query: { books: () => fetch('https://api.com/books') }, Book: { title: () => return ‘The book title’, author: () => fetch(‘https://api.com/authors’) } };
A single endpoint for data from anywhere { books {
title author } } 32
GraphQL servers are flexible 33 ▪ They can act as
proxies to existing data ▪ They can also act as the business logic layer itself
Tools Supercharging your data
GraphiQL 35
`eslint-plugin-graphql` 36 Catch invalid API calls at compile-time
`apollo-codegen` 37 Catch runtime errors at compile-time
GraphQL enables an entire ecosystem of tools to make developers
more effective. 38
▪ GraphQL makes it really simple to query lots of
data, no matter where it is. 39 In Summary
▪ Just like React, GraphQL can break down complexity into
composable, reusable pieces 40 In Summary
▪ GraphQL.org ▪ GraphQL.com ▪ https://launchpad.graphql.com/ new 41 How to
Get Started
THANKS! 42 @jnwng Presentation template by SlidesCarnival