super-graph/slides/overview.slide
2019-10-25 01:39:59 -04:00

102 lines
2.1 KiB
Plaintext

Super Graph
Instant GraphQL API for Rails. Zero Code.
Tags: GraphQL, API, GoLang, Postgres
Vikram Rangnekar
https://twitter.com/dosco
* Motivation
- Honestly, cause it was more fun than my real work.
- Bored of building yet anther CRUD API
- Save hours of my life
- Easier to use advanced Postgres features
- Always get secure, optimized queries
- Quickly add GraphQL to existing apps
* Got Web UI?
.image https://supergraph.dev/super-graph-web-ui.png _ 1000
* What does it do?
- Add a GraphQL API to any Rails app with zero code
- Automatically learns schemas and relationships
- Supports Belongs-To, One-To-Many and Many-To-Many relationships
- Full text search and Aggregations
- Rails Auth supported (Redis, Memcache, Cookie)
- JWT tokens supported (Auth0, etc)
- Highly optimized and fast Postgres SQL queries
* How does it work?
GraphQL Input
query {
users{
email
id
}
}
SQL Output
SELECT
"users_0"."email" AS "email",
"users_0"."id" AS "id"
FROM (
SELECT
"users"."email",
"users"."id"
FROM "users"
WHERE ((("users"."id") = ('4'))) limit ('20') :: integer)
LIMIT ('20') :: integer))
* Advanced Queries made simple
query {
products(
# Search for all products that contain 'ale' or some version of it
search: "ale"
# Return only matches where the price is less than 10
where: { price: { lt: 10 } }
# Use the search_rank to order from the best match to the worst
order_by: { search_rank: desc }) {
id
name
search_rank
search_headline_description
}
}
* Easy to configure
database:
variables:
account_id: "select account_id from users where id = $user_id"
defaults:
Filters: ["{ user_id: { eq: $user_id } }"]
blacklist:
- password
- secret_token
fields:
- name: users
Filters: ["{ id: { eq: $user_id } }"]
- name: products
Filters: [
"{ price: { gt: 0 } }",
"{ price: { lt: 8 } }"
]
- name: me
table: users
Filters: ["{ id: { eq: $user_id } }"]