{"id":15826379,"url":"https://github.com/hackintoshrao/dgraph-graphql-js","last_synced_at":"2025-10-08T07:33:57.161Z","repository":{"id":39399825,"uuid":"205870760","full_name":"hackintoshrao/dgraph-graphql-js","owner":"hackintoshrao","description":"Code snippets with GraphQL examples built using ApolloJS-React on top ","archived":false,"fork":false,"pushed_at":"2023-01-04T08:46:05.000Z","size":5126,"stargazers_count":2,"open_issues_count":24,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-13T01:02:40.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackintoshrao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-02T14:08:49.000Z","updated_at":"2023-03-04T09:35:43.000Z","dependencies_parsed_at":"2023-02-02T05:46:41.918Z","dependency_job_id":null,"html_url":"https://github.com/hackintoshrao/dgraph-graphql-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hackintoshrao/dgraph-graphql-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackintoshrao%2Fdgraph-graphql-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackintoshrao%2Fdgraph-graphql-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackintoshrao%2Fdgraph-graphql-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackintoshrao%2Fdgraph-graphql-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackintoshrao","download_url":"https://codeload.github.com/hackintoshrao/dgraph-graphql-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackintoshrao%2Fdgraph-graphql-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278909404,"owners_count":26066886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-05T10:00:22.777Z","updated_at":"2025-10-08T07:33:57.144Z","avatar_url":"https://github.com/hackintoshrao.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Simple blog app\nThis is a simple GraphQL web application to demonstrate Dgraph's GraphQL capabilities.\nThe web app is built using ReactJS and Apollo-React client libraries.\nAnd the GraphQL API's for the web app is powered by Dgraph.\n\n[Dgraph](https://graphql.dgraph.io) is an open-source, distributed, and transactional graph database with a native GraphQL interface.\n\nUsing Dgraph, you can get GraphQL APIs without writing any code.\n\nYou need to define just the GraphQL type definitions, Dgraph auto-generates the GraphQL APIs for you.\n\nThese APIs provide you with capabilities to perform CRUD operations on the types defined.\n\nDgraph provides custom directives for your GraphQL type definitions. You need to add them to your GraphQL type definitions be able to make use of some of Dgraph's advanced database features.\nHere are the docs explaining Dgraph's custom GraphQL directives.\n\nHere is how we arrived at the GraphQL type definition for our blog application. \n\nStep 1: Define your application graph.\n \nNote: Create an illustration with author, country, and blog linked together.\n\nStep 2: Translate the application Graph into a GraphQL type definition. \n\nStep 3: Add Dgraph custom annotations.\n\n----\n\n## Runnning the app \n\nFirst clone the repo\n```sh\n$ git clone https://github.com/hackintoshrao/dgraph-graphql-js.git\n$ cd dgraph-graphql-js\n```\n\nStarting dGraph and then loading the schema\n```sh\n$ docker run -it -p 8080:8080 dgraph/standalone:v1.2.0-rc1\n$ jq -n --arg schema \"$(cat schema.graphql)\" '{ query: \"mutation updateGQLSchema($sch: String!) { updateGQLSchema(input: { set: { schema: $sch }}) { gqlSchema { schema } } }\", variables: { sch: $schema }}' | curl -X POST -H \"Content-Type: application/json\" http://localhost:8080/admin -d @- | jq -r\n```\n\nTo execute a query or mutation you can use [GraphQL Playground](https://github.com/prisma-labs/graphql-playground), [Insomnia](https://insomnia.rest/), [GraphiQL](https://github.com/graphql/graphiql) and [Altair](https://github.com/imolorhe/altair). Fire one of those up and point it to [http://localhost:8080/graphql](http://localhost:8080/graphql) .\nThen you can run couple of mutations to add Author to the database along with the Post they have published, to have some sample data to show up when you start the app -\n```graphql\nmutation {\n  addAuthor(input:[{name: \"Apoorv\", posts: [{title: \"Reason React\"}]}]){\n    author {id}\n  }\n  }\n```\nOn the successful execution of the mutation - \n![Insomnia](screenshot.png)\n\nOpen another terminal and start the React app\n```sh\n$ yarn install\n$ yarn start\n```\n\n## Steps for Workshop\nInstallation - Docker, ngrok\nSetup - Create Auth0 account and make a application\n\nFrontend --\u003e apollo-server --\u003e Dgraph (general flow of queries \u0026 mutations)\nAuth0 --\u003e on signup --\u003e sends mutation to add author directly to dgraph using hooks --\u003e through ngrok\nEvery query \u0026 mutation gets user from context\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackintoshrao%2Fdgraph-graphql-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackintoshrao%2Fdgraph-graphql-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackintoshrao%2Fdgraph-graphql-js/lists"}