Better way to build your API
- About GraphQL with full stack in mind
- Short history of GraphQL
- Simple python graphql server
- GraphQL server in real life - tips & tricks
REST is cool, but...
- SW Hero
- His home planet
- His starship
Hard to design "proper" api
How many queries do we need to render this view?
What is GraphQL?
A query language for your API
- Invented at Facebook 5 years ago
- OpenSourced in summer 2015
- Already used at Github, Pinterest, Coursera, Shopify, Intuit, WIX and many more ...
Anyway, why GraphQL?
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 on server
A lot of libraries
Some tricky places you should think about
How many queries into database?
How big is response for this request?
Tips & tricks
- Use limits on bigger amount of data (avoid asking for whole DB)
- Define schema first
- Read carefully full specification, it may help
- Prepare for caching your most advanced queries
Example app: https://github.com/chompomonim/python-graphql-example
GraphQL on Python meetup