{"id":20083895,"url":"https://github.com/hiromaily/go-gin-wrapper","last_synced_at":"2025-06-18T09:37:50.046Z","repository":{"id":101892780,"uuid":"57296653","full_name":"hiromaily/go-gin-wrapper","owner":"hiromaily","description":"go-gin web framework sample","archived":false,"fork":false,"pushed_at":"2023-05-05T02:34:23.000Z","size":68149,"stargazers_count":23,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-06T01:37:43.998Z","etag":null,"topics":["docker","golang","heroku","jwt","mysql","react","redis","travis-ci"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/hiromaily.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-28T11:26:59.000Z","updated_at":"2024-10-04T11:40:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff372b20-1dbf-44a7-b0c6-8a43bc7c09a0","html_url":"https://github.com/hiromaily/go-gin-wrapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hiromaily/go-gin-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiromaily%2Fgo-gin-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiromaily%2Fgo-gin-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiromaily%2Fgo-gin-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiromaily%2Fgo-gin-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hiromaily","download_url":"https://codeload.github.com/hiromaily/go-gin-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hiromaily%2Fgo-gin-wrapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260528578,"owners_count":23022976,"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","golang","heroku","jwt","mysql","react","redis","travis-ci"],"created_at":"2024-11-13T15:49:23.801Z","updated_at":"2025-06-18T09:37:45.029Z","avatar_url":"https://github.com/hiromaily.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-gin-wrapper\n\n[![Build Status](https://travis-ci.org/hiromaily/go-gin-wrapper.svg?branch=master)](https://travis-ci.org/hiromaily/go-gin-wrapper)\n[![Coverage Status](https://coveralls.io/repos/github/hiromaily/go-gin-wrapper/badge.svg?branch=master)](https://coveralls.io/github/hiromaily/go-gin-wrapper?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/hiromaily/go-gin-wrapper)](https://goreportcard.com/report/github.com/hiromaily/go-gin-wrapper)\n[![codebeat badge](https://codebeat.co/badges/30d3509a-36be-408b-bfed-ddd6f601c075)](https://codebeat.co/projects/github-com-hiromaily-go-gin-wrapper-master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/83df70f4373d47f8b889be10ad28d4a3)](https://www.codacy.com/app/hiromaily2/go-gin-wrapper?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=hiromaily/go-gin-wrapper\u0026amp;utm_campaign=Badge_Grade)\n[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](https://raw.githubusercontent.com/hiromaily/go-gin-wrapper/master/LICENSE)\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/hiromaily/go-gin-wrapper)\n\nGo-gin-wrapper is wrapper of [gin-gonic/gin](https://github.com/gin-gonic/gin) web framework plus reverse proxy.  \nReact by ES6 is used on part of front-end. But it's quite outdated. \n\nThis project has started since 2016 to study Golang and code is quite messy.\nNow it's under `refactoring`.\n\n\n## Refactoring\n- [ ] refactoring code by [The Second Edition of \"Refactoring\"](https://martinfowler.com/articles/refactoring-2nd-ed.html)\n- [ ] refactoring code by [codebeat.co](https://codebeat.co/projects/github-com-hiromaily-go-gin-wrapper-master/ratings)\n- [ ] change architecture like Clean Architecture\n  - [ ] make UI adaptable like WEB to CUI\n- [ ] fix session functionality\n- [x] remove any dependencies from [hiromaily/golibs](https://github.com/hiromaily/golibs)\n  - [x] use [sqlboiler](https://github.com/volatiletech/sqlboiler) as ORM\n  - [x] remove MongoDB\n  - [x] replace log to zap logger\n- [x] add zap logger\n- [x] add graceful shutdown\n- [x] refactoring jwt package  \n- [x] fix main_test\n- [x] unittest by table driven test\n- [x] clean up variable, func name\n- [x] clean up comments\n- [ ] catch up with latest [gin](https://github.com/gin-gonic/gin)\n- [ ] update front-end\n\n## Requirements\n- Golang 1.15+\n- Docker compose\n  - MySQL 5.7\n  - Redis\n- [direnv](https://github.com/direnv/direnv) for MacOS user  \n\n## Example\nExample is [here](https://ginserver.herokuapp.com/) on Heroku.\n\n\n## Functionalities\n### Authentication for Login\n`OAuth2` authentication with Google/Facebook is available.\n\n#### Authentication for API\n`JWT(Json Web Token)` is used  for authentication.\nSee configuration `[api.auth]` in toml file.\n\n#### APIs documentation by [Swagger](http://localhost:8080/swagger/?url=https://raw.githubusercontent.com/hiromaily/go-gin-wrapper/master/swagger/swagger.yaml)\n\n\n## Configuration\nSee `./configs/settings.default.toml`  \nAs needed, secret information can be encrypted.(using AES encryption)\n\n## Dependent middleware\n- MySQL\n- Redis whose used as session store\n\n\n## Installation on local (MacOS is expected)\n```\n# 1. clone repository\n$ git clone https://github.com/hiromaily/go-gin-wrapper.git\n\n# 2. copy settings.default.toml\n$ cp configs/settings.default.toml configs/settings.toml\n\n# 3. edit `configs/settings.toml`\n# 3.1. you may need to modify in settings.toml\n [server.docs]\n # set `go-gin-wrapper` path\n # this path must be chnaged first for specific environment\n path = \"${GOPATH}/src/github.com/hiromaily/go-gin-wrapper\"\n\n$ 4. start MySQL\n$ docker-compose up mysql\n \n# 5. make sure `go run` works\n$ go run ./cmd/ginserver/ -f ./configs/settings.toml\n\n# 6. unit test requires ${GOGIN_CONF} environment variable\n- define proper path on `.envrc`\n```\n\n\n## Installation on Docker\n```\n$ docker-compose build\n$ docker-compose up\n```\n\n#### Docker related files\n* configs/docker.toml\n* docker-compose.yml\n* docker-compose.override.yml\n* Dockerfile\n* ./build/docker/*\n\n\n## Installation on Heroku\n```\n## Install \n$ heroku create ginserver --buildpack heroku/go\n\n# MySQL\n$ heroku addons:create cleardb\n$ heroku config | grep CLEARDB_DATABASE_URL\n\n# Redis\n$ heroku addons:create heroku-redis:hobby-dev -a ginserver \n$ heroku config | grep REDIS\n\n## Environment variable\n$ heroku config:add ENC_KEY=xxxxx\n$ heroku config:add ENC_IV=xxxxx\n\n## Check\n$ heroku config | grep CLEARDB_DATABASE_URL\n$ heroku config | grep REDIS\n$ heroku ps -a ginserver\n\n## Deploy\n$ git push -f heroku master\n``` \n\n* [site on heroku](https://ginserver.herokuapp.com/)\n\n* `./configs/heroku.toml` is used to run server.  \n```\n$ ginserver -f /app/configs/heroku.toml -crypto\n```\n\n\n## Environment variables\n| NAME              | Value            | Explanation                        |\n|:------------------|:-----------------|:-----------------------------------|\n| GOGIN_CONF        | xxxxx            | config path, required in unit test |\n| ENC_KEY           | xxxxx            | encryption                         |\n| ENC_IV            | xxxxx            | encryption                         |\n\n#### Only Heroku environment\n| NAME              | Value            |\n|:------------------|:-----------------|\n| PORT              | 8080             |\n\n- Heroku server use `PORT` automatically as environment variable.\n\n\n## Usage\n```\nUsage: ginserver [options...]\n\nOptions:\n  -f      Toml file path\n  -p      Overwriten server port number\n  -crypto if true, values in config file are encrypted\n\ne.g.\n $ ginserver -f /app/configs/yourfile.toml -crypto\n```\n\n\n## Profiling\nSee config file.\n```\n[profile]\nenable = true\n```\n\nAfter running ginserver, acccess the below links.\n```\n[GIN-debug] GET    /debug/pprof/\n[GIN-debug] GET    /debug/pprof/heap\n[GIN-debug] GET    /debug/pprof/goroutine\n[GIN-debug] GET    /debug/pprof/block\n[GIN-debug] GET    /debug/pprof/threadcreate\n[GIN-debug] GET    /debug/pprof/cmdline\n[GIN-debug] GET    /debug/pprof/profile\n[GIN-debug] GET    /debug/pprof/symbol\n[GIN-debug] POST   /debug/pprof/symbol\n[GIN-debug] GET    /debug/pprof/trace\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiromaily%2Fgo-gin-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhiromaily%2Fgo-gin-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhiromaily%2Fgo-gin-wrapper/lists"}