{"id":25902679,"url":"https://github.com/jonathanhecl/golang-graphql-mongodb","last_synced_at":"2025-03-03T03:17:08.602Z","repository":{"id":48327863,"uuid":"178985271","full_name":"jonathanhecl/golang-graphql-mongodb","owner":"jonathanhecl","description":"Golang+GraphQL+MongoDB","archived":false,"fork":false,"pushed_at":"2019-04-04T02:13:48.000Z","size":600,"stargazers_count":37,"open_issues_count":0,"forks_count":15,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-03-02T03:21:00.188Z","etag":null,"topics":["bcrypt","cms-backend","golang","graphql","graphql-server","jwt","mongodb","server-side","web"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanhecl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-02T02:42:23.000Z","updated_at":"2022-12-07T13:40:27.000Z","dependencies_parsed_at":"2022-08-29T21:50:17.097Z","dependency_job_id":null,"html_url":"https://github.com/jonathanhecl/golang-graphql-mongodb","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fgolang-graphql-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fgolang-graphql-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fgolang-graphql-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanhecl%2Fgolang-graphql-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanhecl","download_url":"https://codeload.github.com/jonathanhecl/golang-graphql-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241600473,"owners_count":19988715,"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":["bcrypt","cms-backend","golang","graphql","graphql-server","jwt","mongodb","server-side","web"],"created_at":"2025-03-03T03:17:07.929Z","updated_at":"2025-03-03T03:17:08.596Z","avatar_url":"https://github.com/jonathanhecl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Golang+GraphQL+MongoDB Server 1.0.0\n\nUses the following packages:\n  - go.mongodb.org/mongo-driver/mongo - MongoDB Driver API\n  - github.com/graphql-go/graphql - GraphQL\n  - github.com/dgrijalva/jwt-go - JSON Web Tokens (JWT)\n  - golang.org/x/crypto/bcrypt - Package bcrypt\n\n# Features!\n\n  - Authorization Header\n  - SignUp/SignIn users\n  - Users Profiles\n  - List recipes\n  - Recipe pages\n  - Add/Edit/Delete recipes\n  - Like/Unlike recipes\n\n### Config.go file\n\n```\nvar config = configModel{\n\tmongoUri:    \"mongodb://admin:admin@localhost:37812/react-recipes\", \t\t   // Mongo Uri \n\tmongoDb:     \"react-recipes\",                                                  // DB name\n\ttokenSecret: \"secret\",                                                         // Secret to use in Tokens\n\ttokenExp:    \"1h\",                                                             // Expiration of Token\n\tserveUri:    \":4444\",                                                          // Serve\n}\n```\n\n### Models\n\n#### Recipe\n\n|key|type|\n|-|-|\n|_id|ID|\n|name|string|\n|imageUrl|string|\n|category|string|\n|description|string|\n|instructions|string|\n|createdDate|unixtime|\n|likes|int|\n|username|string|\n\n#### User\n\n|key|type|\n|-|-|\n|_id|ID|\n|username|string|\n|password|string|\n|email|string|\n|joinDate|unixtime|\n|favorites|array[Recipe]|\n\n### GraphQL\n\n#### getAllRecipes\n```\n{\n  getAllRecipes {\n    ...MinimalRecipe\n  }\n}\n\nfragment MinimalRecipe on Recipe {\n  _id\n  name\n  imageUrl\n  category\n}\n```\n\n#### searchRecipes\n```\nquery ($searchTerm: String) {\n  searchRecipes(searchTerm: $searchTerm) {\n    _id\n    name\n    likes\n  }\n}\n```\n\n#### getRecipe\n```\nquery ($_id: ID!) {\n  getRecipe(_id: $_id) {\n    ...CompleteRecipe\n  }\n}\n\nfragment CompleteRecipe on Recipe {\n  _id\n  name\n  imageUrl\n  category\n  description\n  instructions\n  createdDate\n  likes\n  username\n}\n```\n\n#### signupUser\n```\nmutation ($username: String!, $email: String!, $password: String!) {\n  signupUser(username: $username, email: $email, password: $password) {\n    token\n  }\n}\n```\n\n#### signinUser\n```\nmutation ($username: String!, $password: String!) {\n  signinUser(username: $username, password: $password) {\n    token\n  }\n}\n```\n\n#### getCurrentUser (require authorization header)\n```\n{\n  getCurrentUser {\n    username\n    joinDate\n    email\n    favorites {\n      _id\n      name\n    }\n  }\n}\n```\n\n#### addRecipe (require authorization header)\n_username not used, obtained by Token Authorization._\n```\nmutation ($name: String!, $imageUrl: String!, $category: String!, $description: String!, $instructions: String!, $username: String) {\n  addRecipe(name: $name, imageUrl: $imageUrl, category: $category, description: $description, instructions: $instructions, username: $username) {\n    ...MinimalRecipe\n  }\n}\n\nfragment MinimalRecipe on Recipe {\n  _id\n  name\n  imageUrl\n  category\n}\n\n```\n\n#### updateUserRecipe (require authorization header)\n```\nmutation ($_id: ID!, $name: String!, $imageUrl: String!, $category: String!, $description: String!, $instructions: String!) {\n  updateUserRecipe(_id: $_id, name: $name, imageUrl: $imageUrl, category: $category, description: $description, instructions: $instructions) {\n    ...CompleteRecipe\n  }\n}\n\nfragment CompleteRecipe on Recipe {\n  _id\n  name\n  imageUrl\n  category\n  description\n  instructions\n  createdDate\n  likes\n  username\n}\n```\n\n#### getUserRecipe (require authorization header)\n```\nquery ($username: String!) {\n  getUserRecipes(username: $username) {\n    ...CompleteRecipe\n  }\n}\n\nfragment CompleteRecipe on Recipe {\n  _id\n  name\n  imageUrl\n  category\n  description\n  instructions\n  createdDate\n  likes\n  username\n}\n```\n\n#### likeRecipe (require authorization header)\n_username not used, obtained by Token Authorization._\n```\nmutation ($_id: ID!, $username: String!) {\n  likeRecipe(_id: $_id, username: $username) {\n    ...LikeRecipe\n  }\n}\n\nfragment LikeRecipe on Recipe {\n  _id\n  likes\n}\n```\n\n#### unlikeRecipe (require authorization header)\n_username not used, obtained by Token Authorization._\n```\nmutation ($_id: ID!, $username: String!) {\n  unlikeRecipe(_id: $_id, username: $username) {\n    ...LikeRecipe\n  }\n}\n\nfragment LikeRecipe on Recipe {\n  _id\n  likes\n}\n```\n\n#### deleteUserRecipe (require authorization header)\n```\nmutation ($_id: ID!) {\n  deleteUserRecipe(_id: $_id) {\n    _id\n  }\n}\n```\n\nLicense\n----\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhecl%2Fgolang-graphql-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanhecl%2Fgolang-graphql-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanhecl%2Fgolang-graphql-mongodb/lists"}