95 lines
2.1 KiB
Plaintext
95 lines
2.1 KiB
Plaintext
|
Why GraphQL
|
||
|
GraphQL is the future of APIs
|
||
|
Tags: GraphQL, API, GoLang, Postgres
|
||
|
|
||
|
Vikram Rangnekar
|
||
|
https://twitter.com/@dosco
|
||
|
|
||
|
* Trends, Why APIs are Important
|
||
|
|
||
|
- An API first world
|
||
|
- Rise of API only startups
|
||
|
- Rise of integrations
|
||
|
- Rise of fullstack developers
|
||
|
- Rise of Single-Page-Apps
|
||
|
|
||
|
* Web Development Today
|
||
|
|
||
|
A big part of web development is building CRUD APIs to read
|
||
|
update and delete things from a database.
|
||
|
|
||
|
Get all products that belong to user 5
|
||
|
.link http://your-startup.com/apis/v1/users/5/products
|
||
|
|
||
|
Another way to do this
|
||
|
.link http://your-startup.com/apis/v1/products?user_id=5
|
||
|
|
||
|
Maybe you just need only cheaper products
|
||
|
.link http://your-startup.com/apis/v1/products?user_id=5&price_under=12
|
||
|
|
||
|
* So what's the problem here?
|
||
|
|
||
|
- Too many decisions no real standards
|
||
|
- Harder to be consistant
|
||
|
- Rinse and repeat for every new API
|
||
|
- Too much data over the wire
|
||
|
- Boring, we rather work on more interesting things
|
||
|
- Slows down dev. cycles
|
||
|
|
||
|
* GraphQL
|
||
|
|
||
|
query {
|
||
|
user(id: 5) {
|
||
|
|
||
|
products {
|
||
|
id
|
||
|
name
|
||
|
photo : image
|
||
|
|
||
|
customers {
|
||
|
name
|
||
|
email
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
* Perceived bad parts of GraphQL
|
||
|
|
||
|
- Perceived as new and shiny
|
||
|
- Not cache friendly (Not true)
|
||
|
- Only best data fetching
|
||
|
- New frameworks to learn
|
||
|
- Is it just an API gateway?
|
||
|
- Write more code
|
||
|
|
||
|
* Super Graph - An instant GraphQL API for Postgres
|
||
|
|
||
|
- GraphQL without writing any code
|
||
|
- Automatically learns your database
|
||
|
- Full text search, Aggregations, etc
|
||
|
- Supports Rails cookies and JWT tokens
|
||
|
- Join with remote REST APIs
|
||
|
- Highly optimized and fast Postgres SQL queries
|
||
|
- High performance GO codebase
|
||
|
- Tiny docker image and low memory requirements
|
||
|
|
||
|
* Let's talk about Postgres DB
|
||
|
|
||
|
- Atomicity, Consistency, Isolation, and Durability
|
||
|
- Full support for JSON
|
||
|
- Full-text search
|
||
|
- Graph DB (WITH RESURSIVE clause)
|
||
|
- Timeseries DB (WINDOW functions)
|
||
|
- GIS Location DB (PostGIS)
|
||
|
- Custom Columns (Bloomfilter, etc)
|
||
|
- Nearest Neighbour Searches (GIST Index)
|
||
|
- Row level security
|
||
|
- Versioning support
|
||
|
|
||
|
All your micro-services in one
|
||
|
|
||
|
* Super Graph gives Fullstack Devs superpowers
|
||
|
|
||
|
|
||
|
.iframe https://giphy.com/gifs/3o6ZsYzuLyRfSGX4f6/html5 500 900
|