Real-Time Serverless Back Ends with GraphQL

7c9b8b368924556d8642bdaed3ded1f5?s=47 Danilo Poccia
February 16, 2018

Real-Time Serverless Back Ends with GraphQL

JeffConf, Hamburg, February 16th, 2018

GraphQL is an open standard that lets you request, change, and subscribe to the exact data you need in a single network request. This makes prototyping and building data-intensive applications as simple as writing a few lines of code. In this session we’ll introduce the core concepts of GraphQL and put that into practice with real-world implementations using tools such as AWS Lambda and AWS AppSync to deliver real-time collaborative experiences for web and mobile apps, using multiple data sources, managing off-line users’ data, and resolving data conflicts.

7c9b8b368924556d8642bdaed3ded1f5?s=128

Danilo Poccia

February 16, 2018
Tweet

Transcript

  1. 1.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Real-Time Serverless Back Ends with GraphQL Danilo Poccia Technical Evangelist danilop@amazon.com @danilop danilop
  2. 2.

    What is GraphQL? Open, declarative data-fetching specification != Graph database

    Use NoSQL, Relational, HTTP, etc. Traditional data-fetching GraphQL /posts /postInfo /postJustTitle /postsByAuthor /postNameStartsWithX /commentsOnPost
  3. 3.

    How does GraphQL work? { "id": "1", "name": "Get Milk",

    “priority": "1" }, { "id": “2", "name": “Go to gym", “priority": “5" },… type Query { getTodos: [Todo] } type Todo { id: ID! name: String description: String priority: Int duedate: String } query { getTodos { id name priority } } Model data with application schema Client requests what it needs Only that data is returned
  4. 4.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. GraphQL Schema type Event { id: ID! name: String where: String when: String description: String comments: [Comment] } type Comment { commentId: String! eventId: ID! content: String! createdAt: String! }
  5. 5.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. GraphQL Schema Mutation type Mutation { createEvent( name: String!, when: String!, where: String!, description: String! ): Event deleteEvent(id: ID!): Event commentOnEvent( eventId: ID!, content: String!, createdAt: String! ): Comment }
  6. 6.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. GraphQL Schema Mutation Query type Query { getEvent(id: ID!): Event listEvents( limit: Int, nextToken: String ): EventConnection }
  7. 7.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. GraphQL Schema Mutation Query Subscription type Subscription { subscribeToEventComments(eventId: String!): Comment @aws_subscribe(mutations: ["commentOnEvent"]) }
  8. 8.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. GraphQL Schema Mutation Query Subscription
  9. 9.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Can you do … with GraphQL? Realtime? YES Batching? YES Pagination? YES Relations? YES Aggregations? YES Search? YES Offline? YES
  10. 10.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS AppSync DynamoDB Table Lambda Function Elasticsearch Service GraphQL Schema Upload Schema GraphQL Query Mutation Subscription Real-time Offline DynamoDB to Elasticsearch Sync Function AppSync API Cognito User Pool
  11. 11.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. AWS AppSync DynamoDB Table Lambda Function Elasticsearch Service GraphQL Schema Autogenerate Schema GraphQL Query Mutation Subscription Real-time Offline DynamoDB to Elasticsearch Sync Function AppSync API Cognito User Pool
  12. 13.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. What are you going to build?
  13. 14.

    © 2018, Amazon Web Services, Inc. or its Affiliates. All

    rights reserved. Real-Time Serverless Back Ends with GraphQL Danilo Poccia Technical Evangelist danilop@amazon.com @danilop danilop