GraphQL
Better alternative for Restful apis
jaro@nous.lt | @chompomonim | +JaroSatkevic
Full stack
Full stack
Back-end
Business logic
Database
Algorithms
Full stack
Back-end
Business logic
Database
Algorithms
Font-end
DOM
JavaScript
Styling/CSS
Design
Full stack
Back-end
Business logic
Database
Algorithms
Font-end
DOM
JavaScript
Styling/CSS
Design
Operations
Deployment
Server administration
Backups
Full stack
Back-end
Business logic
Database
Algorithms
Font-end
DOM
JavaScript
Styling/CSS
Design
User testing
Operations
Management
Product ownership
Deployment
Server administration
Backups
Marketing
- About GraphQL with full stack in mind
- Basics and short history of GraphQL
- My experience with Apollo stack
- GraphQL server - where to start, what to avoid
AGENDA
REST is cool, but...
How many queries do we need to render this view?
Over-fetching
Hard to design "proper" api
Documentation hell
Data fetching is a problem
What is GraphQL?
A query language for your API
Short facts:
- Invented at Facebook 4 years ago
- OpenSourced in summer 2015
- Already used at Github, Pinterest, Coursera, Shopify, Intuit, WIX and many more ...
{
presentation(id: "20161221-2") {
title
date
presenter {
name
email
}
}
}
{"data": {
presentations: {
title: "GraphQL - better approach for API",
date: 1482337923,
presenter: {
name: "Jaro Šatkevič",
email: "jaro@nous.lt"
}
}
}
type Presentation {
id: String!
title: String
date: Int
presenter: Presenter
}
type Presenter {
name
email
presentations: [Presentation]
}
GraphQL clients
Relay
Features I wanted as UI developer
- Fast data queries with all&only needed data
- Data caching, to avoid refetching
- Allow to work offline
- Specify queries, parses data
- Easy to paginate
- Execute mutations, with cache and pagination
GraphQL server isn't that easy...
Tips & tricks
- Use limits on bigger amount of data
- Define schema first
- Read carefully full specification, it may help
Questions
jaro@nous.lt | @chompomonim | +JaroSatkevic
GraphQL
By Jaro
GraphQL
- 1,118