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
Exploring GraphQL
Search
Marc-Andre Giroux
March 09, 2017
Programming
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Exploring GraphQL
Marc-Andre Giroux
March 09, 2017
More Decks by Marc-Andre Giroux
See All by Marc-Andre Giroux
It Depends - Examining GraphQL Myths & Assumptions
xuorig
0
140
So you Want to Distribute your GraphQL Schema?
xuorig
4
880
So you Want to Distribute your GraphQL Schema?
xuorig
0
690
GraphQL Schema Design @ Scale
xuorig
5
2.2k
Continuous Evolution of GraphQL Schemas @ GitHub
xuorig
3
2.2k
GraphQL à Shopify
xuorig
0
290
GraphQL @ Shopify
xuorig
6
1.8k
GraphQL on Rails
xuorig
2
400
From REST to GraphQL
xuorig
9
1.3k
Other Decks in Programming
See All in Programming
はてなアカウント基盤 State of the Union
cockscomb
1
1.3k
【やさしく解説 設計編・中級 #1】一つの車に、運転手は一人 ~ある倉庫システムの事例から~
panda728
PRO
0
190
フィードバックで育てるAI開発
kotaminato
1
120
技術記事、 専門家としてのプログラマ、 言語化
mizchi
14
7.5k
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
170
1年で人数1.5倍、PR数5.5倍増。 品質とアウトカムはどうなったか、 何が効いたか
ike002jp
0
140
壊れたパーサから始める関数型設計と構成的なパーサ #fp_matsuri
raiga0310
2
380
信頼性について考えてみる(SRE NEXT 2026 miniLT)
hayama17
0
200
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.6k
えっ!!コードを読まずに開発を!?
hananouchi
0
230
symfony/aiとlaravel/boost
77web
0
140
継続モナドとリアクティブプログラミング
yukikurage
3
620
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Faster Mobile Websites
deanohume
310
32k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
220
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
220
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
900
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Navigating Team Friction
lara
192
16k
How to Talk to Developers About Accessibility
jct
2
420
Believing is Seeing
oripsolob
1
170
Paper Plane (Part 1)
katiecoart
PRO
1
9.7k
Transcript
Exploring GraphQL Marc-André Giroux @__xuorig__
None
None
None
@__xuorig__ REST APIs are Great.
@__xuorig__ Except when they're not.
@__xuorig__ Multiple round-trips are not ideal.
@__xuorig__ GET /people/1 GET /planet/2 GET /film/3
@__xuorig__ SELECT * FROM /ENDPOINT
@__xuorig__ GET /people/1 { "person": { "name": "luke" } }
@__xuorig__ { "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color":
"blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "http://swapi.co/api/ planets/1/", "films": [ "http://swapi.co/api/films/6/", "http://swapi.co/api/films/3/", "http://swapi.co/api/films/2/", "http://swapi.co/api/films/1/", "http://swapi.co/api/films/7/" ],
@__xuorig__ What do clients even use?
@__xuorig__ { "name": "Luke Skywalker", "height": "172", "mass": "77", "hair_color":
"blond", "skin_color": "fair", "eye_color": "blue", "birth_year": "19BBY", "gender": "male", "homeworld": "http://swapi.co/api/ planets/1/", "films": [ "http://swapi.co/api/films/6/", "http://swapi.co/api/films/3/", "http://swapi.co/api/films/2/", "http://swapi.co/api/films/1/", "http://swapi.co/api/films/7/" ],
GraphQL
@__xuorig__ A special type of database.
@__xuorig__ A library.
@__xuorig__ A Query Langage.
@__xuorig__ &
@__xuorig__ A Spec for servers to execute GraphQL Queries.
@__xuorig__ A GraphQL Hello World.
@__xuorig__ query { film { title } }
@__xuorig__ Anatomy of a GraphQL Query
@__xuorig__ query MyQuery { film { title } }
@__xuorig__ query MyQuery { film { title } } Operation
Type
@__xuorig__ query MyQuery { film { title } } Operation
Name
@__xuorig__ query MyQuery { film { title } } Selection
Set
@__xuorig__ query MyQuery { film { title } } Field
@__xuorig__ • Lexed • Parsed • Validated • Executed
@__xuorig__ "data": { "film": { "title": "A New Hope" }
}
@__xuorig__ query { film(id: "123") { title } }
@__xuorig__ query { film(id: "123") { title characters { name
} } }
@__xuorig__ "data": { "film": { "title": "A New Hope", "characters":
[ { "name": "Luke Skywalker" }, { "name": "Princess Leia" } ] } }
@__xuorig__ The Type System.
@__xuorig__ { film(id: "123") { title characters { name }
} }
@__xuorig__ { film(id: "123") { title characters { name }
} } type QueryRoot { film(id: ID!): Film }
@__xuorig__ { film(id: "123") { title characters { name }
} } type Film { title: String! characters: [Character!]! }
@__xuorig__ { film(id: "123") { title characters { name }
} } type Character { name: String! }
@__xuorig__ Introspection.
@__xuorig__ { __schema { types { name } } }
@__xuorig__ { __type(name: "Film") { name description } }
@__xuorig__ Introspection == Clients with Super Powers
@__xuorig__ • AutoComplete • Client side validation • IDE Integration
• Code Generation
@__xuorig__ GraphiQL
@__xuorig__
@__xuorig__ swapi-graphql-ruby.herokuapp.com
Mutations
@__xuorig__ mutation { addFilm(name: "StarWars 8") { title } }
Fragments
@__xuorig__ query { film(id: "123") { title characters { name
} } bestRatedfilm { title characters { name } } }
@__xuorig__ query { film(id: "123") { title characters { name
} } bestRatedfilm { title characters { name } } }
@__xuorig__ fragment filmFragment on Film { title characters { name
} }
@__xuorig__ query { film(id: "123") { ...filmFragment } bestRatedfilm {
...filmFragment } } fragment filmFragment on Film { title characters { name } }
@__xuorig__ Versioning
@__xuorig__ Versioning Continuous Evolution
@__xuorig__ What about Security ?
@__xuorig__ • Maximum Depth • Query Complexity • Timeout
@__xuorig__ My HTTP Caching :( !
@__xuorig__ • Client Side Cache • Persisted Queries
@__xuorig__ GraphQL is Great.
@__xuorig__ A single roundtrip to fetch exactly what a client
needs.
@__xuorig__ Declarative and predictable. (no more SELECT *)
@__xuorig__ Servers express possibilities.
@__xuorig__ Clients define requirements.
@__xuorig__ That's real separation of concerns!
@__xuorig__ Great developer experience.
@__xuorig__ It makes us ship faster.
@__xuorig__ An everyone is happy.
Thank you! Marc-André Giroux @__xuorig__