{"id":17249486,"url":"https://github.com/inhere/go-web-skeleton","last_synced_at":"2025-03-22T18:34:25.007Z","repository":{"id":57514112,"uuid":"144659546","full_name":"inhere/go-web-skeleton","owner":"inhere","description":"A skeleton for golang web application(with logger, redis, mysql, mongo, config, i18n, cli, validate and more)","archived":false,"fork":false,"pushed_at":"2024-12-12T02:26:54.000Z","size":4304,"stargazers_count":25,"open_issues_count":0,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T14:03:56.977Z","etag":null,"topics":["golang","web-application","web-skeleton"],"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/inhere.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":"2018-08-14T02:44:01.000Z","updated_at":"2024-12-12T02:21:29.000Z","dependencies_parsed_at":"2024-06-20T01:32:36.624Z","dependency_job_id":"297e45f3-a075-407b-915f-a5a40d2a3494","html_url":"https://github.com/inhere/go-web-skeleton","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/inhere%2Fgo-web-skeleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fgo-web-skeleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fgo-web-skeleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inhere%2Fgo-web-skeleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inhere","download_url":"https://codeload.github.com/inhere/go-web-skeleton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245003603,"owners_count":20545637,"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":["golang","web-application","web-skeleton"],"created_at":"2024-10-15T06:44:29.126Z","updated_at":"2025-03-22T18:34:24.977Z","avatar_url":"https://github.com/inhere.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Web Skeleton\n\nA complete Golang web application skeleton.\n\n\u003e **[中文说明](README.zh-CN.md)**\n\nContains:\n\n- Can be used for API interface applications, CLI command line applications, WEB applications\n- Log library `gookit/slog` configuration used\n- swagger API documentation configuration generation\n- Multi-language support, view rendering, request data validation\n- Configure read management, load according to environment, multi-file support\n- Contains redis, mysql, mongo for initialization and simple use\n- Use `go mod` to install the management dependencies\n\n## Project Structure\n\n\u003e Github Project https://github.com/inhere/go-web-skeleton\n\n```text\napi/ API interface application handlers\n  |- controller/\n  |- middleware/\n  |_ routes.go\napp/ Common directory (public methods, application initialization, public components, etc.)\ncmd/ CLI command line application commands\n  |_ cliapp/ command line application entry file (main)\nconfig/ Application configuration directory (basic configuration plus various environment configurations)\nmodel/  Data and logic code directory\n  |- form/  Request form structure data definition, form validation configuration\n  |- logic/ Logic processing\n  |- mongo/ MongoDB data collection model definition\n  |- mysql/ MySQL data form model definition\n  |_ rds/   Redis data model definition\nresource/   Non-code resources used by some projects (language files, view template files, etc.)\nruntime/    Temporary file directory (file cache, log files, etc.)\nstatic/     Static resource directory (js, css, etc.)\nmain.go     Web application entry file\nDockerfile  Dockerfile\nMakefile    Has written some common shortcut commands to help package, build docker, generate documentation, run tests, etc.\n...\n```\n\n\u003e render by `tree -d 2 ./`\n\n## Go Packages\n\n\u003e use ✅ mark current used go package\n\n### Http service\n\nProvide HTTP service and routing\n\n- [gookit/rux](https://github.com/gookit/rux) ✅\n\n**Other**:\n\n### CLI application\n\nCommand line application\n\n- [gookit/gcli](https://github.com/gookit/gcli) ✅\n\n### Configuration\n\nConfiguration management\n\n- Multiple format configurations: [gookit/config](https://github.com/gookit/config) ✅\n  - INI configuration: [gookit/ini](https://github.com/gookit/ini)\n\n### Logging\n\n  - [gookit/slog](https://github.com/gookit/slog) ✅\n  - [sirupsen/logrus](https://github.com/sirupsen/logrus)\n    - Log splitting: [rifflock/lfshook](https://github.com/rifflock/lfshook)\n    - Log splitting: [lestrrat-go/file-rotatelogs](https://github.com/lestrrat-go/file-rotatelogs)\n  - [go.uber.org/zap](https://github.com/uber-go/zap)\n\n### Database ORM\n\nMysql:\n\n- [go-xorm/xorm](https://github.com/go-xorm/xorm)\n- [jinzhu/gorm](https://github.com/jinzhu/gorm) ✅\n\nMongodb:\n\n- [github.com/globalsign/mgo](https://github.com/globalsign/mgo)\n\n### Cache\n\n- Cache: [gookit/cache](https://github.com/gookit/cache) ✅\n\nRedis:\n\n- [go-redis/redis](https://github.com/go-redis/redis) ✅\n- [gomodule/redigo](https://github.com/gomodule/redigo/redis)\n\n### Data validation\n\nRequest data validation\n\n- [gookit/validate](https://github.com/gookit/validate) ✅\n- [go-playground/validator](https://github.com/go-playground/validator)\n\n### Data serialization\n\nHigh-performance  serialization library\n\nJSON:\n\n- [json-iterator/go](https://github.com/json-iterator/go)\n\n### Other packages\n\n- I18n language: [gookit/i18n](https://github.com/gookit/i18n) ✅\n- View rendering: [gookit/easytpl](https://github.com/gookit/easytpl) ✅\n\nConfig register center:\n\n- eureka client: [PDOK/go-eureka-client](https://github.com/PDOK/go-eureka-client) Not used\n- nacos client:\n\n## Extra Compoents\n\n### Auxiliary Library\n\n- swagger document generation:\n  - [go-swagger](https://github.com/go-swagger/go-swagger) The documentation is complex but more powerful\n  - [swaggo/swag](https://github.com/swaggo/swag) Documents and usage are relatively simple, only generating documents is enough\n- Test the auxiliary library for quick assertion [stretchr/testify](https://github.com/stretchr/testify)\n- Debugging tool: [davecgh/go-spew](https://github.com/davecgh/go-spew) Deep printing golang variable data\n\n### Additional components\n\n- swagger UI: swagger document rendering\n- `Dockerfile`: docker image build script for production environment, based on alpine, build a project image with an estimated size of around 30 M\n- `makefile`: Some quick-on make commands have been built to help quickly generate documentation and build images.\n\n## Start\n\n- First, clone the skeleton repository to your local directory\n- Rename the `go-web-skeleton` directory to your project name.\n- Go to the project and replace `github.com/inhere/go-web-skeleton` with your project name (for go file)\n- Search again and replace all `go-web-skeleton` with your project name (mainly Dockerfile, makefile)\n- Run `go mod tidy` to install dependent libraries\n- Run the project: `go run main.go`\n\n### Init project\n\n```shell\ngo run ./cmd/appinit\n```\n\n### Swagger Docs Generation\n\ninstallation:\n\n```bash\ngo get -u github.com/swaggo/swag/cmd/swag\n```\n\n\u003e Please check the documentation and examples of `swaggo/swag`\n\nGenerated to the specified directory:\n\n```bash\nswag init -o static\n# This file will be generated at the same time. It can be deleted if it is not needed.\nrm static/docs.go\n```\n\nNotice:\n\n\u003e `swaggo/swag` is the parsing field description information from the comment of the field\n\n```go\ntype SomeModel struct {\n\t// the name description\n\tName   string `json:\"name\" example:\"tom\"`\n}\t\n```\n\n## Help\n\n- Run the test\n\n```bash\nGo test\n// output coverage\nGo test -cover\n```\n\n- Formatting project\n\n```bash\ngofmt -s -l ./\ngo fmt ./...\n```\n\n- Run GoLint check\n\n\u003e Note: You need to install `GoLint` first.\n\n```bash\ngolint ./...\n```\n\n## Refer\n\n- [golang-standards/project-layout](https://github.com/golang-standards/project-layout)\n\n## License\n\n**MIT**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finhere%2Fgo-web-skeleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finhere%2Fgo-web-skeleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finhere%2Fgo-web-skeleton/lists"}