GraphQL in Restorando
The problem
Public API
Redo Core
The problem
Public API
Redo Core
Mobile API
The problem
Public API
Redo Core
Ad-hoc code
Mobile API
The problem
Public API
Redo Core
Ad-hoc code
M-API v1
Ad-hoc code
M-API v2
The problem
Public API
Redo Core
Ad-hoc code
M-API v1
Ad-hoc code
M-API v2
Ad-hoc code
M-API v3
The solution
Public API
Redo Core
Ad-hoc code
M-API v1
Ad-hoc code
M-API v2
Ad-hoc code
M-API v3
GraphQL
The solution
Public API
Redo Core
Ad-hoc code
M-API v1
Ad-hoc code
M-API v2
Ad-hoc code
M-API v3
GraphQL
The solution
Public API
Redo Core
GraphQL
The solution
Redo Core
GraphQL
The solution
Merge all MAPIs in a single GraphQL endpoint
GraphQL
GraphQL
It's a language created by Facebook
Query or alter data in a remote repository
GraphQL
Been used in Facebook mobile apps since 3+ years
GraphQL
{ restaurant (id: 6) { name, address }
{ "data": { "restaurant": { "name": "Sucre", "address": "Sucre 676" } } }
GraphQL
{ restaurant (id: 6) { name, address }
{ "data": { "restaurant": { "name": "Sucre", "address": "Sucre 676" } } }
GraphQL
{ restaurant (id: 6) { name, address }
{ "data": { "restaurant": { "name": "Sucre", "address": "Sucre 676" } } }
GraphQL
{ restaurant (id: 6) { name, address, phone }
{ "data": { "restaurant": { "name": "Sucre", "address": "Sucre 676", "phone": "1148315716" } } }
GraphQL
{ restaurant (id: 6) { name, address, phone, cuisines { name } } }
{ "data": { "restaurant": { "name": "Sucre", "address": "Sucre 676", "phone": "1148315716", "cuisines": [ { "name": "De autor" } ] } } }
GraphQL
{
restaurant (id: 6) {
name
}
}
GraphQL
{ restaurant (id: 6) { name, primary_photo } }
GraphQL
{ restaurant (id: 6) { name, primary_photo (version: SQUARE) } }
GraphQL
{ restaurant (id: 6) { name, primary_photo (version: SQUARE) { url } } }
GraphQL
{ restaurant (id: 6) { name, primary_photo (version: SQUARE) { url } } }
{ "data": { "restaurant": { "name": "Sucre", "primary_photo": { "url": "http://imagescdn.r..." } } } }
Demo
Schema
The only source of truth
Schema
Defines queryable entities
Knows how to fetch data
Schema
Defines mutable entities
Knows how to alter data
Schema
Represents the data in a graph
Schema
Data source agnostic
GraphQL Schema
Self documented
Introspective
GET /graphql: GraphiQL
POST /graphql
POST /graphql HTTP/1.1 Content-Type: application/json { "query": "{ restaurant(id:6) { name, address, cuisines { name } } }" }
POST /graphql
POST /graphql HTTP/1.1
Content-Type: application/json
{
"query": "{ restaurant(id:6) { name, address, cuisines { name } } }"
}
POST /graphql
POST /graphql HTTP/1.1
Content-Type: application/json
{
"query": "{ restaurant(id:6) { name, address, cuisines { name } } }"
}
POST /graphql
POST /graphql HTTP/1.1 Content-Type: application/json { "query": "{ restaurant(id:6) { name, address, cuisines { name } } }" }
Thoughts on GraphQL
RFC spec in development
Implementations on 13+ languages
Awesome alternative to REST APIs
Facebook & community backed
Performant Promises handling
Questions?
Thanks!
GraphQL
By José Fresco
GraphQL
- 526