{"id":16188367,"url":"https://github.com/konsumer/simple-graphql","last_synced_at":"2025-03-19T03:30:39.729Z","repository":{"id":142068146,"uuid":"124736810","full_name":"konsumer/simple-graphql","owner":"konsumer","description":"Simple graphql server setup","archived":false,"fork":false,"pushed_at":"2018-03-23T19:31:50.000Z","size":90,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T14:49:34.973Z","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/konsumer.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-11T08:21:16.000Z","updated_at":"2021-07-28T12:17:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"3a673ee9-5ada-44e4-b311-c25bb97a6f4e","html_url":"https://github.com/konsumer/simple-graphql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Fsimple-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Fsimple-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Fsimple-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Fsimple-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/konsumer","download_url":"https://codeload.github.com/konsumer/simple-graphql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965752,"owners_count":20375917,"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","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-10T07:26:17.601Z","updated_at":"2025-03-19T03:30:39.385Z","avatar_url":"https://github.com/konsumer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-graphql\n\nThis is a simple [schema-stitching](https://www.apollographql.com/docs/graphql-tools/schema-stitching.html) GraphQL server. Use it as a template for your own servers.\n\n* `src/schema/*.graphql` and `src/schema/*.js` are merged into typedefs \u0026 resolvers, so it's super-simple to add new stuff.\n* I implemented the data-layer with leveldb, but you can use whatever you like.\n* I made a simple JWT auth system, complete with `@auth()` directive, and included example endpoints that require authentications.\n* I included directives from [graphql-custom-directives](https://github.com/lirown/graphql-custom-directives), to make getting the data you want easier\n\nYou can think of the whole thing as a strongly-typed database, with a GraphQL interface and a leveldb storeage-back, complete with JWT authentication.\n\n## example queries\n\n### User\n\nBasic auth-system.\n\n#### make a new user\n\nYou will see a token on the console, use that to `validate`\n\n```graphql\nmutation {\n  signup (email: \"konsumer@jetboystudio.com\", password: \"password\") {\n    id\n  }\n}\n```\n\n#### verify the new user\n\n```graphql\nmutation {\n  validate (token: \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjoiQjFvR0k0ejVHIiwiZW1haWwiOiJrb25zdW1lckBqZXRib3lzdHVkaW8uY29tIiwicm9sZXMiOltdfSwiaWF0IjoxNTIxNzkyNTMwLCJleHAiOjE1MjE4Nzg5MzB9.ml4s3RlfWCAAIfem7qntZufzsvTouNv-n-dgOjaxlX8\") {\n    token\n    user {\n      id\n      email\n      roles\n    }\n  }\n}\n```\n\n#### login\n\n```graphql\nmutation {\n  login (email: \"konsumer@jetboystudio.com\", password: \"password\") {\n    token\n    user {\n      id\n      email\n      roles\n    }\n  }\n}\n```\n\n### Product\n\nThis is a basic CRUD example.\n\n#### add a product\n\n```graphql\nmutation{\n  productAdd (name:\"cool shirt\", description: \"it's cool\", price: 20) {\n    id\n  }\n}\n```\n\n#### list products\n\n```graphql\n{\n  productsAll {\n    id\n    name\n  }\n}\n```\n\n#### get one product\n\n```graphql\n{\n  product (id: \"Byor6NfqG\") {\n    id\n    name\n  }\n}\n```\n\n#### update a product\n\n```graphql\nmutation{\n  productUpdate (id:\"Byor6NfqG\", name: \"really cool shirt\") {\n    id\n    name\n  }\n}\n```\n\n\n### Star wars\n\nThis is a more complex relationship example.\n\n#### search\n\nFor a search you have to use `...on` to pull fields for differnt types:\n\n```graphql\n{\n  search (text:\"luke\") {\n    ...on Character {\n      id\n      name\n    }\n    ...on Starship {\n      id\n      name\n    }\n  }\n}\n```\n\n#### using the graph\n\nYou can drill into R2's friends of friends:\n\n```graphql\n{\n  search (text:\"r2\") {\n    ...on Character {\n      name\n      friends {\n        name\n        friends {\n          name\n        }\n      }\n    }\n  }\n}\n```\n\nor if you know the ID:\n\n```graphql\n{\n  character (id:\"2001\") {\n    friends {\n      name\n      friends {\n        name\n      }\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Fsimple-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonsumer%2Fsimple-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Fsimple-graphql/lists"}