SlideShare a Scribd company logo
1 of 30
@mauroservienti#webappconf17
GraphQL
Where are you from? Where are you going?
(1 fiorino, cit.)
@mauroservienti#webappconf17
we have no control over
@mauroservienti#webappconf17
We go on thinking to…
1. APIs to represent requests and actions
2. Models exchanged with clients
@mauroservienti#webappconf17
API
(e.g. Rest over HTTP)
Response
Request
Model
Client
Hard to evolve
monolith(s)
@mauroservienti#webappconf17
Rest + HTTP
semantic is not
good enough
@mauroservienti#webappconf17
Let me introduce you GraphQL
@mauroservienti#webappconf17
Describe
@mauroservienti#webappconf17
Describe
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Describe
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Describe
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Describe
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Describe
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Ask
@mauroservienti#webappconf17
Ask
{
product( id: 123 ),
title,
unitPrice: {
value,
currency
},
stars,
bestReview: reviews( quality: best ){
title
},
worstReview: reviews( quality: worst ){
title
}
}
@mauroservienti#webappconf17
Ask
{
product( id: 123 ),
title,
unitPrice: {
value,
currency
},
stars,
bestReview: reviews( quality: best ){
title
},
worstReview: reviews( quality: worst ){
title
}
}
@mauroservienti#webappconf17
Ask
{
product( id: 123 ),
title,
unitPrice: {
value,
currency
},
stars,
bestReview: reviews( quality: best ){
title
},
worstReview: reviews( quality: worst ){
title
}
}
@mauroservienti#webappconf17
Use
{
id: 123,
title: ‘portabanana’,
unitPrice: {
10,
Euro
},
stars: 3.8,
bestReview: [{
title: ‘meraviglioso mi ha cambiato la vita’
}],
worstReview: [{
title: ‘a me mi pare una…’
}]
}
@mauroservienti#webappconf17
Act
@mauroservienti#webappconf17
Act
mutation{
post: addToCart(
id: 123,
quantity: 2
){
cartId,
itemTotalPrice,
cartTotalPrice
}
}
@mauroservienti#webappconf17
Act
mutation{
post: addToCart(
id: 123,
quantity: 2
){
cartId,
itemTotalPrice,
cartTotalPrice
}
}
@mauroservienti#webappconf17
Act
mutation{
post: addToCart(
id: 123,
quantity: 2
){
cartId,
itemTotalPrice,
cartTotalPrice
}
}
@mauroservienti#webappconf17
Act
mutation{
post: addToCart(
id: 123,
quantity: 2
){
cartId,
itemTotalPrice,
cartTotalPrice
}
}
response
@mauroservienti#webappconf17
Systems evolution
@mauroservienti#webappconf17
Non-breaking / additive
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
}
@mauroservienti#webappconf17
Non-breaking / additive
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
customersAlsoBuy: [Product]
}
@mauroservienti#webappconf17
Breaking
type Product {
id: string,
title: string,
description: string,
unitPrice: price,
delivery: deliveryEnum,
weight: float,
stars: float,
reviews: [{
title: string,
quality: sentimentEnum,
text: string,
}]
customersAlsoBuy: [Product]
}
@mauroservienti#webappconf17
Breaking
const resolverMap = {
Product: {
customersAlsoBuy( obj, args, context, info ){
//do whatever you want :)
return ….;
},
},
};
@mauroservienti#webappconf17
Recap
• It’s a specification, not an implementation
• Clients, within schema bounds, decide what they
want
• When schema evolves services can easily be
backward compatible
• A Node.js reference implementation is provided
• @ graphql.org:
• Samples
• Implementations for different stacks (graphql.org/code/)
• Intro tutorials and guidance
@mauroservienti#webappconf17
Mauro Servienti
Solution Architect @ Particular Software
makers of NServiceBus
mauro.servienti@particular.net
//blogs.ugidotnet.org/topics
//milestone.topics.it
@mauroservienti#webappconf17
Thank you!

More Related Content

Similar to GraphQL - Where are you from? Where are you going?

Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
Woody Pewitt
 
Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...
Matteo Collina
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
Robert Nyman
 

Similar to GraphQL - Where are you from? Where are you going? (20)

Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
Crafting Quality PHP Applications (Bucharest Tech Week 2017)Crafting Quality PHP Applications (Bucharest Tech Week 2017)
Crafting Quality PHP Applications (Bucharest Tech Week 2017)
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
React Internals - Batching Write Operations by tree Traversal
React Internals - Batching Write Operations by tree TraversalReact Internals - Batching Write Operations by tree Traversal
React Internals - Batching Write Operations by tree Traversal
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Is your C# optimized
Is your C# optimizedIs your C# optimized
Is your C# optimized
 
Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...
 
RIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWTRIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWT
 
Javascript leverage: Isomorphic Applications by Luciano Colosio at Codemotion...
Javascript leverage: Isomorphic Applications by Luciano Colosio at Codemotion...Javascript leverage: Isomorphic Applications by Luciano Colosio at Codemotion...
Javascript leverage: Isomorphic Applications by Luciano Colosio at Codemotion...
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
 
Domain Driven Rails
Domain Driven RailsDomain Driven Rails
Domain Driven Rails
 
Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu Getting Started With Kotlin Development - Rivu
Getting Started With Kotlin Development - Rivu
 
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference ZürichHTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
HTML5 and CSS3 – exploring mobile possibilities - Frontend Conference Zürich
 
MVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire LhotelierMVC-RS par Grégoire Lhotelier
MVC-RS par Grégoire Lhotelier
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Playing With The Web
Playing With The WebPlaying With The Web
Playing With The Web
 
Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)Crafting Quality PHP Applications (ConFoo YVR 2017)
Crafting Quality PHP Applications (ConFoo YVR 2017)
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - Workshop
 
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)Crafting Quality PHP Applications: an overview (PHPSW March 2018)
Crafting Quality PHP Applications: an overview (PHPSW March 2018)
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 

More from Mauro Servienti

More from Mauro Servienti (20)

Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019Welcome to the (state) machine @ ExploreDDD 2019
Welcome to the (state) machine @ ExploreDDD 2019
 
Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019
 
Welcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise ApplicationsWelcome to the (state) machine @ Xe One Day Enterprise Applications
Welcome to the (state) machine @ Xe One Day Enterprise Applications
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better Parma
 
Welcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted SoftwareWelcome to the (state) machine @ Crafted Software
Welcome to the (state) machine @ Crafted Software
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT Better
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservices
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the po
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i Microservices
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messages
 
La via verso SOA è lastricata di messaggi
La via verso SOA è lastricata di messaggiLa via verso SOA è lastricata di messaggi
La via verso SOA è lastricata di messaggi
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

GraphQL - Where are you from? Where are you going?

Editor's Notes

  1. Inventato da Facebook. Hanno dichiarato di non aver introdotto una sola breaking change negli ultimi 2 anni Recentemente adottato da GitHub
  2. Se non avete controllo sui client (fai un esempio) il vostro peggior incubo sono le breaking change, in caso contrario il problema è molto relativo. È molto semplice non ve le potete permettere. Fine de giochi. Diciamo che in sistemi enormi (Amazon, Facebook, GitHub, i Bancomat nel mondo) possiamo dire che siamo esattamente in questa situazione Avete quindi il problema che il business evolve, quindi i servizi evolvono e i client (o in generale chi interroga una API) non sono sotto il vostro controllo la conseguenza è che in un dato momento T è molto probabile che un client non sia in grado di consumare una API che è cambiata
  3. Attenzione che addictive o branching evolution non sono mai un problema, la rimozione di informazioni e quindi la contrazione dello schema è una disruptive change, che implica un profondo cambiamento nel business.
  4. I metadati
  5. I metadati
  6. I metadati
  7. I metadati Tipi che a loro volta possono essere custom type
  8. I metadati Altre informazioni semplici
  9. I metadati E infine un nuovo tipo complesso, che dichiara una «releazione» 1 -> n
  10. Notate il salto di qualità? La semantica anche nelle query
  11. Mutations
  12. Mutations
  13. Che cosa voglio fare
  14. Con quali informazioni
  15. Che cosa voglio come risposta
  16. Allo stesso modo la cooperazione avviene sulle mutation
  17. Se non avete controllo sul client non potete sperare di dettare cosa il client vuole, è il client che decide Quello che potete fare quindi è: definire lo schema Dare ad ogni servizio la possibilità di partecipare nella costruzione della risposta o nell’esecuzione della mutazione A questo il client, nei limiti dello schema, può decidere cosa vuole Se lo schema evolve i servizi possono garantire retrocompatibilità per la loro parte
  18. domande