diff --git a/README.md b/README.md index aece066..17c1e1f 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,10 @@ And so after a lot of coffee and some avocado toasts Super Graph was born. An in - High performance GO codebase - Tiny docker image and low memory requirements +## Documentation + +[supergraph.dev](https://supergraph.dev) + ## Contact me [twitter.com/dosco](https://twitter.com/dosco) diff --git a/docs/README.md b/docs/README.md index af8e4e2..c7cbba6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -22,15 +22,20 @@ Without writing a line of code get an instant high-performance GraphQL API for y ## Try it out ```bash -# setup the demo rails app database -docker-compose run web rake db:create db:migrate db:seed +# download super graph source +git clone https://github.com/dosco/super-graph.git -# run the demo rails app and the Super Graph service -docker-compose -f docker-compose.image.yml up +# setup the demo rails app & database +./demo setup -# try out the GraphQL api with the web ui in your browser +# run the demo +./demo run + +# signin to the demo app (user1@demo.com / 123456) +open http://localhost:3000 + +# try the super graph web ui open http://localhost:8080 - ``` ## Try this GraphQL query diff --git a/docs/guide.md b/docs/guide.md index 7f8ff9c..bb9ece3 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -18,6 +18,32 @@ Without writing a line of code get an instant high-performance GraphQL API for y - High performance GO codebase - Tiny docker image and low memory requirements +## Try it out + +```bash +# download super graph source +git clone https://github.com/dosco/super-graph.git + +# setup the demo rails app & database +./demo setup + +# run the demo +./demo run + +# signin to the demo app (user1@demo.com / 123456) +open http://localhost:3000 + +# try the super graph web ui +open http://localhost:8080 +``` + +::: warning DEMO REQUIREMENTS +This demo requires `docker` you can either install it using `brew` or from the +docker website https://docs.docker.com/docker-for-mac/install/ +::: + +#### Trying out GraphQL + We currently support the `query` action which is used for fetching data. Support for `mutation` and `subscriptions` is work in progress. For example the below GraphQL query would fetch two products that belong to the current user where the price is greater than 10 #### GQL Query @@ -71,26 +97,6 @@ For example there is a while greater than `gt` and a limit clause on a child fie } ``` -The above command will download the latest docker image for Super Graph and use it to run an example that includes a Postgres DB and a simple Rails ecommerce store app. - -If you want to build and run Super Graph from code then the below commands will build the web ui and launch Super Graph in developer mode with a watcher to rebuild on code changes. - -```bash - -# yarn is needed to build the web ui -brew install yarn - -# yarn install dependencies and build the web ui -(cd web && yarn install && yarn build) - -# generate some stuff the go code needs -go generate ./... - -# start super graph in development mode with a change watcher -docker-compose up - -``` - #### Try with an authenticated user In development mode you can use the `X-User-ID: 4` header to set a user id so you don't have to worries about cookies etc. This can be set using the *HTTP Headers* tab at the bottom of the web UI you'll see when you visit the above link. You can also directly run queries from the commandline like below. @@ -558,6 +564,30 @@ If your Rails app runs on Kubernetes then ensure you have an ingress config depl ### JWT tokens (Auth0, etc) In that case deploy under a subdomain and configure this service to use JWT authentication. You will need the public key file or secret key. Ensure your web app passes the JWT token with every GQL request in the Authorize header as a `bearer` token. +## Developing Super Graph + +If you want to build and run Super Graph from code then the below commands will build the web ui and launch Super Graph in developer mode with a watcher to rebuild on code changes. And the demo rails app is also launched to make it essier to test changes. + +```bash + +# yarn is needed to build the web ui +brew install yarn + +# yarn install dependencies and build the web ui +(cd web && yarn install && yarn build) + +# generate some stuff the go code needs +go generate ./... + +# do this the only the time to setup the database +docker-compose run web rake db:create db:migrate + +# start super graph in development mode with a change watcher +docker-compose up + +``` + + ## MIT License MIT Licensed | Copyright © 2018-present Vikram Rangnekar \ No newline at end of file diff --git a/rails-app/README.md b/rails-app/README.md deleted file mode 100644 index 7db80e4..0000000 --- a/rails-app/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# README - -This README would normally document whatever steps are necessary to get the -application up and running. - -Things you may want to cover: - -* Ruby version - -* System dependencies - -* Configuration - -* Database creation - -* Database initialization - -* How to run the test suite - -* Services (job queues, cache servers, search engines, etc.) - -* Deployment instructions - -* ...