Serverless 💚 GraphQL
Marcia Villalba
@mavi888uy
A Match make in heaven
What is graphql?
Let’s talk about the most important concepts
Marcia VillalbaServerless Days Milan
GraphQL is a specification
Not a framework
Not a database
Not a server
Marcia VillalbaServerless Days Milan
noSQL DB
HTTP service
SQL DB
Client GraphQL
Marcia VillalbaServerless Days Milan
noSQL DB
HTTP service
SQL DB
Client GraphQL
Schema
Marcia VillalbaServerless Days Milan
noSQL DB
HTTP service
SQL DB
Client GraphQL
Schema
Resolver
Marcia VillalbaServerless Days Milan
Graphql
Describe what you can
do using a type system
Marcia VillalbaServerless Days Milan
Graphql
Ask for what you need
an get exactly that
Marcia VillalbaServerless Days Milan
Graphql
Get many resources in
one request
Marcia VillalbaServerless Days Milan
Serverless promise
No managing infrastructure
Pay for what you use
Automagical scale
Marcia VillalbaServerless Days Milan
Graphql & serverless
Implement your own GraphQL server
Use an existing GraphQL server library
Use an existing GraphQL platform
AWS AppSync
A Serverless GraphQL platform
Marcia VillalbaServerless Days Milan
appSync
•Provides authentication
•Visual tool for queries
•Different datasources - AWS Lambda, Elastic
Search, RDS, HTTP
•Real time and off-line support
Marcia VillalbaServerless Days Milan
AWS Cloud
Client AWS
AppSync
AWS Lambda
Amazon
DynamoDB
VLT mappers
for request
and response
VLT mappers
for request
and response
Marcia VillalbaServerless Days Milan
Marcia VillalbaServerless Days Milan
Marcia VillalbaServerless Days Milan
Marcia VillalbaServerless Days Milan
Infrastructure as code
•Serverless Framework
•Serverless Framework plugin for AppSync (https://
github.com/sid88in/serverless-appsync-plugin)
Lets go to the code…
Marcia VillalbaServerless Days Milan
How the client uses this?
•AWS Amplify
•Client library for building cloud apps
•More info: https://aws-amplify.github.io/docs/js/
api#aws-appsync-sdk
Marcia VillalbaServerless Days Milan
Configure the client
Marcia VillalbaServerless Days Milan
Run a query
Marcia VillalbaServerless Days Milan
Things to have in mind
•If you do a DynamoDB scan be careful of
performance
•Calling a cold AWS Lambda
•Doing an HTTP call ads latency to the response
•Think about when calling other services from AWS
Lambda how much latency you are adding to the
whole system
Marcia VillalbaServerless Days Milan
Thanks!
You can ask questions
Marcia Villalba
@mavi888uy

Serverless Days Milano - Developing Serverless applications with GraphQL