{"id":20314856,"url":"https://github.com/windvalley/gobackend","last_synced_at":"2025-04-11T17:21:22.469Z","repository":{"id":44411023,"uuid":"423127853","full_name":"windvalley/gobackend","owner":"windvalley","description":"Enterprise-grade Go web backend scaffolding based on cobra, viper, pflag, zap, gorm, gin.","archived":false,"fork":false,"pushed_at":"2022-12-30T06:03:16.000Z","size":345,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T13:11:36.093Z","etag":null,"topics":["backend","cobra","enterprise","gin","go","gorm","pflag","restful-api","viper","web","zap"],"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/windvalley.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":"2021-10-31T11:25:03.000Z","updated_at":"2025-01-07T13:22:31.000Z","dependencies_parsed_at":"2023-01-31T10:45:23.037Z","dependency_job_id":null,"html_url":"https://github.com/windvalley/gobackend","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgobackend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgobackend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgobackend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/windvalley%2Fgobackend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/windvalley","download_url":"https://codeload.github.com/windvalley/gobackend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248447609,"owners_count":21105140,"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":["backend","cobra","enterprise","gin","go","gorm","pflag","restful-api","viper","web","zap"],"created_at":"2024-11-14T18:16:59.118Z","updated_at":"2025-04-11T17:21:22.440Z","avatar_url":"https://github.com/windvalley.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoBackend\n\n[![Language](https://img.shields.io/badge/Language-Go-blue.svg)](https://go.dev)\n[![Github Workflow Status](https://img.shields.io/github/actions/workflow/status/windvalley/gobackend/gobackendci.yaml)](https://github.com/windvalley/gobackend/actions/workflows/gobackendci.yaml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=windvalley_gobackend\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=windvalley_gobackend)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=windvalley_gobackend\u0026metric=ncloc)](https://sonarcloud.io/summary/new_code?id=windvalley_gobackend)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=windvalley_gobackend\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=windvalley_gobackend)\n[![License](https://img.shields.io/github/license/windvalley/gobackend)](License) \u003cbr\u003e\n![Page Views](https://views.whatilearened.today/views/github/windvalley/gobackend.svg)\n[![Traffic Clones Total](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi.sre.im%2Fv1%2Fgithub%2Ftraffic%2Fclones%2Ftotal%3Fgit_user%3Dwindvalley%26git_repo%3Dgobackend%26type%3Dcount%26label%3Dclones-total)](https://github.com/windvalley/traffic-clones-api)\n[![Traffic Clones Uniques](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi.sre.im%2Fv1%2Fgithub%2Ftraffic%2Fclones%2Ftotal%3Fgit_user%3Dwindvalley%26git_repo%3Dgobackend%26type%3Duniques%26label%3Dclones-uniques)](https://github.com/windvalley/traffic-clones-api)\n\nEnterprise-grade Go web backend scaffolding based on\n[cobra][1], [viper][2], [pflag][3], [zap][4], [gorm][5], [gin][6].\n\n[1]: https://github.com/spf13/cobra\n[2]: https://github.com/spf13/viper\n[3]: https://github.com/spf13/pflag\n[4]: https://github.com/uber-go/zap\n[5]: https://github.com/go-gorm/gorm\n[6]: https://github.com/gin-gonic/gin\n\n## Features\n\n- Project directories layout follows [golang-standards/project-layout](https://github.com/golang-standards/project-layout)\n\n- The configuration items in the configuration file are unified with the command line parameters, and the command line parameters take precedence(Realized by [cobra][1], [viper][2] and [pflag][3]).\n\n- Powerful logger built with [zap][4] and [lumberjack](https://github.com/natefinch/lumberjack), supports color, function caller, hooks, multi-outputs, rotation, etc.\n\n- Integrated many useful middlewares, which can be flexibly configured in the configuration file.\n\n- One server process can enable both http and https services at the same time.\n\n- Server graceful shutdown.\n\n- Custom your own environment variable to specify run environments(dev/test/prod).\n\n- Supports operation logging and exposes related restful apis.\n\n- Auto generate error code documentation file and necessary error code source files.\n\n- Supports application process lock.\n\n- Supports cloud native deployment.\n\n- Use `Makefile` to manage the project efficiently and conveniently.\n\n- Testable and maintainable codes.\n\n## Quik Start\n\n```sh\n$ git clone --depth 1 https://github.com/windvalley/gobackend.git\n\n$ cd gobackend\n```\n\nEdit `configs/dev.gobackend-apiserver.yaml`:\n\n```yaml\n# MySQL\nmysql:\n  # Default: 127.0.0.1:3306\n  host: 127.0.0.1:3306\n  # Default: \"\"\n  username: \"root\"\n  # Default: \"\"\n  password: \"123456\"\n  # Default: \"\"\n  database: \"gobackend\"\n```\n\nCreate database:\n\n```sh\n$ mysql -h 127.0.0.1 -P 3306 -uroot -p'123456' -e \"create database gobackend;\"\n```\n\nRun in development environment:\n\n```sh\n$ make run.dev\n```\n\n\u003cimg width=\"772\" alt=\"run_dev\" src=\"https://user-images.githubusercontent.com/6139938/144012376-df174b5e-0c5a-4318-817e-7d9b30e4f5cd.png\"\u003e\n\n## Makefile\n\n```sh\n$ make\n\nUsage: make [TARGETS] [OPTIONS]\n\nTargets:\n\n   all               Make gen, lint, cover, build\n   run.dev           Run in development mode.\n   run.test          Run in test mode.\n   build             Compile packages and dependencies to generate binary file for current platform.\n   build.multiarch   Build for multiple platforms. See option PLATFORMS.\n   image             Build docker images for host arch.\n   push              Build docker images for host arch and push images to registry.\n   lint              Check syntax and style of Go source code.\n   test              Run unit test.\n   cover             Run unit test and get test coverage.\n   gen               Generate necessary source code files and doc files.\n   clean             Remove all files that are created by building.\n   help              Show this help.\n\nOptions:\n\n   BINS        The binaries to build. Default is all commands in cmd/.\n               This option is available for: make build/build.multiarch\n               Example: make build BINS=\"apiserver otherbinary\"\n   IMAGES      Docker images to build. Default is all commands in cmd/.\n               This option is available when using: make image/image.multiarch.\n               Example: make image.multiarch IMAGES=\"apiserver otherbinary\"\n   PLATFORMS   The multiple platforms to build.\n               Default is 'darwin_amd64 darwin_arm64 linux_amd64 linux_arm64 windows_amd64'.\n               This option is available when using: make build.multiarch.\n               Example: make build.multiarch PLATFORMS=\"linux_amd64\"\n```\n\n## License\n\nThis project is under the MIT License.\nSee the [LICENSE](LICENSE) file for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Fgobackend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwindvalley%2Fgobackend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwindvalley%2Fgobackend/lists"}