{"id":20605938,"url":"https://github.com/topliceanu/graphql-go-example","last_synced_at":"2025-08-22T18:04:35.527Z","repository":{"id":57549040,"uuid":"77861792","full_name":"topliceanu/graphql-go-example","owner":"topliceanu","description":"Example GraphQL API implemented in Go and backed by Postgresql","archived":false,"fork":false,"pushed_at":"2017-01-04T23:49:48.000Z","size":10,"stargazers_count":142,"open_issues_count":1,"forks_count":27,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-06-06T04:59:38.614Z","etag":null,"topics":["golang","graphql","postgresql"],"latest_commit_sha":null,"homepage":null,"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/topliceanu.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":"2017-01-02T21:06:04.000Z","updated_at":"2025-06-05T11:31:29.000Z","dependencies_parsed_at":"2022-08-27T01:40:28.822Z","dependency_job_id":null,"html_url":"https://github.com/topliceanu/graphql-go-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/topliceanu/graphql-go-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topliceanu%2Fgraphql-go-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topliceanu%2Fgraphql-go-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topliceanu%2Fgraphql-go-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topliceanu%2Fgraphql-go-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/topliceanu","download_url":"https://codeload.github.com/topliceanu/graphql-go-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topliceanu%2Fgraphql-go-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271679875,"owners_count":24802072,"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-08-22T02:00:08.480Z","response_time":65,"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":["golang","graphql","postgresql"],"created_at":"2024-11-16T09:31:39.590Z","updated_at":"2025-08-22T18:04:35.471Z","avatar_url":"https://github.com/topliceanu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# graphql-go-example\n\nExample GraphQL API implemented in Go and backed by Postgresql\n\n## How to run it\n\nTo run this project you need to:\n- install golang, see [this guide](https://golang.org/doc/install)\n- install [Masterminds/glide](https://github.com/Masterminds/glide) which is a package manager for golang projects.\n- install all the dependencies for this project: `glide install`, glide will store all dependencies in `/vendor` folder.\n- install postgresql (for ubuntu follow [this guide](https://help.ubuntu.com/community/PostgreSQL)). For this application, I created a postgresql user called `vagrant` with `vagrant` as password and the database called `graphql`, but of course you can change these settings in `./migrate.sh` and in `./main.go` files.\n- install [mattes/migrate](https://github.com/mattes/migrate) which is a tool to create and run migrations against sql databases.\n- run the migrations which will create the database tables and indexes `./migrate.sh up`. If you ever want to clean up the the database run `./migrate.sh down` then `./migrate.sh up` again.\n\n## Commands\n\nThis application exposes a single endpoints `/graphql` which accepts both mutations and queries.\nThe following are examples of curl calls to this endpoint:\n\n```bash\ncurl -XPOST http://vm:8080/graphql -d 'mutation {createUser(email:\"1@x.co\"){id, email}}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {createUser(email:\"2@y.co\"){id, email}}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {follow(follower:1, followee:2)}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {unfollow(follower:1, followee:2)}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:2){followers{id, email}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){followers{id, email}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:2){follower(id:1){ email}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){followees{email}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){followee(id:2){email}}}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {createPost(user:1,title:\"p1\",body:\"b1\"){id}}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {createComment(user:1,post:1,title:\"t1\",body:\"b1\"){id}}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {removeComment(id:1)}'\ncurl -XPOST http://vm:8080/graphql -d 'mutation {removePost(id:1)}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){post(id:2){title,body}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){posts{id,title,body}}}'\ncurl -XPOST http://vm:8080/graphql -d '{user(id:1){post(id:2){user{id,email}}}}'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopliceanu%2Fgraphql-go-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftopliceanu%2Fgraphql-go-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftopliceanu%2Fgraphql-go-example/lists"}