SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
The
Serverless GraphQL
Backend Architecture
@nikolasburk
Nikolas Burk 👋
Developer at Graphcool
$ whoami
@nikolasburk
Agenda
1. GraphQL Introduction
2. GraphQL Core Concepts
3. Serverless GraphQL Backend Architecture
GraphQL Introduction
What’s GraphQL?
• new API standard by Facebook
• query language for APIs
• declarative way of fetching & updating data
@nikolasburk
Mary
Mary’s posts:
Learn GraphQL Today
Why GraphQL is better than
REST
React & GraphQL - A declarative
love story
Relay vs Apollo - GraphQL
clients
Last three followers:
John, Alice, Sarah
Example: Blogging App
Example: Blogging App with REST
/users/<id>
/users/<id>/posts
/users/<id>/followers
3 API endpoints
1 Fetch user data
/users/<id>/users/<id>
/users/<id>/posts
/users/<id>/followers
{
“user”: {
“id”: “er3tg439frjw”
“name”: “Mary”,
“address”: { … },
“birthday”: “July 26, 1982”
}
}
HTTP GET
Mary
Mary’s posts:
Last three followers:
2
/users/<id>
/users/<id>/posts
/users/<id>/followers
Fetch posts
HTTP GET
{
“posts”: [{
“id”: “ncwon3ce89hs”
“title”: “Learn GraphQL today”,
“content”: “Lorem ipsum … ”,
“comments”: [ … ],
}, {
“id”: “dsifr3as0vds”
“title”: “React & GraphQL - A declarative love story”,
“content”: “Lorem ipsum … ”,
“comments”: [ … ],
}, {
“id”: “die5odnvls1o”
“title”: “Why GraphQL is better than REST”,
“content”: “Lorem ipsum … ”,
“comments”: [ … ],
}, {
“id”: “dovmdr3nvl8f”
“title”: “Relay vs Apollo - GraphQL clients”,
“content”: “Lorem ipsum … ”,
“comments”: [ … ],
}]
}
Mary
Mary’s posts:
Learn GraphQL Today
Why GraphQL is better than REST
React & GraphQL - A declarative
love story
Relay vs Apollo - GraphQL clients
Last three followers:
/users/<id>
/users/<id>/posts
/users/<id>/followers
HTTP GET
{
“followers”: [{
“id”: “leo83h2dojsu”
“name”: “John”,
“address”: { … },
“birthday”: “January 6, 1970”
},{
“id”: “die5odnvls1o”
“name”: “Alice”,
“address”: { … },
“birthday”: “May 1, 1989”
}{
“id”: “xsifr3as0vds”
“name”: “Sarah”,
“address”: { … },
“birthday”: “November 20, 1986”
}
…
]
}
Mary
Mary’s posts:
Learn GraphQL Today
Why GraphQL is better than REST
React & GraphQL - A declarative
love story
Relay vs Apollo - GraphQL clients
Last three followers:
John, Alice, Sarah
Fetch followers3
1 API endpoint
Example: Blogging App with GraphQL
Mary’s posts:
Last three followers:
Fetch everything with a single request1
HTTP POST
query {
User(id: “er3tg439frjw”) {
name
posts {
title
}
followers(last: 3) {
name
}
}
}
Mary’s posts:
Last three followers:
Mary
Learn GraphQL Today
Why GraphQL is better than REST
React & GraphQL - A declarative
love story
Relay vs Apollo - GraphQL clients
John, Alice, Sarah
Fetch everything with a single request1
HTTP POST
{
“data”: {
“User”: {
“name”: “Mary”,
“posts”: [
{ title: “Learn GraphQL today” },
{ title: “React & GraphQL - A declarative love story” }
{ title: “Why GraphQL is better than REST” }
{ title: “Relay vs Apollo - GraphQL Clients” }
],
“followers”: [
{ name: “John” },
{ name: “Alice” },
{ name: “Sarah” },
]
}
}
}
GraphQL Core Concepts
1. Queries
2. Mutations
3. GraphQL Schema
4. Resolver Functions
@nikolasburk
Another Example: Chat
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
Queries
… only read data
query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
@nikolasburk
Queries
… only read data
query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
@nikolasburk
Operation Type
Queries
… only read data
@nikolasburk
Operation Name query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
Queries
… only read data
@nikolasburk
Fields query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
Queries
… only read data
@nikolasburk
Root Field query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
Queries
… only read data
@nikolasburk
Payload query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
Queries
… only read data
query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
“name”: “Sarah”
}
}
}
}
@nikolasburk
Queries
… only read data
query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
“name”: “Sarah”
}
}
}
}
@nikolasburk
Queries
… only read data
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
“name”: “Sarah”
}
}
}
}
@nikolasburk
query MessageQuery {
Message(id: “1”) {
text
sentBy {
name
}
}
}
Mutations
… write and read data
mutation CreateMessageMutation {
createMessage(text:“Greetings 👋”) {
id
}
}
{
“data”: {
“createMessage”: {
“id”: “3”,
}
}
}
@nikolasburk
Mutations
… write and read data
mutation CreateMessageMutation {
createMessage(text:“Greetings 👋”) {
id
}
}
{
“data”: {
“createMessage”: {
“id”: “3”,
}
}
}
@nikolasburk
The GraphQL Schema
@nikolasburk
• written in Schema Definition Language (SDL)
• defines API capabilities ( = contract for client-server
communication)
• root types: Query, Mutation, Subscription
@nikolasburk
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
type Query {
Message(id: ID!): Message
}
Root Types: Query
@nikolasburk
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
type Query {
Message(id: ID!): Message
}
Root Types: Query
@nikolasburk
{
allMessages {
text
sentBy {
name
}
}
}
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Root Types: Query
@nikolasburk
{
allMessages {
text
sentBy {
name
}
}
}
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Root Types: Query
@nikolasburk
mutation {
createMessage(text:“Hi”) {
id
}
}
type Mutation {
createMessage(text: String!): Message
}
Root Types: Mutation
@nikolasburk
mutation {
createMessage(text:“Hi”) {
id
}
}
type Mutation {
createMessage(text: String!): Message
}
Root Types: Mutation
@nikolasburk
mutation {
updateMessage(
id: “1”,
text: “Hi”
) {
id
}
}
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
}
Root Types: Mutation
@nikolasburk
mutation {
updateMessage(
id: “1”,
text: “Hi”
) {
id
}
}
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
}
Root Types: Mutation
@nikolasburk
mutation {
deleteMessage(id: “1”) {
id
}
}
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
Root Types: Mutation
@nikolasburk
mutation {
deleteMessage(id: “1”) {
id
}
}
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
Root Types: Mutation
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Full* Schema
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
Let’s play
…with GraphQL Playgrounds
▷
Resolver Functions
@nikolasburk
• each field in the schema is backed by a resolver
• the type of a resolver is identical to the type of the
field (including arguments)
• a query is resolved by calling the resolvers for its fields
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”:
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
}
}
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”
}
}
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
}
}
}
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
“name”: “Sarah”
}
}
}
}
@nikolasburk
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
Resolver Functions
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
type Person {
name: String!
messages: [Message!]!
}
type Message {
text: String!
sentBy: Person
}
{
Message(id: “1”) {
text
sentBy {
name
}
}
}
{
“data”: {
“Message”: {
“text”: “Hello 😎”,
“sentBy”: {
“name”: “Sarah”
}
}
}
}
The
Serverless GraphQL
Backend Architecture
A New Abstraction for
Backend Development
• automatically generated CRUD GraphQL API
based on data model
• event-driven core to implement business
logic
• global type system determined by GraphQL
schema
@nikolasburk
CRUD GraphQL API
@nikolasburk
type Message {
text: String!
sentBy: Person
}
type Query {
Message(id: ID!): Message
allMessages: [Message!]!
}
type Mutation {
createMessage(text: String!): Message
updateMessage(id: ID!, text: String!): Message
deleteMessage(id: ID!): Message
}
Event-driven Business Logic
• synchronous events for data validation &
transformation
• asynchronous events for application logic
• all implemented with serverless functions
@nikolasburk
Global Type System
• all data flowing through the system is typed
• types are defined in the GraphQL schema
• ideally using a typed language
@nikolasburk
Graphcool
The Serverless GraphQL Backend
@nikolasburk
Graphcool & Serverless Functions
• Request Pipeline - synchronous data
validation & transformation
• Server-side Subscriptions - triggering
asynchronous events
• Schema Extensions - custom GraphQL
queries & mutations
@nikolasburk
Resources 📚
• How to GraphQL - The Fullstack Tutorial for GraphQL
• GraphQL Weekly Newsletter
• GraphQL Radio Podcast
We’re hiring!
www.graph.cool/jobs
Thank you! 🙇
… any questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

GraphQL with Spring Boot
GraphQL with Spring BootGraphQL with Spring Boot
GraphQL with Spring Boot
 
Austin Day of Rest - Introduction
Austin Day of Rest - IntroductionAustin Day of Rest - Introduction
Austin Day of Rest - Introduction
 
Building Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET CoreBuilding Beautiful REST APIs in ASP.NET Core
Building Beautiful REST APIs in ASP.NET Core
 
The Lonesome LOD Cloud
The Lonesome LOD CloudThe Lonesome LOD Cloud
The Lonesome LOD Cloud
 
Creating 3rd Generation Web APIs with Hydra
Creating 3rd Generation Web APIs with HydraCreating 3rd Generation Web APIs with Hydra
Creating 3rd Generation Web APIs with Hydra
 
RESTful Web API and MongoDB go for a pic nic
RESTful Web API and MongoDB go for a pic nicRESTful Web API and MongoDB go for a pic nic
RESTful Web API and MongoDB go for a pic nic
 
On the Persistence of Persistent Identifiers of the Scholarly Web
On the Persistence of Persistent Identifiers of the Scholarly WebOn the Persistence of Persistent Identifiers of the Scholarly Web
On the Persistence of Persistent Identifiers of the Scholarly Web
 
Linked Data Fragments
Linked Data FragmentsLinked Data Fragments
Linked Data Fragments
 
DBpedia's Triple Pattern Fragments
DBpedia's Triple Pattern FragmentsDBpedia's Triple Pattern Fragments
DBpedia's Triple Pattern Fragments
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Technologies, methods and challenges to data sharing and aggrigation
Technologies, methods and challenges to data sharing and aggrigationTechnologies, methods and challenges to data sharing and aggrigation
Technologies, methods and challenges to data sharing and aggrigation
 
Kql and the content search web part
Kql and the content search web part Kql and the content search web part
Kql and the content search web part
 
Live DBpedia querying with high availability
Live DBpedia querying with high availabilityLive DBpedia querying with high availability
Live DBpedia querying with high availability
 
Sustainable queryable access to Linked Data
Sustainable queryable access to Linked DataSustainable queryable access to Linked Data
Sustainable queryable access to Linked Data
 
Log File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkitLog File Analysis: The most powerful tool in your SEO toolkit
Log File Analysis: The most powerful tool in your SEO toolkit
 
The Future is Federated
The Future is FederatedThe Future is Federated
The Future is Federated
 
Querying datasets on the Web with high availability
Querying datasets on the Web with high availabilityQuerying datasets on the Web with high availability
Querying datasets on the Web with high availability
 
Building your first app with MongoDB
Building your first app with MongoDBBuilding your first app with MongoDB
Building your first app with MongoDB
 
Initial Usage Analysis of DBpedia's Triple Pattern Fragments
Initial Usage Analysis of DBpedia's Triple Pattern FragmentsInitial Usage Analysis of DBpedia's Triple Pattern Fragments
Initial Usage Analysis of DBpedia's Triple Pattern Fragments
 
Synchronicity: Just-In-Time Discovery of Lost Web Pages
Synchronicity: Just-In-Time Discovery of Lost Web PagesSynchronicity: Just-In-Time Discovery of Lost Web Pages
Synchronicity: Just-In-Time Discovery of Lost Web Pages
 

Ähnlich wie The Serverless GraphQL Backend Architecture

Ähnlich wie The Serverless GraphQL Backend Architecture (20)

Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało[DevCrowd] GraphQL - gdy API RESTowe to za mało
[DevCrowd] GraphQL - gdy API RESTowe to za mało
 
Next-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and PrismaNext-generation API Development with GraphQL and Prisma
Next-generation API Development with GraphQL and Prisma
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learnedBruJUG Brussels GraphQL when RESR API is to less - lessons learned
BruJUG Brussels GraphQL when RESR API is to less - lessons learned
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & Clients
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
Building and deploying GraphQL Servers with AWS Lambda and Prisma I AWS Dev D...
Building and deploying GraphQL Servers with AWS Lambda and Prisma I AWS Dev D...Building and deploying GraphQL Servers with AWS Lambda and Prisma I AWS Dev D...
Building and deploying GraphQL Servers with AWS Lambda and Prisma I AWS Dev D...
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
GraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za małoGraphQL - gdy API RESTowe to za mało
GraphQL - gdy API RESTowe to za mało
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 
GraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database accessGraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database access
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
 
Elasticsearch for SQL Users
Elasticsearch for SQL UsersElasticsearch for SQL Users
Elasticsearch for SQL Users
 
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
 

Mehr von Nikolas Burk

Mehr von Nikolas Burk (8)

Code-first GraphQL Server Development with Prisma
Code-first  GraphQL Server Development with PrismaCode-first  GraphQL Server Development with Prisma
Code-first GraphQL Server Development with Prisma
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
GraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & ContentfulGraphQL Schema Stitching with Prisma & Contentful
GraphQL Schema Stitching with Prisma & Contentful
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
 
Building GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & PrismaBuilding GraphQL Servers with Node.JS & Prisma
Building GraphQL Servers with Node.JS & Prisma
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
 
State Management & Unidirectional Data Flow
State Management & Unidirectional Data FlowState Management & Unidirectional Data Flow
State Management & Unidirectional Data Flow
 
Getting Started with Relay Modern
Getting Started with Relay ModernGetting Started with Relay Modern
Getting Started with Relay Modern
 

Kürzlich hochgeladen

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Kürzlich hochgeladen (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

The Serverless GraphQL Backend Architecture

  • 2. Nikolas Burk 👋 Developer at Graphcool $ whoami @nikolasburk
  • 3. Agenda 1. GraphQL Introduction 2. GraphQL Core Concepts 3. Serverless GraphQL Backend Architecture
  • 5. What’s GraphQL? • new API standard by Facebook • query language for APIs • declarative way of fetching & updating data @nikolasburk
  • 6. Mary Mary’s posts: Learn GraphQL Today Why GraphQL is better than REST React & GraphQL - A declarative love story Relay vs Apollo - GraphQL clients Last three followers: John, Alice, Sarah Example: Blogging App
  • 7. Example: Blogging App with REST /users/<id> /users/<id>/posts /users/<id>/followers 3 API endpoints
  • 8. 1 Fetch user data /users/<id>/users/<id> /users/<id>/posts /users/<id>/followers { “user”: { “id”: “er3tg439frjw” “name”: “Mary”, “address”: { … }, “birthday”: “July 26, 1982” } } HTTP GET Mary Mary’s posts: Last three followers:
  • 9. 2 /users/<id> /users/<id>/posts /users/<id>/followers Fetch posts HTTP GET { “posts”: [{ “id”: “ncwon3ce89hs” “title”: “Learn GraphQL today”, “content”: “Lorem ipsum … ”, “comments”: [ … ], }, { “id”: “dsifr3as0vds” “title”: “React & GraphQL - A declarative love story”, “content”: “Lorem ipsum … ”, “comments”: [ … ], }, { “id”: “die5odnvls1o” “title”: “Why GraphQL is better than REST”, “content”: “Lorem ipsum … ”, “comments”: [ … ], }, { “id”: “dovmdr3nvl8f” “title”: “Relay vs Apollo - GraphQL clients”, “content”: “Lorem ipsum … ”, “comments”: [ … ], }] } Mary Mary’s posts: Learn GraphQL Today Why GraphQL is better than REST React & GraphQL - A declarative love story Relay vs Apollo - GraphQL clients Last three followers:
  • 10. /users/<id> /users/<id>/posts /users/<id>/followers HTTP GET { “followers”: [{ “id”: “leo83h2dojsu” “name”: “John”, “address”: { … }, “birthday”: “January 6, 1970” },{ “id”: “die5odnvls1o” “name”: “Alice”, “address”: { … }, “birthday”: “May 1, 1989” }{ “id”: “xsifr3as0vds” “name”: “Sarah”, “address”: { … }, “birthday”: “November 20, 1986” } … ] } Mary Mary’s posts: Learn GraphQL Today Why GraphQL is better than REST React & GraphQL - A declarative love story Relay vs Apollo - GraphQL clients Last three followers: John, Alice, Sarah Fetch followers3
  • 11. 1 API endpoint Example: Blogging App with GraphQL
  • 12. Mary’s posts: Last three followers: Fetch everything with a single request1 HTTP POST query { User(id: “er3tg439frjw”) { name posts { title } followers(last: 3) { name } } }
  • 13. Mary’s posts: Last three followers: Mary Learn GraphQL Today Why GraphQL is better than REST React & GraphQL - A declarative love story Relay vs Apollo - GraphQL clients John, Alice, Sarah Fetch everything with a single request1 HTTP POST { “data”: { “User”: { “name”: “Mary”, “posts”: [ { title: “Learn GraphQL today” }, { title: “React & GraphQL - A declarative love story” } { title: “Why GraphQL is better than REST” } { title: “Relay vs Apollo - GraphQL Clients” } ], “followers”: [ { name: “John” }, { name: “Alice” }, { name: “Sarah” }, ] } } }
  • 14. GraphQL Core Concepts 1. Queries 2. Mutations 3. GraphQL Schema 4. Resolver Functions
  • 15. @nikolasburk Another Example: Chat type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person }
  • 16. Queries … only read data query MessageQuery { Message(id: “1”) { text sentBy { name } } } @nikolasburk
  • 17. Queries … only read data query MessageQuery { Message(id: “1”) { text sentBy { name } } } @nikolasburk Operation Type
  • 18. Queries … only read data @nikolasburk Operation Name query MessageQuery { Message(id: “1”) { text sentBy { name } } }
  • 19. Queries … only read data @nikolasburk Fields query MessageQuery { Message(id: “1”) { text sentBy { name } } }
  • 20. Queries … only read data @nikolasburk Root Field query MessageQuery { Message(id: “1”) { text sentBy { name } } }
  • 21. Queries … only read data @nikolasburk Payload query MessageQuery { Message(id: “1”) { text sentBy { name } } }
  • 22. Queries … only read data query MessageQuery { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { “name”: “Sarah” } } } } @nikolasburk
  • 23. Queries … only read data query MessageQuery { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { “name”: “Sarah” } } } } @nikolasburk
  • 24. Queries … only read data { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { “name”: “Sarah” } } } } @nikolasburk query MessageQuery { Message(id: “1”) { text sentBy { name } } }
  • 25. Mutations … write and read data mutation CreateMessageMutation { createMessage(text:“Greetings 👋”) { id } } { “data”: { “createMessage”: { “id”: “3”, } } } @nikolasburk
  • 26. Mutations … write and read data mutation CreateMessageMutation { createMessage(text:“Greetings 👋”) { id } } { “data”: { “createMessage”: { “id”: “3”, } } } @nikolasburk
  • 27. The GraphQL Schema @nikolasburk • written in Schema Definition Language (SDL) • defines API capabilities ( = contract for client-server communication) • root types: Query, Mutation, Subscription
  • 28. @nikolasburk { Message(id: “1”) { text sentBy { name } } } type Query { Message(id: ID!): Message } Root Types: Query
  • 29. @nikolasburk { Message(id: “1”) { text sentBy { name } } } type Query { Message(id: ID!): Message } Root Types: Query
  • 30. @nikolasburk { allMessages { text sentBy { name } } } type Query { Message(id: ID!): Message allMessages: [Message!]! } Root Types: Query
  • 31. @nikolasburk { allMessages { text sentBy { name } } } type Query { Message(id: ID!): Message allMessages: [Message!]! } Root Types: Query
  • 32. @nikolasburk mutation { createMessage(text:“Hi”) { id } } type Mutation { createMessage(text: String!): Message } Root Types: Mutation
  • 33. @nikolasburk mutation { createMessage(text:“Hi”) { id } } type Mutation { createMessage(text: String!): Message } Root Types: Mutation
  • 34. @nikolasburk mutation { updateMessage( id: “1”, text: “Hi” ) { id } } type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message } Root Types: Mutation
  • 35. @nikolasburk mutation { updateMessage( id: “1”, text: “Hi” ) { id } } type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message } Root Types: Mutation
  • 36. @nikolasburk mutation { deleteMessage(id: “1”) { id } } type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } Root Types: Mutation
  • 37. @nikolasburk mutation { deleteMessage(id: “1”) { id } } type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } Root Types: Mutation
  • 38. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Full* Schema type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person }
  • 39. Let’s play …with GraphQL Playgrounds ▷
  • 40. Resolver Functions @nikolasburk • each field in the schema is backed by a resolver • the type of a resolver is identical to the type of the field (including arguments) • a query is resolved by calling the resolvers for its fields
  • 41. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person }
  • 42. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person }
  • 43. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: }
  • 44. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { } } }
  • 45. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎” } } }
  • 46. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { } } } }
  • 47. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { “name”: “Sarah” } } } }
  • 48. @nikolasburk type Query { Message(id: ID!): Message allMessages: [Message!]! } Resolver Functions type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message } type Person { name: String! messages: [Message!]! } type Message { text: String! sentBy: Person } { Message(id: “1”) { text sentBy { name } } } { “data”: { “Message”: { “text”: “Hello 😎”, “sentBy”: { “name”: “Sarah” } } } }
  • 50. A New Abstraction for Backend Development • automatically generated CRUD GraphQL API based on data model • event-driven core to implement business logic • global type system determined by GraphQL schema @nikolasburk
  • 51. CRUD GraphQL API @nikolasburk type Message { text: String! sentBy: Person } type Query { Message(id: ID!): Message allMessages: [Message!]! } type Mutation { createMessage(text: String!): Message updateMessage(id: ID!, text: String!): Message deleteMessage(id: ID!): Message }
  • 52. Event-driven Business Logic • synchronous events for data validation & transformation • asynchronous events for application logic • all implemented with serverless functions @nikolasburk
  • 53. Global Type System • all data flowing through the system is typed • types are defined in the GraphQL schema • ideally using a typed language @nikolasburk
  • 54. Graphcool The Serverless GraphQL Backend @nikolasburk
  • 55. Graphcool & Serverless Functions • Request Pipeline - synchronous data validation & transformation • Server-side Subscriptions - triggering asynchronous events • Schema Extensions - custom GraphQL queries & mutations @nikolasburk
  • 56. Resources 📚 • How to GraphQL - The Fullstack Tutorial for GraphQL • GraphQL Weekly Newsletter • GraphQL Radio Podcast
  • 58. Thank you! 🙇 … any questions?