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
GraphQL à Shopify
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Marc-Andre Giroux
April 05, 2017
Programming
290
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
GraphQL à Shopify
Marc-Andre Giroux
April 05, 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
Exploring GraphQL
xuorig
0
310
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
自作OSでスライド発表する
uyuki234
1
3.9k
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
230
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
150
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
270
ランチタイムLT会3周年!ランチタイムLT会を3年間続けられたお話
y0hgi
1
150
なぜ型を書くのか? TSKaigi2026で改めて考える #tskaigi_smarthr
kajitack
0
390
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
180
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.2k
ITヒヤリハットを整理してみた ~ライフサイクルと原因から考える再発防止策~
koukimiura
1
110
【SRE NEXT 2026 Lunch Session】一人目専任SREの立ち上げを加速する ― AIと進めたオンボーディングで2分を0.04秒にした話
pkshadeck
PRO
0
2.9k
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
320
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
1.3k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Scaling GitHub
holman
464
140k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
150
Building an army of robots
kneath
306
46k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
210
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
How STYLIGHT went responsive
nonsquared
100
6.2k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
370
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Ruling the World: When Life Gets Gamed
codingconduct
0
290
The Cult of Friendly URLs
andyhume
79
7k
The Spectacular Lies of Maps
axbom
PRO
1
870
Transcript
GraphQL @ Shopify Marc-André Giroux @__xuorig__
None
None
None
@__xuorig__ Les APIs REST sont
@__xuorig__ Sauf quand ils sont
@__xuorig__ Des allers-retours multiples... C'est pas idéal.
@__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__ Qu'est-ce que nos clients utilisent vraiment?
@__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__ Un type spécial de base de données.
@__xuorig__ Une librairie ou un framework
@__xuorig__ Pas spécifique à un langage.
@__xuorig__ Langage de requête
@__xuorig__ &
@__xuorig__ Une Specification.
@__xuorig__ Un "Hello World" GraphQL
@__xuorig__ query { film { title } }
@__xuorig__ Anatomie d'une requête GraphQL.
@__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__ "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__ query MyQuery { film { title } }
@__xuorig__ curl -X POST -d '{"query": "query MyQuery { film
{ title } }"}' http:// mongraphql.com/api --header "Content-Type:application/json"
@__xuorig__ curl -X POST -d '{"query": "query MyQuery { film
{ title } }"}' http:// mongraphql.com/api --header "Content-Type:application/json"
@__xuorig__ { film(id: "123") { title characters { name }
} }
@__xuorig__ Query film title characters name
@__xuorig__ Le 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 == Des clients avec des super pouvoirs!
@__xuorig__ • AutoSaisie • Validation côté client. • Intégration dans
nos IDE. • Génération de code.
@__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__ Gestion des versions.
@__xuorig__ Versioning Continuous Evolution
@__xuorig__ Sécurité?
@__xuorig__ • Maximum Depth • Query Complexity • Timeout
@__xuorig__ Je perds ma cache HTTP? ;(
@__xuorig__ POST /graphql
@__xuorig__ • Cache côté client • Requête persistées
@__xuorig__ Requêtes persistées
@__xuorig__ Requêtes persistées query MyQuery { film { title }
} Yo. c'est possible que j'utilise cette requête plus tard!
@__xuorig__ Requêtes persistées Cool pas de prob, envoie moi "abcd"
et je l'exécuterai pour toi
@__xuorig__ Requêtes persistées J'ai besoin de "abcd"!
@__xuorig__ Requêtes persistées "data": { "film": { "title": "A New
Hope" } }
@__xuorig__ GraphQL @ Shopify
@__xuorig__ Définir les types module GraphApi class Shop < GraphApi::ObjectType
field :name, :string field :currency, :string, null: false field :products, [Product], resolve: ->(shop, _, _) { shop.products } end end
@__xuorig__ type Shop { name: String currency: String! products: [Product!]
}
@__xuorig__ • Client Side Cache • Persisted Queries Le Schema
est "Checked In"
@__xuorig__ Et doit toujours être régénéré!
@__xuorig__ On prévient les "breaking changes"
@__xuorig__ Et on force les bonnes pratiques!
@__xuorig__ GraphQL est
@__xuorig__ A Un seul allez-retour pour récupérer tout se qu'un
client à besoin.
@__xuorig__ Declaratif et predictible. (plus besoin de notre fameux SELECT
*)
@__xuorig__ Le serveur exprime les possibilités.
@__xuorig__ Les clients définissent leurs besoins.
@__xuorig__ separation of concerns!
@__xuorig__ DX
@__xuorig__ DX (Developer Experience)
@__xuorig__ On "ship" plus rapidement
@__xuorig__ Et tout le monde est heureux.
Merci! Marc-André Giroux @__xuorig__