super-graph/slides/overview.slide

102 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2019-04-18 05:35:08 +02:00
Super Graph
Instant GraphQL API for Rails. Zero Code.
Tags: GraphQL, API, GoLang, Postgres
Vikram Rangnekar
2019-08-22 15:03:49 +02:00
https://twitter.com/dosco
2019-04-18 05:35:08 +02:00
* 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:
2019-10-25 07:39:59 +02:00
Filters: ["{ user_id: { eq: $user_id } }"]
2019-04-18 05:35:08 +02:00
blacklist:
- password
- secret_token
fields:
- name: users
2019-10-25 07:39:59 +02:00
Filters: ["{ id: { eq: $user_id } }"]
2019-04-18 05:35:08 +02:00
- name: products
2019-10-25 07:39:59 +02:00
Filters: [
2019-04-18 05:35:08 +02:00
"{ price: { gt: 0 } }",
"{ price: { lt: 8 } }"
]
- name: me
table: users
2019-10-25 07:39:59 +02:00
Filters: ["{ id: { eq: $user_id } }"]