{"id":13692372,"url":"https://github.com/dipeshdulal/clean-gin","last_synced_at":"2025-04-05T05:04:25.028Z","repository":{"id":41897297,"uuid":"294941056","full_name":"dipeshdulal/clean-gin","owner":"dipeshdulal","description":"Implementation of clean architecture in Go, Gin with dependency injection. ","archived":false,"fork":false,"pushed_at":"2023-05-24T10:37:46.000Z","size":148,"stargazers_count":481,"open_issues_count":6,"forks_count":67,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T04:06:25.530Z","etag":null,"topics":["clean-architecture","gin-gonic","go","golang","gorm"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dipeshdulal.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":"2020-09-12T12:38:37.000Z","updated_at":"2025-03-25T06:19:26.000Z","dependencies_parsed_at":"2024-06-18T21:23:32.316Z","dependency_job_id":"f7fc9741-0b9c-457e-9266-3dba32125dbb","html_url":"https://github.com/dipeshdulal/clean-gin","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fclean-gin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fclean-gin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fclean-gin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dipeshdulal%2Fclean-gin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dipeshdulal","download_url":"https://codeload.github.com/dipeshdulal/clean-gin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247289424,"owners_count":20914464,"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":["clean-architecture","gin-gonic","go","golang","gorm"],"created_at":"2024-08-02T17:00:57.200Z","updated_at":"2025-04-05T05:04:25.008Z","avatar_url":"https://github.com/dipeshdulal.png","language":"Go","funding_links":[],"categories":["开源类库","Open source library"],"sub_categories":["项目骨架","Project Skeleton"],"readme":"\u003cimg src=\"logo.svg\" width=\"250px\" /\u003e\n\n\u003chr /\u003e\n\n## Project Overview\nClean architecture template with gin framework, go-fx as dependency container, gorm as orm for database related operations.\n\nTo learn about project structure and dependency injection please go through [here](https://medium.com/wesionary-team/dependency-injection-with-go-fx-b698a6585cf0?source=friends_link\u0026sk=26f391ae41c493946ee3434be2ed4971)\n\nWant to ask something, contribute or be part of discussions, 💬 Join us on [Discord](https://discord.gg/mmFdCpKhJx) server.\n\n## Running the project\n\n- Make sure you have docker installed.\n- Copy `.env.example` to `.env`\n- Run `docker-compose up -d`\n- Go to `localhost:5000` to verify if the server works.\n- [Adminer](https://www.adminer.org/) Database Management runs at `5001` .\n\nIf you are running without docker be sure database configuration is provided in `.env` file and run `go run . app:serve`\n\n#### Environment Variables\n\n\u003cdetails\u003e\n    \u003csummary\u003eVariables Defined in the project \u003c/summary\u003e\n\n| Key            | Value                    | Desc                                        |\n| -------------- | ------------------------ | ------------------------------------------- |\n| `SERVER_PORT`  | `5000`                   | Port at which app runs                      |\n| `ENV`          | `development,production` | App running Environment                     |\n| `LOG_OUTPUT`   | `./server.log`           | Output Directory to save logs               |\n| `LOG_LEVEL`    | `info`                   | Level for logging (check lib/logger.go:172) |\n| `DB_USER`      | `username`               | Database Username                           |\n| `DB_PASS`      | `password`               | Database Password                           |\n| `DB_HOST`      | `0.0.0.0`                | Database Host                               |\n| `DB_PORT`      | `3306`                   | Database Port                               |\n| `DB_NAME`      | `test`                   | Database Name                               |\n| `JWT_SECRET`   | `secret`                 | JWT Token Secret key                        |\n| `ADMINER_PORT` | `5001`                   | Adminer DB Port                             |\n| `DEBUG_PORT`   | `5002`                   | Port that delve debugger runs in            |\n\n\u003c/details\u003e\n\n#### Migration Commands\n\n\u003e ⚓️ \u0026nbsp; Add argument `p=host` if you want to run the migration runner from the host environment instead of docker environment.\n\u003e Check [#19](https://github.com/dipeshdulal/clean-gin/issues/19) for more details. eg; `make p=host migrate-up`\n\n\u003cdetails\u003e\n    \u003csummary\u003eMigration commands available\u003c/summary\u003e\n\n| Command             | Desc                                           |\n| ------------------- | ---------------------------------------------- |\n| `make migrate-up`   | runs migration up command                      |\n| `make migrate-down` | runs migration down command                    |\n| `make force`        | Set particular version but don't run migration |\n| `make goto`         | Migrate to particular version                  |\n| `make drop`         | Drop everything inside database                |\n| `make create`       | Create new migration file(up \u0026 down)           |\n\n\u003c/details\u003e\n\n## Implemented Features\n\n- Dependency Injection (go-fx)\n- Routing (gin web framework)\n- Environment Files\n- Logging (file saving on `production`) [zap](https://github.com/uber-go/zap)\n- Middlewares (cors)\n- Database Setup (mysql)\n- Models Setup and Automigrate (gorm)\n- Repositories\n- Implementing Basic CRUD Operation\n- Authentication (JWT)\n- Migration Runner Implementation\n- Live code refresh\n- Dockerize Application with Debugging Support Enabled. Debugger runs at `5002`. Vs code configuration is at `.vscode/launch.json` which will attach debugger to remote application. [Learn More](https://medium.com/wesionary-team/docker-debug-environment-for-go-and-gin-framework-36df80e061ac?source=friends_link\u0026sk=35c9d856852944083dd30059200d87f0)\n- Cobra Commander CLI Support. try: `go run . --help`\n\n## Todos\n\n- [x] COBRA Commander CLI Support [#26](https://github.com/dipeshdulal/clean-gin/issues/26)\n- [ ] Swagger documentation examples [#25](https://github.com/dipeshdulal/clean-gin/issues/25)\n- [ ] Unit testing examples. [#23](https://github.com/dipeshdulal/clean-gin/issues/23)\n- [ ] File upload middelware. [#20](https://github.com/dipeshdulal/clean-gin/issues/20)\n- [x] Use of Interfaces [#10](https://github.com/dipeshdulal/clean-gin/issues/10)\n\n## Contributing\n\nPlease open issues if you want the template to add some features that is not in todos. 🙇‍♂️\n\nCreate a PR with relevant information if you want to contribute in this template.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipeshdulal%2Fclean-gin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdipeshdulal%2Fclean-gin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdipeshdulal%2Fclean-gin/lists"}