SlideShare a Scribd company logo
1 of 32
Download to read offline
ConfidentialConfidential
GraphQL 101
An introduction to GraphQL
ConfidentialConfidentialGraphQL 101 | @engfragui
Francesca
Guiducci
Backend
SoftwareEngineer
@engfragui
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
REST
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
REST API
ConfidentialConfidentialGraphQL 101 | @engfragui
ConfidentialConfidentialGraphQL 101 | @engfragui
/book/12345
/author/6666
/bookpic/12345
/recommendedbooks/12345
/bookquotes/12345
/bookreviews/12345
1. Multiple calls
2. Over-fetching
ConfidentialConfidentialGraphQL 101 | @engfragui
/bookpage/12345
/bookpagewithoutdescription/12345
/bookpagewithoutdescriptionbutwithtwopictures/12345
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
We would really
need an alternative
to REST that gets rid
of all those issues
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Query language to
select exactly what
you want
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
“One endpoint to
rule them all”
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
How will my
architecture look
like?
ConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL server
GraphQL client
Datasource
ConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL client REST API
GraphQL client
GraphQL client
REST API
REST API
GraphQL server
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL Schema
Definition
ConfidentialConfidentialGraphQL 101 | @engfragui
schema {
query: Query
}
type Query {
book(isbn: String!): Book
}
type Book {
id: String
isbn: String
title: String
author: Author
review: Review
}
type Author {
id: String
name: String
}
type Review {
id: String
stars: Int
content: String
}
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL Operations
17
• Queries
• Mutations
• Subscriptions
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Queries
ConfidentialConfidentialGraphQL 101 | @engfragui
query {
book(id: “88888”) {
id
isbn
title
author {
name
}
}
}
“data”: {
“book”: {
“id”: “88888”,
“isbn”: “0618346252”,
“title”: “The Fellowship of the King”,
“author”: {
“name”: “J.R.R. Tolkien”
}
}
}
request
response
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Mutations
ConfidentialConfidentialGraphQL 101 | @engfragui
mutation {
updateBook (
id: “88888”,
title: “The Fellowship of the Ring”
) {
id
title
}
}
“data”: {
“book”: {
“id”: “88888”,
“title”: “The Fellowship of the Ring”
}
}
request
response
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Subscriptions
ConfidentialConfidentialGraphQL 101 | @engfragui
subscription {
likesUpdated {
id
title
likes
}
}
“data”: {
“likesUpdated”: [
{
“id”: “88888”,
“title”: “The Fellowship of the Ring”
“likes”: 57
},
{
“id”: “99999”,
“title”: “A Game of Thrones”
“likes”: 52
}
]
}
request
response
ConfidentialConfidentialGraphQL 101 | @engfragui
subscription {
likesUpdated {
id
title
likes
}
}
“data”: {
“likesUpdated”: [
{
“id”: “88888”,
“title”: “The Fellowship of the Ring”
“likes”: 57
},
{
“id”: “99999”,
“title”: “A Game of Thrones”
“likes”: 53
}
]
}
request
response
ConfidentialConfidentialGraphQL 101 | @engfragui
Demo
github.com/engfragui/simple-graphql-server
ConfidentialConfidentialGraphQL 101 | @engfragui
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Drawbacks
And possible solutions
ConfidentialConfidentialGraphQL 101 | @engfragui
Many queries to data layer Batchingsolve by
No “out of the box”
HTTP caching
solve by
Normalized cache
Malicious queries
Timeout or limit
query depth
solve by
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
GraphQL Recap
• Query language alternative to REST
• Operations | Queries, mutations, subscriptions
• Drawbacks and possible solutions
ConfidentialConfidentialGraphQL 101 | @engfragui
Resources
§ GraphQL official documentation
§ Zero to GraphQL in 30 Minutes
§ From REST to GraphQL
§ Beyond REST: Coursera's Journey to GraphQL
§ Wrapping a REST API in GraphQL
§ Under the Hood of The Times Website
§ REST versus GraphQL
§ Mental models for teaching GraphQL
§ Making mistakes with GraphQL
§ GraphQL for iOS Developers
§ GraphQL Talks
ConfidentialConfidentialConfidentialGraphQL 101 | @engfragui
Thank you
ConfidentialConfidentialGraphQL 101 | @engfragui
Francesca
Guiducci
Backend
SoftwareEngineer
@engfragui

More Related Content

Similar to GraphQL 101 | An introduction to the world of GraphQL

What is the cost of a secret
What is the cost of a secretWhat is the cost of a secret
What is the cost of a secretLibbySchulze
 
MotiFinder: locating motifs in the human genome
MotiFinder:  locating motifs in the human genomeMotiFinder:  locating motifs in the human genome
MotiFinder: locating motifs in the human genomeJerome Nilmeier
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLLuca Galasso
 
Pentest Application With GraphQL | Null Bangalore Meetup
Pentest Application With GraphQL | Null Bangalore Meetup Pentest Application With GraphQL | Null Bangalore Meetup
Pentest Application With GraphQL | Null Bangalore Meetup Divyanshu
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchNikolas Burk
 
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyHarnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyAndré Ricardo Barreto de Oliveira
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouJohn Anderson
 
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred PercentTesting GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred PercentRoy Derks
 
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresInterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresiMasters
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLRoy Derks
 
Take a Groovy REST
Take a Groovy RESTTake a Groovy REST
Take a Groovy RESTRestlet
 
Reactive Applications in Enterprise Java
Reactive Applications in Enterprise JavaReactive Applications in Enterprise Java
Reactive Applications in Enterprise JavaOPEN KNOWLEDGE GmbH
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018artgillespie
 
Nikita Galkin "Looking for the right tech stack for GraphQL application"
Nikita Galkin "Looking for the right tech stack for GraphQL application"Nikita Galkin "Looking for the right tech stack for GraphQL application"
Nikita Galkin "Looking for the right tech stack for GraphQL application"Fwdays
 
Introduction to Graph QL
Introduction to Graph QLIntroduction to Graph QL
Introduction to Graph QLDeepak More
 
Introduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SFIntroduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SFAmazon Web Services
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro outputTom Chen
 

Similar to GraphQL 101 | An introduction to the world of GraphQL (20)

What is the cost of a secret
What is the cost of a secretWhat is the cost of a secret
What is the cost of a secret
 
MotiFinder: locating motifs in the human genome
MotiFinder:  locating motifs in the human genomeMotiFinder:  locating motifs in the human genome
MotiFinder: locating motifs in the human genome
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
Pentest Application With GraphQL | Null Bangalore Meetup
Pentest Application With GraphQL | Null Bangalore Meetup Pentest Application With GraphQL | Null Bangalore Meetup
Pentest Application With GraphQL | Null Bangalore Meetup
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, GermanyHarnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
Harnessing The Power of Search - Liferay DEVCON 2015, Darmstadt, Germany
 
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To YouLogs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
Logs Are Magic: Why Git Workflows and Commit Structure Should Matter To You
 
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred PercentTesting GraphQL in Your JavaScript Application: From Zero to Hundred Percent
Testing GraphQL in Your JavaScript Application: From Zero to Hundred Percent
 
CDI: How do I ?
CDI: How do I ?CDI: How do I ?
CDI: How do I ?
 
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan SoaresInterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
InterCon 2017 - Tudo o que você quer saber sobre GraphQL - Ubiratan Soares
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Wrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQLWrapping and Securing REST APIs with GraphQL
Wrapping and Securing REST APIs with GraphQL
 
Take a Groovy REST
Take a Groovy RESTTake a Groovy REST
Take a Groovy REST
 
Reactive Applications in Enterprise Java
Reactive Applications in Enterprise JavaReactive Applications in Enterprise Java
Reactive Applications in Enterprise Java
 
PostgreSQL Open SV 2018
PostgreSQL Open SV 2018PostgreSQL Open SV 2018
PostgreSQL Open SV 2018
 
Nikita Galkin "Looking for the right tech stack for GraphQL application"
Nikita Galkin "Looking for the right tech stack for GraphQL application"Nikita Galkin "Looking for the right tech stack for GraphQL application"
Nikita Galkin "Looking for the right tech stack for GraphQL application"
 
Introduction to Graph QL
Introduction to Graph QLIntroduction to Graph QL
Introduction to Graph QL
 
Introduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SFIntroduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SF
 
Elasticsearch intro output
Elasticsearch intro outputElasticsearch intro output
Elasticsearch intro output
 

Recently uploaded

Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaHostedbyConfluent
 
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQL
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQLBuild Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQL
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQLHostedbyConfluent
 
Brick-by-Brick: Exploring the Elements of Apache Kafka®
Brick-by-Brick: Exploring the Elements of Apache Kafka®Brick-by-Brick: Exploring the Elements of Apache Kafka®
Brick-by-Brick: Exploring the Elements of Apache Kafka®HostedbyConfluent
 
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdfREFASHIOND
 
Event-Driven Microservices: Back to the Basics
Event-Driven Microservices: Back to the BasicsEvent-Driven Microservices: Back to the Basics
Event-Driven Microservices: Back to the BasicsHostedbyConfluent
 
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdf
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdfWeb Development Solutions 2024 A Beginner's Comprehensive Handbook.pdf
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdfSeasia Infotech
 
Real-time Geospatial Aircraft Monitoring Using Apache Kafka
Real-time Geospatial Aircraft Monitoring Using Apache KafkaReal-time Geospatial Aircraft Monitoring Using Apache Kafka
Real-time Geospatial Aircraft Monitoring Using Apache KafkaHostedbyConfluent
 
How to Build an Event-based Control Center for the Electrical Grid
How to Build an Event-based Control Center for the Electrical GridHow to Build an Event-based Control Center for the Electrical Grid
How to Build an Event-based Control Center for the Electrical GridHostedbyConfluent
 
Data Contracts In Practice With Debezium and Apache Flink
Data Contracts In Practice With Debezium and Apache FlinkData Contracts In Practice With Debezium and Apache Flink
Data Contracts In Practice With Debezium and Apache FlinkHostedbyConfluent
 
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...HostedbyConfluent
 
Introduction to Cybersecurity | IIT(BHU)CyberSec
Introduction to Cybersecurity | IIT(BHU)CyberSecIntroduction to Cybersecurity | IIT(BHU)CyberSec
Introduction to Cybersecurity | IIT(BHU)CyberSecYashSomalkar
 
Transcript: Book industry state of the nation 2024 - Tech Forum 2024
Transcript: Book industry state of the nation 2024 - Tech Forum 2024Transcript: Book industry state of the nation 2024 - Tech Forum 2024
Transcript: Book industry state of the nation 2024 - Tech Forum 2024BookNet Canada
 
Book industry state of the nation 2024 - Tech Forum 2024
Book industry state of the nation 2024 - Tech Forum 2024Book industry state of the nation 2024 - Tech Forum 2024
Book industry state of the nation 2024 - Tech Forum 2024BookNet Canada
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformHostedbyConfluent
 
Case Study: Implementing a Data Mesh at NORD/LB
Case Study: Implementing a Data Mesh at NORD/LBCase Study: Implementing a Data Mesh at NORD/LB
Case Study: Implementing a Data Mesh at NORD/LBHostedbyConfluent
 
Modifying Your SQL Streaming Queries on the Fly: The Impossible Trinity
Modifying Your SQL Streaming Queries on the Fly: The Impossible TrinityModifying Your SQL Streaming Queries on the Fly: The Impossible Trinity
Modifying Your SQL Streaming Queries on the Fly: The Impossible TrinityHostedbyConfluent
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyHostedbyConfluent
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonHostedbyConfluent
 

Recently uploaded (20)

Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and Kafka
 
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQL
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQLBuild Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQL
Build Copilots on Streaming Data with Generative AI, Kafka Streams and Flink SQL
 
Brick-by-Brick: Exploring the Elements of Apache Kafka®
Brick-by-Brick: Exploring the Elements of Apache Kafka®Brick-by-Brick: Exploring the Elements of Apache Kafka®
Brick-by-Brick: Exploring the Elements of Apache Kafka®
 
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf
#SCIT 2024 LatAm Delegation Overview + SPONSORSHIP.pdf
 
Event-Driven Microservices: Back to the Basics
Event-Driven Microservices: Back to the BasicsEvent-Driven Microservices: Back to the Basics
Event-Driven Microservices: Back to the Basics
 
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdf
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdfWeb Development Solutions 2024 A Beginner's Comprehensive Handbook.pdf
Web Development Solutions 2024 A Beginner's Comprehensive Handbook.pdf
 
Real-time Geospatial Aircraft Monitoring Using Apache Kafka
Real-time Geospatial Aircraft Monitoring Using Apache KafkaReal-time Geospatial Aircraft Monitoring Using Apache Kafka
Real-time Geospatial Aircraft Monitoring Using Apache Kafka
 
How to Build an Event-based Control Center for the Electrical Grid
How to Build an Event-based Control Center for the Electrical GridHow to Build an Event-based Control Center for the Electrical Grid
How to Build an Event-based Control Center for the Electrical Grid
 
Data Contracts In Practice With Debezium and Apache Flink
Data Contracts In Practice With Debezium and Apache FlinkData Contracts In Practice With Debezium and Apache Flink
Data Contracts In Practice With Debezium and Apache Flink
 
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...
Leveraging Tiered Storage in Strimzi-Operated Kafka for Cost-Effective Stream...
 
Introduction to Cybersecurity | IIT(BHU)CyberSec
Introduction to Cybersecurity | IIT(BHU)CyberSecIntroduction to Cybersecurity | IIT(BHU)CyberSec
Introduction to Cybersecurity | IIT(BHU)CyberSec
 
Transcript: Book industry state of the nation 2024 - Tech Forum 2024
Transcript: Book industry state of the nation 2024 - Tech Forum 2024Transcript: Book industry state of the nation 2024 - Tech Forum 2024
Transcript: Book industry state of the nation 2024 - Tech Forum 2024
 
Book industry state of the nation 2024 - Tech Forum 2024
Book industry state of the nation 2024 - Tech Forum 2024Book industry state of the nation 2024 - Tech Forum 2024
Book industry state of the nation 2024 - Tech Forum 2024
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
 
Case Study: Implementing a Data Mesh at NORD/LB
Case Study: Implementing a Data Mesh at NORD/LBCase Study: Implementing a Data Mesh at NORD/LB
Case Study: Implementing a Data Mesh at NORD/LB
 
Modifying Your SQL Streaming Queries on the Fly: The Impossible Trinity
Modifying Your SQL Streaming Queries on the Fly: The Impossible TrinityModifying Your SQL Streaming Queries on the Fly: The Impossible Trinity
Modifying Your SQL Streaming Queries on the Fly: The Impossible Trinity
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And Why
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit London
 

GraphQL 101 | An introduction to the world of GraphQL