2020-04-11 22:41:10 +02:00
< img src = "docs/guide/.vuepress/public/super-graph.png" width = "250" / >
2019-11-05 05:44:42 +01:00
2020-04-24 03:01:00 +02:00
### Build web products faster. Secure high-performance GraphQL
2019-03-24 14:57:29 +01:00
2020-04-11 22:41:10 +02:00
[![GoDoc ](https://img.shields.io/badge/godoc-reference-5272B4.svg )](https://pkg.go.dev/github.com/dosco/super-graph/core?tab=doc)
![Apache 2.0 ](https://img.shields.io/github/license/dosco/super-graph.svg?style=flat-square )
![Docker build ](https://img.shields.io/docker/cloud/build/dosco/super-graph.svg?style=flat-square )
![Cloud native ](https://img.shields.io/badge/cloud--native-enabled-blue.svg?style=flat-squareg )
2019-10-05 04:20:54 +02:00
[![Discord Chat ](https://img.shields.io/discord/628796009539043348.svg )](https://discord.gg/6pSWCTZ)
2019-03-24 14:57:29 +01:00
2020-04-11 22:41:10 +02:00
## What's Super Graph?
2019-11-30 04:29:31 +01:00
2020-04-24 03:01:00 +02:00
Designed to 100x your developer productivity. Super Graph will instantly, and without you writing any code, provide a high performance GraphQL API for your PostgresSQL DB. GraphQL queries are compiled into a single fast SQL query. Super Graph is a Go library and a service, use it in your own code or run it as a separate service.
2019-11-30 04:29:31 +01:00
2020-04-11 22:41:10 +02:00
## Using it as a service
2019-11-30 04:29:31 +01:00
2020-04-11 22:41:10 +02:00
```console
2020-04-24 03:01:00 +02:00
go get github.com/dosco/super-graph
2020-04-11 22:41:10 +02:00
super-graph new < app_name >
```
2019-03-30 06:11:30 +01:00
2020-04-11 22:41:10 +02:00
## Using it in your own code
```golang
package main
import (
"database/sql"
"fmt"
"time"
"github.com/dosco/super-graph/core"
_ "github.com/jackc/pgx/v4/stdlib"
)
func main() {
db, err := sql.Open("pgx", "postgres://postgrs:@localhost:5432/example_db")
if err != nil {
2020-04-24 03:24:41 +02:00
log.Fatal(err)
2020-04-11 22:41:10 +02:00
}
2020-04-24 03:21:45 +02:00
sg, err := core.NewSuperGraph(nil, db)
2020-04-11 22:41:10 +02:00
if err != nil {
2020-04-24 03:24:41 +02:00
log.Fatal(err)
2020-04-11 22:41:10 +02:00
}
query := `
query {
posts {
id
title
}
}`
res, err := sg.GraphQL(context.Background(), query, nil)
if err != nil {
2020-04-24 03:24:41 +02:00
log.Fatal(err)
2020-04-11 22:41:10 +02:00
}
fmt.Println(string(res.Data))
}
```
2019-11-30 04:29:31 +01:00
2020-04-11 22:41:10 +02:00
## About Super Graph
2019-03-24 14:57:29 +01:00
2020-04-24 03:01:00 +02:00
After working on several products through my career I found that we spend way too much time on building API backends. Most APIs also need constant updating, and this costs time and money.
2019-10-01 06:00:15 +02:00
It's always the same thing, figure out what the UI needs then build an endpoint for it. Most API code involves struggling with an ORM to query a database and mangle the data into a shape that the UI expects to see.
2019-03-24 14:57:29 +01:00
2019-10-01 06:00:15 +02:00
I didn't want to write this code anymore, I wanted the computer to do it. Enter GraphQL, to me it sounded great, but it still required me to write all the same database query code.
2019-03-24 14:57:29 +01:00
2019-10-01 06:00:15 +02:00
Having worked with compilers before I saw this as a compiler problem. Why not build a compiler that converts GraphQL to highly efficient SQL.
2020-04-24 03:01:00 +02:00
This compiler is what sits at the heart of Super Graph, with layers of useful functionality around it like authentication, remote joins, rails integration, database migrations, and everything else needed for you to build production-ready apps with it.
2019-03-24 14:57:29 +01:00
## Features
2019-10-01 06:00:15 +02:00
2019-12-31 07:30:20 +01:00
- Complex nested queries and mutations
- Auto learns database tables and relationships
2020-04-24 03:01:00 +02:00
- Role and Attribute-based access control
- Opaque cursor-based efficient pagination
- Full-text search and aggregations
2019-04-07 07:12:11 +02:00
- JWT tokens supported (Auth0, etc)
2019-12-31 07:30:20 +01:00
- Join database queries with remote REST APIs
- Also works with existing Ruby-On-Rails apps
- Rails authentication supported (Redis, Memcache, Cookie)
2019-11-05 06:43:32 +01:00
- A simple config file
2020-04-24 03:01:00 +02:00
- High performance Go codebase
2019-03-24 14:57:29 +01:00
- Tiny docker image and low memory requirements
2019-11-05 06:43:32 +01:00
- Fuzz tested for security
2019-10-01 06:00:15 +02:00
- Database migrations tool
2019-11-05 06:43:32 +01:00
- Database seeding tool
2020-02-12 04:12:53 +01:00
- Works with Postgres and YugabyteDB
2019-05-13 01:27:26 +02:00
2019-04-11 07:39:59 +02:00
## Documentation
[supergraph.dev ](https://supergraph.dev )
2019-03-24 14:57:29 +01:00
## Contact me
2019-10-25 07:39:59 +02:00
I'm happy to help you deploy Super Graph so feel free to reach out over
Twitter or Discord.
2019-10-05 04:20:54 +02:00
[twitter/dosco ](https://twitter.com/dosco )
[chat/super-graph ](https://discord.gg/6pSWCTZ )
2019-03-24 14:57:29 +01:00
## License
2019-11-28 07:25:46 +01:00
[Apache Public License 2.0 ](https://opensource.org/licenses/Apache-2.0 )
2019-03-24 14:57:29 +01:00
Copyright (c) 2019-present Vikram Rangnekar