SlideShare une entreprise Scribd logo
1  sur  29
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
Introduction to Data Driven Apps with GraphQL
Speaker Name,
Speaker Title
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
App Data Challenges
Data requirements
vary across devices
and become harder
when multiple
users share data
Users want instant
access to data
Building scalable
data-driven apps
without learning
distributed systems
concepts is hard
Users want to
continue using
their apps even
with low or no
connectivity
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
App Data Requirements
Real-time
Collaboration
Offline Programming
Model with Sync
Get Only the
Data You Need
Fine-grained
Access Control
Flexible Database
Options
Share Schema between
Client and Server
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Option 1: HTTP or REST API
• Resources defined by “Endpoints”
• Client calls to many endpoints
• Uses HTTP as a transport
• Conceptually simple
• Tried and true
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Option 1: HTTP or REST API
Real-time
Collaboration
Offline Programming
Model with Sync
Get Only the
Data You Need
Fine-grained
Access Control
Flexible Database
Options
Share Schema between
Client and Server
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Option 2: GraphQL
GraphQL is a query language for APIs and a runtime
for fulfilling those queries with your existing data.
GraphQL provides a complete and understandable description
of the data in your API, gives clients the power to ask for
exactly what they need and nothing more, makes it easier to
evolve APIs over time, and enables powerful developer tools
graphql.org/learn
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
GraphQL is a query language for APIs…
• Resources defined by a GraphQL Schema
• Client sends query, server orchestrates data
• Mutiple transports (HTTP, MQTT, WebSockets)
• Efficient (Network Bandwidth, Dev Time)
• Self Documenting (Introspection w/ Tooling)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
GraphQL is a query language for APIs…
Queries read data
Mutations write data
Subscriptions are pushed data in real-time
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Option 2: GraphQL
Real-time
Collaboration
Offline Programming
Model with Sync
Get Only the
Data You Need
Fine-grained
Access Control
Flexible Database
Options
Share Schema between
Client and Server
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
GraphQL: Query Basics
There are 3 operation types:
• Query
• Mutation
• Subscription
Variables are optional. When using
variables, clients send a “variables” object
containing the values alongside the query.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
A runtime for fulfilling those queries…
• A GraphQL server takes a query and returns a response of
the exact same shape.
• Each field in the query selection set is “resolved” by a
server side function.
• GraphQL provides a standard contract allowing clients to
talk to any number of backend data stores.
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
A runtime for fulfilling those queries…
query {
posts {
id
title
comments {
content
}
author {
name
}
}
}
Posts resolves by Elasticsearch
Comments resolved by DynamoDB
Author resolved by custom Lambda
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
A runtime for fulfilling those queries…
query {
posts {
id
title
comments {
content
}
author {
name
}
}
}
{
"data": {
"posts": [
{
"id": 1,
"title" "Intro to GraphQL",
"comments": [
{
"content": "I want GraphQL!"
}
],
"author": {
"name": "Awesome Developer"
}
}
]
}
}
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
GraphQL provides a description of your data…
• Define schema with schema definition language (SDL)
• Advanced types
– Object, Interface, Union, Enum, Input, Scalar
• Self documenting
• Code generation
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Selection sets
Selection sets specify what fields to
resolve and thus what data to return
Selection sets can be nested
arbitrarily
Fields that return a scalar or an enum
do not have selection sets
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Fragments
Fragments are a basic unit of
composition
Like a named, reusable selection set
but with a few extra features
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Directives
@skip & @include supported
by the specification but system
implementations can add their
own
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Schema Definition Language (SDL)
Concise way to define and document
GraphQL schemas
You can think of SDL as the Data
Definition Language (DDL) and the
query language as the Data
Manipulation Language (DML)
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Scalars
Create scalar types with custom
validation, parsing, and serialization
Use Cases: email, timestamps, phone
numbers, any regex checked string
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Objects
Contain a set of fields each of which
is of a specific type
A very common building block
Root types (Query, Mutation,
Subscription) are also Object types
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Enumerations
Denotes a scalar that is of a
predetermined set of values
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Interfaces
Defines a common set of fields.
Object types implement interfaces.
Query with fragments
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Unions
A union says than an object is one of
a set of types.
Query with fragments
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Gives clients the power to ask for what they need…
• Each UI component has its own data requirements
• The same backend model can be viewed in different ways
• The network is precious
• The security boundary should be defined by the backend, not the UI
• A queryable API is a better solution than different endpoints per view
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Use case: Master-detail views
DetailMaster
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Makes it easier to evolve APIs over time…
• GraphQL requires that every request specify every field
• We know what is being used = we can deprecate with confidence
• Schema allows for marking fields as deprecated!
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Powerful Developer Tools
• Optimized, caching and offline client libraries
• Introspection
• Code generation
• IDE integrations
• Data visualizations
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Demo: GraphQL In Action
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
aws.amazon.com/mobile
@AWSforMobile
Everything you need to connect
Your mobile app to the cloud

Contenu connexe

Tendances

GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL IntroductionSerge Huber
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...luisw19
 
GraphQL: Enabling a new generation of API developer tools
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
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Rafael Wilber Kerr
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL Josh Price
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQLMuhilvarnan V
 
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
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLRodrigo Prates
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs RESTGreeceJS
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Hafiz Ismail
 
REST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookREST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookNordic APIs
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL StackSashko Stubailo
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservicesMohammed Shaban
 

Tendances (20)

GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
GraphQL as an alternative approach to REST (as presented at Java2Days/CodeMon...
 
GraphQL: Enabling a new generation of API developer tools
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 tools
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
Graphql
GraphqlGraphql
Graphql
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
Introduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SFIntroduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SF
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs REST
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
 
REST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookREST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical Look
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
GraphQL Fundamentals
GraphQL FundamentalsGraphQL Fundamentals
GraphQL Fundamentals
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
 
Spring GraphQL
Spring GraphQLSpring GraphQL
Spring GraphQL
 

Similaire à Introduction to GraphQL

Building Data Driven Apps with AWS: Collision 2018
Building Data Driven Apps with AWS: Collision 2018Building Data Driven Apps with AWS: Collision 2018
Building Data Driven Apps with AWS: Collision 2018Amazon Web Services
 
Building Data Driven Apps with AWS
Building Data Driven Apps with AWSBuilding Data Driven Apps with AWS
Building Data Driven Apps with AWSAmazon Web Services
 
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...Amazon Web Services
 
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...Amazon Web Services
 
Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Amazon Web Services
 
Real-time Analytics using Data from IoT Devices - AWS Online Tech Talks
Real-time Analytics using Data from IoT Devices - AWS Online Tech TalksReal-time Analytics using Data from IoT Devices - AWS Online Tech Talks
Real-time Analytics using Data from IoT Devices - AWS Online Tech TalksAmazon Web Services
 
DAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the CloudDAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the CloudAmazon Web Services
 
Managing a Database Migration Project Best Practices and Customer References.pdf
Managing a Database Migration Project Best Practices and Customer References.pdfManaging a Database Migration Project Best Practices and Customer References.pdf
Managing a Database Migration Project Best Practices and Customer References.pdfAmazon Web Services
 
Getting started with Serverless on AWS
Getting started with Serverless on AWSGetting started with Serverless on AWS
Getting started with Serverless on AWSAdrian Hornsby
 
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAmazon Web Services
 
100 Billion Data Points With Lambda_AWSPSSummit_Singapore
100 Billion Data Points With Lambda_AWSPSSummit_Singapore100 Billion Data Points With Lambda_AWSPSSummit_Singapore
100 Billion Data Points With Lambda_AWSPSSummit_SingaporeAmazon Web Services
 
Deep learning systems model serving
Deep learning systems   model servingDeep learning systems   model serving
Deep learning systems model servingHagay Lupesko
 
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...Amazon Web Services
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...Amazon Web Services
 
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ... SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...Amazon Web Services
 
Introduction to AWS for Mobile Developers
Introduction to AWS for Mobile DevelopersIntroduction to AWS for Mobile Developers
Introduction to AWS for Mobile DevelopersAmazon Web Services
 

Similaire à Introduction to GraphQL (20)

Building Data Driven Apps with AWS: Collision 2018
Building Data Driven Apps with AWS: Collision 2018Building Data Driven Apps with AWS: Collision 2018
Building Data Driven Apps with AWS: Collision 2018
 
Building Data Driven Apps with AWS
Building Data Driven Apps with AWSBuilding Data Driven Apps with AWS
Building Data Driven Apps with AWS
 
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...
NEW LAUNCH! Data Driven Apps with GraphQL: AWS AppSync Deep Dive - MBL402 - r...
 
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
MBL204_Architecting Cost-Effective Mobile Backends for Scale, Security, and P...
 
Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...Learn how to build serverless applications using the AWS Serverless Platform-...
Learn how to build serverless applications using the AWS Serverless Platform-...
 
Real-time Analytics using Data from IoT Devices - AWS Online Tech Talks
Real-time Analytics using Data from IoT Devices - AWS Online Tech TalksReal-time Analytics using Data from IoT Devices - AWS Online Tech Talks
Real-time Analytics using Data from IoT Devices - AWS Online Tech Talks
 
DAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the CloudDAT317_Migrating Databases and Data Warehouses to the Cloud
DAT317_Migrating Databases and Data Warehouses to the Cloud
 
Managing a Database Migration Project Best Practices and Customer References.pdf
Managing a Database Migration Project Best Practices and Customer References.pdfManaging a Database Migration Project Best Practices and Customer References.pdf
Managing a Database Migration Project Best Practices and Customer References.pdf
 
Getting started with Serverless on AWS
Getting started with Serverless on AWSGetting started with Serverless on AWS
Getting started with Serverless on AWS
 
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
 
100 Billion Data Points With Lambda_AWSPSSummit_Singapore
100 Billion Data Points With Lambda_AWSPSSummit_Singapore100 Billion Data Points With Lambda_AWSPSSummit_Singapore
100 Billion Data Points With Lambda_AWSPSSummit_Singapore
 
Deep learning systems model serving
Deep learning systems   model servingDeep learning systems   model serving
Deep learning systems model serving
 
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...
How Nextdoor Built a Scalable, Serverless Data Pipeline for Billions of Event...
 
Introduction to Serverless
Introduction to ServerlessIntroduction to Serverless
Introduction to Serverless
 
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
SRV331_Build a Multi-Region Serverless Application for Resilience and High Av...
 
Migrating database to cloud
Migrating database to cloudMigrating database to cloud
Migrating database to cloud
 
Database Freedom | AWS Floor28
Database Freedom | AWS Floor28Database Freedom | AWS Floor28
Database Freedom | AWS Floor28
 
Serverless Developer Experience
Serverless Developer ExperienceServerless Developer Experience
Serverless Developer Experience
 
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ... SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
SRV307 Applying AWS Purpose-Built Database Strategy: Match Your Workload to ...
 
Introduction to AWS for Mobile Developers
Introduction to AWS for Mobile DevelopersIntroduction to AWS for Mobile Developers
Introduction to AWS for Mobile Developers
 

Plus de Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Plus de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Introduction to GraphQL

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Pop-up Loft Introduction to Data Driven Apps with GraphQL Speaker Name, Speaker Title
  • 2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved App Data Challenges Data requirements vary across devices and become harder when multiple users share data Users want instant access to data Building scalable data-driven apps without learning distributed systems concepts is hard Users want to continue using their apps even with low or no connectivity
  • 3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved App Data Requirements Real-time Collaboration Offline Programming Model with Sync Get Only the Data You Need Fine-grained Access Control Flexible Database Options Share Schema between Client and Server
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Option 1: HTTP or REST API • Resources defined by “Endpoints” • Client calls to many endpoints • Uses HTTP as a transport • Conceptually simple • Tried and true
  • 5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Option 1: HTTP or REST API Real-time Collaboration Offline Programming Model with Sync Get Only the Data You Need Fine-grained Access Control Flexible Database Options Share Schema between Client and Server
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Option 2: GraphQL GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools graphql.org/learn
  • 7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved GraphQL is a query language for APIs… • Resources defined by a GraphQL Schema • Client sends query, server orchestrates data • Mutiple transports (HTTP, MQTT, WebSockets) • Efficient (Network Bandwidth, Dev Time) • Self Documenting (Introspection w/ Tooling)
  • 8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved GraphQL is a query language for APIs… Queries read data Mutations write data Subscriptions are pushed data in real-time
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Option 2: GraphQL Real-time Collaboration Offline Programming Model with Sync Get Only the Data You Need Fine-grained Access Control Flexible Database Options Share Schema between Client and Server
  • 10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved GraphQL: Query Basics There are 3 operation types: • Query • Mutation • Subscription Variables are optional. When using variables, clients send a “variables” object containing the values alongside the query.
  • 11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved A runtime for fulfilling those queries… • A GraphQL server takes a query and returns a response of the exact same shape. • Each field in the query selection set is “resolved” by a server side function. • GraphQL provides a standard contract allowing clients to talk to any number of backend data stores.
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved A runtime for fulfilling those queries… query { posts { id title comments { content } author { name } } } Posts resolves by Elasticsearch Comments resolved by DynamoDB Author resolved by custom Lambda
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved A runtime for fulfilling those queries… query { posts { id title comments { content } author { name } } } { "data": { "posts": [ { "id": 1, "title" "Intro to GraphQL", "comments": [ { "content": "I want GraphQL!" } ], "author": { "name": "Awesome Developer" } } ] } }
  • 14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved GraphQL provides a description of your data… • Define schema with schema definition language (SDL) • Advanced types – Object, Interface, Union, Enum, Input, Scalar • Self documenting • Code generation
  • 15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Selection sets Selection sets specify what fields to resolve and thus what data to return Selection sets can be nested arbitrarily Fields that return a scalar or an enum do not have selection sets
  • 16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Fragments Fragments are a basic unit of composition Like a named, reusable selection set but with a few extra features
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Directives @skip & @include supported by the specification but system implementations can add their own
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Schema Definition Language (SDL) Concise way to define and document GraphQL schemas You can think of SDL as the Data Definition Language (DDL) and the query language as the Data Manipulation Language (DML)
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Scalars Create scalar types with custom validation, parsing, and serialization Use Cases: email, timestamps, phone numbers, any regex checked string
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Objects Contain a set of fields each of which is of a specific type A very common building block Root types (Query, Mutation, Subscription) are also Object types
  • 21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Enumerations Denotes a scalar that is of a predetermined set of values
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Interfaces Defines a common set of fields. Object types implement interfaces. Query with fragments
  • 23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Unions A union says than an object is one of a set of types. Query with fragments
  • 24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Gives clients the power to ask for what they need… • Each UI component has its own data requirements • The same backend model can be viewed in different ways • The network is precious • The security boundary should be defined by the backend, not the UI • A queryable API is a better solution than different endpoints per view
  • 25. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Use case: Master-detail views DetailMaster
  • 26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Makes it easier to evolve APIs over time… • GraphQL requires that every request specify every field • We know what is being used = we can deprecate with confidence • Schema allows for marking fields as deprecated!
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Powerful Developer Tools • Optimized, caching and offline client libraries • Introspection • Code generation • IDE integrations • Data visualizations
  • 28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Demo: GraphQL In Action
  • 29. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved Pop-up Loft aws.amazon.com/mobile @AWSforMobile Everything you need to connect Your mobile app to the cloud