GraphQL: The Missing Link Between Frontend and Backend Devs

Sashko Stubailo
Sashko StubailoEngineering Manager em Stripe
The Missing Link Between Frontend and Backend Devs
GraphQL
Sashko Stubailo
@stubailo
Apollo Tech Lead, Meteor
Browser
Web Server
C L I E N T
S E R V E R
A B R I E F H I S T O R Y O F W E B A P P S
<HTML />
Sending HTML from a web
server to a browser
JavaScript UI
API Server
C L I E N T
S E R V E R
A B R I E F H I S T O R Y O F W E B A P P S
{ data }
Sending data from an API
server to a single-page app,
for better performance
JavaScript UI
API Server
C L I E N T
S E R V E R
A B R I E F H I S T O R Y O F A P P S
{ data }
Sending data from an API
server to multiple clients in
different environments
Native iOS app
CordovaBrowser Native
Microservice Microservice Microservice
C L I E N T
S E R V E R
A B R I E F H I S T O R Y O F A P P S
Splitting into microservices,
waterfall loading and
multiple APIs
CordovaBrowser Native
Microservice Microservice Microservice
C L I E N T
S E R V E R
A B R I E F H I S T O R Y O F A P P S
Add an API gateway, now there’s
a development bottleneck
API gateway
CordovaBrowser Native
Microservice Microservice Microservice
C L I E N T
S E R V E R
T H E F U T U R E O F A P P S
The solution: GraphQL as the
translation layer between
frontend and backend
GraphQL API gateway
• Full-stack developers, where frontend
teams build the API
• Separate API team
• Backend services team owns their API
• Feature-oriented teams
T E A M S T R U C T U R E S
Too many API
endpoints, one per UI
feature
API endpoints don’t
meet UI needs
Possible performance
or security issues to
ship faster
Takes too long to build
the API for a new
feature
Frontend team
develops API
Backend team
develops API
Best of both worlds?
The benefits
Flexible: “Make your own endpoints”
query Human {
human(id: "1000") {
name
height(unit: FOOT)
}
}
{
"human": {
"name": "Luke Skywalker",
"height": 5.6430448
}
}
• Choose from your API’s schema of types, fields, and arguments
• Computed fields, parameters, type conditions, and more
• Validates queries for you
Performance: Get what you need
• No need to hit multiple endpoints to
render one page
• Select only the fields that are needed
• Batch across all data requirements
• Eliminate unnecessary fetching with
fancy clients, such as Apollo and Relay
query Human {
human(id: "1000") {
name
avatar(size: SMALL)
friends {
name
}
}
}
Not just a tool: An open source spec
S E R V E R S
• Plain HTTP request
• React
• Angular
• Vue
• Polymer
• Native iOS/Android
C L I E N T S
• Node.js
• Ruby
• Python
• Scala
• Java
• Erlang
T O O L S
• API explorer (GraphiQL)
• Editor autocomplete
• Query validation
• Mocking
• Performance analysis
• Code generation
…and more
Constantly improving
subscription {
newComments(postId: 5) {
content
author {
name
}
}
}
S U B S C R I P T I O N S
query {
newsFeedPosts {
title
image
comments @defer {
content
}
}
}
D E F E R
Think carefully about API needs
Hardcode special endpoints
User Interface Backend
W I T H R E S T
Ask for data
Get the data
User Interface Backend
W I T H G R A P H Q L
C O M M U N I C A T I O N
Backend point of view
const HumanQuery = gql`
query Human {
human(id: "1000") {
name
height(unit: FOOT)
}
}
`;
Know exactly which parts of the code are using the fields and endpoints in the API,
at runtime and statically, to evaluate backend changes and ask UI devs
Query
human
Human
name
height
friends
A tool for GraphQL devs to understand their APIOptics
Backend point of view
Don’t need to worry about maintaining UI-specific endpoints to
reduce roundtrips
api.example.com/posts/1.json
api.example.com/posts/1/detailed.json
api.example.com/posts/1/mobile-preview.json
api.example.com/v3/posts/1/android-feed.jsonX
Backend point of view
No need to version API to change the data available, just add new fields
Frontend point of view
More flexibility to prototype, try different ideas, and act independently
Frontend point of view
query Human {
human {
name
weather
friends {
name
}
}
}
Get insight into query performance to fix loading problems without
diving into the backend, or have information to give backend team
query Human
Optics
Frontend point of view
Self-documenting API means the UI developer doesn’t
need to hunt around to figure out the parameters or data format
A better API experience for both
A P I W O R K F L O W
• Database schema is not
always relevant to frontend
developers
• These days, not all of your
data is in a database!
D B S C H E M A
• Represents contract
between frontend and
backend
• Has declared relationships
• Can be used directly to
implement the server and
mock data
# A comment submitted by a user
type Comment {
# The SQL ID of this comment
id: Int!
# The GitHub user who posted the comment
postedBy: User!
# The text of the comment
content: String!
# The repository which this comment is about
repoName: String!
}
G R A P H Q L S C H E M A
Enables new dev workflow
1. UI and API developers agree on schema
2. UI developer mocks data based on schema,
starts implementing UI components and
views independently
3. API developer builds out schema, informs UI
dev of any necessary changes
4. UI and API connected together, queries test
for performance
5. Feature shipped!
Schema
UI API
Product
Conclusion: Developer happiness
B A C K E N D
• Clear and concise API to maintain
• Know how people are actually
using the data
• No need for frequent endpoint
code changes
• Smaller security surface area
F R O N T E N D
• Easy to find, understand and
consume data
• Many client-side developer tools
for caching, validation, and
more
• Make your own endpoints
Conclusion: Communication
• Shared type language
• Clear API design process
• Self-documenting API layer
• UI developers get insights into performance
• API devs know who is using the data, why,
and what to optimize for
The Missing Link Between Frontend and
Backend Devs
GraphQL
Sashko Stubailo
@stubailo
Apollo Tech Lead, Meteor
Community docs and general information:
graphql.org
Our Medium publication, with tips and in-depth
articles about GraphQL
medium.com/apollo-stack
Apollo GraphQL clients and tools:
dev.apollodata.com
1 de 34

Recomendados

Modular GraphQL with Schema Stitching por
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingSashko Stubailo
3.6K visualizações18 slides
Into to GraphQL por
Into to GraphQLInto to GraphQL
Into to GraphQLshobot
263 visualizações12 slides
Adding GraphQL to your existing architecture por
Adding GraphQL to your existing architectureAdding GraphQL to your existing architecture
Adding GraphQL to your existing architectureSashko Stubailo
3K visualizações28 slides
GraphQL across the stack: How everything fits together por
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherSashko Stubailo
2K visualizações61 slides
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps por
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsMeteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern Apps
Meteor MIT Tech Talk 9/18/14: Designing a New Platform For Modern AppsSashko Stubailo
2K visualizações13 slides
GraphQL: Enabling a new generation of API developer tools por
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsSashko Stubailo
1.8K visualizações35 slides

Mais conteúdo relacionado

Mais procurados

Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor por
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorWhy UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorJon Wong
136 visualizações25 slides
GraphQL por
GraphQLGraphQL
GraphQLJoel Corrêa
4.6K visualizações19 slides
GraphQL + relay por
GraphQL + relayGraphQL + relay
GraphQL + relayCédric GILLET
1.6K visualizações46 slides
GraphQL por
GraphQLGraphQL
GraphQLCédric GILLET
2.2K visualizações12 slides
GraphQL over REST at Reactathon 2018 por
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018Sashko Stubailo
1.4K visualizações37 slides
The Apollo and GraphQL Stack por
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL StackSashko Stubailo
2.5K visualizações41 slides

Mais procurados(20)

Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor por Jon Wong
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorWhy UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Jon Wong136 visualizações
GraphQL por Joel Corrêa
GraphQLGraphQL
GraphQL
Joel Corrêa4.6K visualizações
GraphQL + relay por Cédric GILLET
GraphQL + relayGraphQL + relay
GraphQL + relay
Cédric GILLET1.6K visualizações
GraphQL por Cédric GILLET
GraphQLGraphQL
GraphQL
Cédric GILLET2.2K visualizações
GraphQL over REST at Reactathon 2018 por Sashko Stubailo
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
Sashko Stubailo1.4K visualizações
The Apollo and GraphQL Stack por Sashko Stubailo
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo2.5K visualizações
Introduction to GraphQL por Rodrigo Prates
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
Rodrigo Prates370 visualizações
Intro to GraphQL por Rakuten Group, Inc.
 Intro to GraphQL Intro to GraphQL
Intro to GraphQL
Rakuten Group, Inc.1.6K visualizações
REST vs GraphQL por Squareboat
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
Squareboat493 visualizações
Graphql por Niv Ben David
GraphqlGraphql
Graphql
Niv Ben David621 visualizações
GraphQL & Relay por Viacheslav Slinko
GraphQL & RelayGraphQL & Relay
GraphQL & Relay
Viacheslav Slinko1.1K visualizações
GraphQL in an Age of REST por Yos Riady
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
Yos Riady829 visualizações
GraphQL Introduction por Serge Huber
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
Serge Huber3.4K visualizações
Better APIs with GraphQL por Josh Price
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
Josh Price859 visualizações
Introduction to graphQL por Muhilvarnan V
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
Muhilvarnan V321 visualizações
Graphql presentation por Vibhor Grover
Graphql presentationGraphql presentation
Graphql presentation
Vibhor Grover2.6K visualizações
Serverless GraphQL for Product Developers por Sashko Stubailo
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product Developers
Sashko Stubailo1K visualizações
How to GraphQL por Tomasz Bak
How to GraphQLHow to GraphQL
How to GraphQL
Tomasz Bak1.2K visualizações
GraphQL With Relay Part Deux por Brad Pillow
GraphQL With Relay Part DeuxGraphQL With Relay Part Deux
GraphQL With Relay Part Deux
Brad Pillow802 visualizações

Similar a GraphQL: The Missing Link Between Frontend and Backend Devs

API workshop: Introduction to APIs (TC Camp) por
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)Tom Johnson
3.2K visualizações51 slides
Frontend APIs powering fast paced product iterations por
Frontend APIs powering fast paced product iterationsFrontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterationsKarthik Ramgopal
863 visualizações66 slides
Cqrs api por
Cqrs apiCqrs api
Cqrs apiBrandon Mueller
3.8K visualizações40 slides
Developing Apps with Azure AD por
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure ADSharePointRadi
790 visualizações55 slides
API Workshop: Deep dive into REST APIs por
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
4.6K visualizações80 slides
Api design part 1 por
Api design part 1Api design part 1
Api design part 1Ibrahim Elsawaf
215 visualizações78 slides

Similar a GraphQL: The Missing Link Between Frontend and Backend Devs(20)

API workshop: Introduction to APIs (TC Camp) por Tom Johnson
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
Tom Johnson3.2K visualizações
Frontend APIs powering fast paced product iterations por Karthik Ramgopal
Frontend APIs powering fast paced product iterationsFrontend APIs powering fast paced product iterations
Frontend APIs powering fast paced product iterations
Karthik Ramgopal863 visualizações
Cqrs api por Brandon Mueller
Cqrs apiCqrs api
Cqrs api
Brandon Mueller3.8K visualizações
Developing Apps with Azure AD por SharePointRadi
Developing Apps with Azure ADDeveloping Apps with Azure AD
Developing Apps with Azure AD
SharePointRadi790 visualizações
API Workshop: Deep dive into REST APIs por Tom Johnson
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
Tom Johnson4.6K visualizações
Api design part 1 por Ibrahim Elsawaf
Api design part 1Api design part 1
Api design part 1
Ibrahim Elsawaf215 visualizações
Connecticut Salesforce Developer Group - Jan 2017 por Jitendra Zaa
Connecticut Salesforce Developer Group - Jan 2017Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017
Jitendra Zaa5.1K visualizações
Slaying Monoliths with Node and Docker por Yunong Xiao
Slaying Monoliths with Node and DockerSlaying Monoliths with Node and Docker
Slaying Monoliths with Node and Docker
Yunong Xiao2.4K visualizações
apidays LIVE Australia - Contract-first API development with Spot by Francois... por apidays
apidays LIVE Australia - Contract-first API development with Spot by Francois...apidays LIVE Australia - Contract-first API development with Spot by Francois...
apidays LIVE Australia - Contract-first API development with Spot by Francois...
apidays2.4K visualizações
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no... por apidays
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays LIVE Australia - Have your cake and eat it too: GraphQL? REST? Why no...
apidays1.1K visualizações
Seattle StrongLoop Node.js Workshop por Jimmy Guerrero
Seattle StrongLoop Node.js WorkshopSeattle StrongLoop Node.js Workshop
Seattle StrongLoop Node.js Workshop
Jimmy Guerrero1.9K visualizações
Test-Driven Documentation for your REST(ful) service por Jeroen Reijn
Test-Driven Documentation for your REST(ful) serviceTest-Driven Documentation for your REST(ful) service
Test-Driven Documentation for your REST(ful) service
Jeroen Reijn1.2K visualizações
Next Generation Client APIs in Envoy Mobile por C4Media
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
C4Media845 visualizações
apidays London 2023 - Autonomous Agents, Zdenek Nemec, superface.ai por apidays
apidays London 2023 - Autonomous Agents, Zdenek Nemec, superface.aiapidays London 2023 - Autonomous Agents, Zdenek Nemec, superface.ai
apidays London 2023 - Autonomous Agents, Zdenek Nemec, superface.ai
apidays31 visualizações
PPT for Seminar.pptx por Akshay Bhujbal
PPT for Seminar.pptxPPT for Seminar.pptx
PPT for Seminar.pptx
Akshay Bhujbal4 visualizações
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B... por apidays
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...
apidays LIVE LONDON - Discovering API Version differences with ease by Jaap B...
apidays39 visualizações
Api clarity webinar por LibbySchulze
Api clarity webinarApi clarity webinar
Api clarity webinar
LibbySchulze1K visualizações
Content Strategy and Developer Engagement for DevPortals por Axway
Content Strategy and Developer Engagement for DevPortalsContent Strategy and Developer Engagement for DevPortals
Content Strategy and Developer Engagement for DevPortals
Axway321 visualizações
Akash Damniya por Akash Damniya
Akash DamniyaAkash Damniya
Akash Damniya
Akash Damniya114 visualizações
Ibm_interconnect_restapi_workshop por Shubhra Kar
Ibm_interconnect_restapi_workshopIbm_interconnect_restapi_workshop
Ibm_interconnect_restapi_workshop
Shubhra Kar673 visualizações

Último

CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T por
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TShapeBlue
152 visualizações34 slides
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online por
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineShapeBlue
221 visualizações19 slides
Generative AI: Shifting the AI Landscape por
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI LandscapeDeakin University
53 visualizações55 slides
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue por
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueShapeBlue
222 visualizações7 slides
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... por
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...ShapeBlue
186 visualizações15 slides
Business Analyst Series 2023 - Week 4 Session 8 por
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8DianaGray10
123 visualizações13 slides

Último(20)

CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T por ShapeBlue
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&TCloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
CloudStack and GitOps at Enterprise Scale - Alex Dometrius, Rene Glover - AT&T
ShapeBlue152 visualizações
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online por ShapeBlue
KVM Security Groups Under the Hood - Wido den Hollander - Your.OnlineKVM Security Groups Under the Hood - Wido den Hollander - Your.Online
KVM Security Groups Under the Hood - Wido den Hollander - Your.Online
ShapeBlue221 visualizações
Generative AI: Shifting the AI Landscape por Deakin University
Generative AI: Shifting the AI LandscapeGenerative AI: Shifting the AI Landscape
Generative AI: Shifting the AI Landscape
Deakin University53 visualizações
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue por ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlueElevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
Elevating Privacy and Security in CloudStack - Boris Stoyanov - ShapeBlue
ShapeBlue222 visualizações
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ... por ShapeBlue
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
Backroll, News and Demo - Pierre Charton, Matthias Dhellin, Ousmane Diarra - ...
ShapeBlue186 visualizações
Business Analyst Series 2023 - Week 4 Session 8 por DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10123 visualizações
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue por ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlueMigrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
Migrating VMware Infra to KVM Using CloudStack - Nicolas Vazquez - ShapeBlue
ShapeBlue218 visualizações
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue por ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlueVNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
VNF Integration and Support in CloudStack - Wei Zhou - ShapeBlue
ShapeBlue203 visualizações
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ... por ShapeBlue
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
How to Re-use Old Hardware with CloudStack. Saving Money and the Environment ...
ShapeBlue166 visualizações
NTGapps NTG LowCode Platform por Mustafa Kuğu
NTGapps NTG LowCode Platform NTGapps NTG LowCode Platform
NTGapps NTG LowCode Platform
Mustafa Kuğu423 visualizações
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha... por ShapeBlue
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
Mitigating Common CloudStack Instance Deployment Failures - Jithin Raju - Sha...
ShapeBlue180 visualizações
DRBD Deep Dive - Philipp Reisner - LINBIT por ShapeBlue
DRBD Deep Dive - Philipp Reisner - LINBITDRBD Deep Dive - Philipp Reisner - LINBIT
DRBD Deep Dive - Philipp Reisner - LINBIT
ShapeBlue180 visualizações
Digital Personal Data Protection (DPDP) Practical Approach For CISOs por Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash158 visualizações
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... por ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue198 visualizações
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... por ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue173 visualizações
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue por ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue147 visualizações
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue por ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlueCloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
CloudStack Object Storage - An Introduction - Vladimir Petrov - ShapeBlue
ShapeBlue138 visualizações
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT por ShapeBlue
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBITUpdates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
Updates on the LINSTOR Driver for CloudStack - Rene Peinthor - LINBIT
ShapeBlue206 visualizações
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... por ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue106 visualizações
Qualifying SaaS, IaaS.pptx por Sachin Bhandari
Qualifying SaaS, IaaS.pptxQualifying SaaS, IaaS.pptx
Qualifying SaaS, IaaS.pptx
Sachin Bhandari1K visualizações

GraphQL: The Missing Link Between Frontend and Backend Devs

  • 1. The Missing Link Between Frontend and Backend Devs GraphQL Sashko Stubailo @stubailo Apollo Tech Lead, Meteor
  • 2. Browser Web Server C L I E N T S E R V E R A B R I E F H I S T O R Y O F W E B A P P S <HTML /> Sending HTML from a web server to a browser
  • 3. JavaScript UI API Server C L I E N T S E R V E R A B R I E F H I S T O R Y O F W E B A P P S { data } Sending data from an API server to a single-page app, for better performance
  • 4. JavaScript UI API Server C L I E N T S E R V E R A B R I E F H I S T O R Y O F A P P S { data } Sending data from an API server to multiple clients in different environments Native iOS app
  • 5. CordovaBrowser Native Microservice Microservice Microservice C L I E N T S E R V E R A B R I E F H I S T O R Y O F A P P S Splitting into microservices, waterfall loading and multiple APIs
  • 6. CordovaBrowser Native Microservice Microservice Microservice C L I E N T S E R V E R A B R I E F H I S T O R Y O F A P P S Add an API gateway, now there’s a development bottleneck API gateway
  • 7. CordovaBrowser Native Microservice Microservice Microservice C L I E N T S E R V E R T H E F U T U R E O F A P P S The solution: GraphQL as the translation layer between frontend and backend GraphQL API gateway
  • 8. • Full-stack developers, where frontend teams build the API • Separate API team • Backend services team owns their API • Feature-oriented teams T E A M S T R U C T U R E S
  • 9. Too many API endpoints, one per UI feature API endpoints don’t meet UI needs Possible performance or security issues to ship faster Takes too long to build the API for a new feature Frontend team develops API Backend team develops API
  • 10. Best of both worlds?
  • 12. Flexible: “Make your own endpoints” query Human { human(id: "1000") { name height(unit: FOOT) } } { "human": { "name": "Luke Skywalker", "height": 5.6430448 } } • Choose from your API’s schema of types, fields, and arguments • Computed fields, parameters, type conditions, and more • Validates queries for you
  • 13. Performance: Get what you need • No need to hit multiple endpoints to render one page • Select only the fields that are needed • Batch across all data requirements • Eliminate unnecessary fetching with fancy clients, such as Apollo and Relay query Human { human(id: "1000") { name avatar(size: SMALL) friends { name } } }
  • 14. Not just a tool: An open source spec S E R V E R S • Plain HTTP request • React • Angular • Vue • Polymer • Native iOS/Android C L I E N T S • Node.js • Ruby • Python • Scala • Java • Erlang T O O L S • API explorer (GraphiQL) • Editor autocomplete • Query validation • Mocking • Performance analysis • Code generation …and more
  • 15. Constantly improving subscription { newComments(postId: 5) { content author { name } } } S U B S C R I P T I O N S query { newsFeedPosts { title image comments @defer { content } } } D E F E R
  • 16. Think carefully about API needs Hardcode special endpoints User Interface Backend W I T H R E S T
  • 17. Ask for data Get the data User Interface Backend W I T H G R A P H Q L
  • 18. C O M M U N I C A T I O N
  • 19. Backend point of view const HumanQuery = gql` query Human { human(id: "1000") { name height(unit: FOOT) } } `; Know exactly which parts of the code are using the fields and endpoints in the API, at runtime and statically, to evaluate backend changes and ask UI devs Query human Human name height friends
  • 20. A tool for GraphQL devs to understand their APIOptics
  • 21. Backend point of view Don’t need to worry about maintaining UI-specific endpoints to reduce roundtrips api.example.com/posts/1.json api.example.com/posts/1/detailed.json api.example.com/posts/1/mobile-preview.json api.example.com/v3/posts/1/android-feed.jsonX
  • 22. Backend point of view No need to version API to change the data available, just add new fields
  • 23. Frontend point of view More flexibility to prototype, try different ideas, and act independently
  • 24. Frontend point of view query Human { human { name weather friends { name } } } Get insight into query performance to fix loading problems without diving into the backend, or have information to give backend team query Human
  • 26. Frontend point of view Self-documenting API means the UI developer doesn’t need to hunt around to figure out the parameters or data format
  • 27. A better API experience for both
  • 28. A P I W O R K F L O W
  • 29. • Database schema is not always relevant to frontend developers • These days, not all of your data is in a database! D B S C H E M A
  • 30. • Represents contract between frontend and backend • Has declared relationships • Can be used directly to implement the server and mock data # A comment submitted by a user type Comment { # The SQL ID of this comment id: Int! # The GitHub user who posted the comment postedBy: User! # The text of the comment content: String! # The repository which this comment is about repoName: String! } G R A P H Q L S C H E M A
  • 31. Enables new dev workflow 1. UI and API developers agree on schema 2. UI developer mocks data based on schema, starts implementing UI components and views independently 3. API developer builds out schema, informs UI dev of any necessary changes 4. UI and API connected together, queries test for performance 5. Feature shipped! Schema UI API Product
  • 32. Conclusion: Developer happiness B A C K E N D • Clear and concise API to maintain • Know how people are actually using the data • No need for frequent endpoint code changes • Smaller security surface area F R O N T E N D • Easy to find, understand and consume data • Many client-side developer tools for caching, validation, and more • Make your own endpoints
  • 33. Conclusion: Communication • Shared type language • Clear API design process • Self-documenting API layer • UI developers get insights into performance • API devs know who is using the data, why, and what to optimize for
  • 34. The Missing Link Between Frontend and Backend Devs GraphQL Sashko Stubailo @stubailo Apollo Tech Lead, Meteor Community docs and general information: graphql.org Our Medium publication, with tips and in-depth articles about GraphQL medium.com/apollo-stack Apollo GraphQL clients and tools: dev.apollodata.com