{"id":15095987,"url":"https://github.com/yhagio/go_api_boilerplate","last_synced_at":"2025-10-08T00:32:00.029Z","repository":{"id":37963608,"uuid":"237879217","full_name":"yhagio/go_api_boilerplate","owner":"yhagio","description":"🐶Go (Golang)🚀REST / GraphQL API + Postgres boilerplate","archived":true,"fork":false,"pushed_at":"2022-12-03T01:00:40.000Z","size":461,"stargazers_count":145,"open_issues_count":0,"forks_count":34,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-15T22:26:31.838Z","etag":null,"topics":["docker","gin","gin-gonic","go","golang","gorm","gqlgen","graphql","jwt","postgresql","rest-api","swagger","testify"],"latest_commit_sha":null,"homepage":"https://go-gin-postgres-api.herokuapp.com/graphql","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/yhagio.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":"2020-02-03T03:43:28.000Z","updated_at":"2024-11-13T13:28:41.000Z","dependencies_parsed_at":"2023-01-23T08:46:18.116Z","dependency_job_id":null,"html_url":"https://github.com/yhagio/go_api_boilerplate","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/yhagio%2Fgo_api_boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhagio%2Fgo_api_boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhagio%2Fgo_api_boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yhagio%2Fgo_api_boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yhagio","download_url":"https://codeload.github.com/yhagio/go_api_boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235669382,"owners_count":19026815,"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":["docker","gin","gin-gonic","go","golang","gorm","gqlgen","graphql","jwt","postgresql","rest-api","swagger","testify"],"created_at":"2024-09-25T15:44:34.741Z","updated_at":"2025-10-08T00:31:54.708Z","avatar_url":"https://github.com/yhagio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/yhagio/go_api_boilerplate.svg?branch=master)](https://travis-ci.org/yhagio/go_api_boilerplate.svg?branch=master)\n[![codecov](https://codecov.io/gh/yhagio/go_api_boilerplate/branch/master/graph/badge.svg)](https://codecov.io/gh/yhagio/go_api_boilerplate)\n[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.png?v=103)](https://opensource.org/licenses/mit-license.php)\n[![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)\n\n\n\n# Go (Golang) REST / GraphQL API Boilerplate\n\n- DEMO (GraphQL Playground): https://go-gin-postgres-api.herokuapp.com/graphql\n- DEMO (REST API Swagger): https://go-gin-postgres-api.herokuapp.com/swagger/index.html\n\nNote: in demo, I disabled email \n\n**Used libraries:**\n- [gin](https://github.com/gin-gonic)\n- [gin-swagger](https://github.com/swaggo/gin-swagger)\n- [gorm](https://gorm.io/docs/)\n- [jwt-go](https://pkg.go.dev/gopkg.in/dgrijalva/jwt-go.v3?tab=doc)\n- [godotenv](https://pkg.go.dev/github.com/joho/godotenv?tab=doc)\n- [gqlgen](https://github.com/99designs/gqlgen)\n- [testify](https://github.com/stretchr/testify)\n- [go-sqlmock](https://github.com/DATA-DOG/go-sqlmock)\n\n---\n\n- Components Diagram\n\n![diagram image](./docs/components-diagram.png)\n\n- See Swagger Doc `http://localhost:3000/swagger/index.html`\n\n![swagger image](./docs/swagger.png)\n\n- See GraphQL Playground `http://localhost:3000/graphql`\n\n![graphql image](./docs/graphql.png)\n\n---\n\n### Features\n\n- [x] User Auth functionality (Signup, Login, Forgot Password, Reset Password)\n- [x] JWT Authentication\n- [x] REST API\n- [x] GraphQL API\n- [x] Gorm (Golang SQL DB ORM) with Postgres implementation and auto migration\n- [x] Configs via environmental variables\n- [x] Email notification (Welcome email, Reset password email)\n- [x] Swagger REST API documentation\n- [x] GraphQL playground\n- [x] Unit tests\n- [x] Dependency injection\n\n---\n\n### Run locally\n\nCreate `.env` at root, i.e.\n```sh\nMAILGUN_API_KEY=key-b9jksfh8s9843uhfsdhds\nMAILGUN_DOMAIN=xxxxx.mailgun.org\n\nEMAIL_FROM=support@go_api_boilerplate.com\n\nDB_HOST=localhost\nDB_PORT=5432\nDB_USER=your-user\nDB_PASSWORD=your-password\nDB_NAME=local-dev-db\n\nJWT_SIGN_KEY=secret\nHAMC_KEY=secret\nPEPPER=secret\n\nENV=development\n\nAPP_PORT=3000\nAPP_HOST=http://localhost\n```\n\nRun\n```sh\n# Terminal 1\ndocker-compose up        # docker-compose up (Run postgres)\ndocker-compose down      # docker-compose down (Shutdown postgres)\n\n# Terminal 2\ngo run github.com/99designs/gqlgen -v # Generate Graphql stuff\nswag init -g app/app.go               # Generates Swagger\ngo run *.go                           # Run application\ngo test -v -cover ./...               # Run go test\n```\n\n---\n\n### Todo\n\n- [ ] Input Validations\n- [ ] Custom Error messages\n- [ ] Logger\n- [ ] More unit tests\n\nmaybe?\n\n- [ ] gRPC\n- [ ] Redis Streams\n- [ ] Redis PubSub\n- [ ] WebSocket\n- [ ] MongoDB\n\n---\n\n### Contribution\n\nWelcome for suggestions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhagio%2Fgo_api_boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyhagio%2Fgo_api_boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyhagio%2Fgo_api_boilerplate/lists"}