{"id":13367407,"url":"https://github.com/clayGod/microservice","last_synced_at":"2025-03-12T18:32:35.466Z","repository":{"id":57483503,"uuid":"76543058","full_name":"claygod/microservice","owner":"claygod","description":"This library provides a simple microservice framework based on clean architecture principles with a working example implemented.","archived":false,"fork":false,"pushed_at":"2025-03-05T17:29:18.000Z","size":11337,"stargazers_count":117,"open_issues_count":0,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-05T17:40:34.168Z","etag":null,"topics":["clean-architecture","framework","go","golang","microservice","microservices"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/claygod.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-12-15T09:07:04.000Z","updated_at":"2025-03-05T17:29:22.000Z","dependencies_parsed_at":"2024-06-20T05:20:49.004Z","dependency_job_id":"d9d020f4-51c8-4779-846f-0742e1285abb","html_url":"https://github.com/claygod/microservice","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/claygod%2Fmicroservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygod%2Fmicroservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygod%2Fmicroservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/claygod%2Fmicroservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/claygod","download_url":"https://codeload.github.com/claygod/microservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243271635,"owners_count":20264494,"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","framework","go","golang","microservice","microservices"],"created_at":"2024-07-30T00:01:47.263Z","updated_at":"2025-03-12T18:32:35.455Z","avatar_url":"https://github.com/claygod.png","language":"Go","funding_links":[],"categories":["Web 框架"],"sub_categories":["高级控制台界面","高級控制台界面"],"readme":"# Microservice\n\n[![API documentation](https://godoc.org/github.com/claygod/microservice?status.svg)](https://godoc.org/github.com/claygod/microservice)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n[![forks](https://img.shields.io/github/forks/claygod/microservice)](https://github.com/claygod/microservice/network/members)\n[![stars](https://img.shields.io/github/stars/claygod/microservice)](https://github.com/claygod/microservice/stargazers)\n[![Go Report Card](https://goreportcard.com/badge/github.com/claygod/microservice)](https://goreportcard.com/report/github.com/claygod/microservice)\n\nThe framework for the creation of microservices, written in Golang. \nThis package is implemented using clean architecture principles.\nA good article on implementing these principles in Golang:\nhttp://manuel.kiessling.net/2012/09/28/applying-the-clean-architecture-to-go-applications/\n\n## Install\n\n```\ngit clone ginhub.com/claygod/microservice\ncd microservice\nmake build\nmake run\n```\n\nGo to `localhost:8080` in your web browser\n\n### Version\n\n```\ngit clone ginhub.com/claygod/microservice\ncd microservice\nmake build\nmake version\n```\nOR\n```\ngit clone ginhub.com/claygod/microservice\ncd microservice\nmake build\nmicro --version\n```\n\n## Endpoints\n\nCode in `/services/gateways/gatein/gatein.go`\n\n- `/` welcome handler\n- `/healthz/ready` for SRE\n- `/healthz` for kubernetes\n- `/readyness` for kubernetes\n- `/metrics` prometheus metrics\n- `/swagger` generate swagger fo api\n- `/piblic/v1/bar/:key` public route (example)\n\n\u003e [!CAUTION]\n\u003e Requests from an external balancer should be forwarded not to the root of endpoints, but to `/public`. \n\u003e Then service routes with metrics and other private information will be inaccessible to external users.\n\n### Using\n\nBuild and run main.go\n\nExample requests:\n\n- localhost:8080/piblic/v1/bar/one -\u003e {\"Data\":\"three\"}\n- localhost:8080/piblic/v1/bar/secret -\u003e response 404\n- localhost:8080/piblic/v1/bar/looooonnngggoooooggkkkeeyyyyyyy -\u003e response 400 (not valid)\n- localhost:8080/healthz/ready -\u003e minute first 5 sec - 503 after 200 (for example!)\n- localhost:8080/healthz -\u003e minute first 5 sec - 503 after 200 (for example!)\n- localhost:8080/readyness -\u003e response 200\n- localhost:8080/swagger -\u003e json-swagger\n\n### Swagger\n\nAfter starting the application, the first time route `/swagger` is called, \nthe swagger file `config/swagger.yaml` is regenerated.\n\n### Environment\n\nAdd to ENV `export GATE_IN_TITLE=Yo-ho-ho!` :+1:\nang open in browser `http://localhost:8080/` :tada:\n\n## Clean architecture\n\n\u003e [!IMPORTANT]\n\u003e Distribution of architectural entities by layers\n\n#### Entity\n\nPath */domain*\n\n#### Usecases\n\nPath */usecases*\n\n#### Interfaces\n\nPath */service*\n\n#### Infrastructure\n\nPath */app* , */config* and core\n\n## Config\n\nThe default configuration file:\n- `config/config.yaml`\n\nSpecify in the command line another file:\n- `yourservice -config other.yaml`\n\n## Dependencies\n\n\tgithub.com/claygod/tools v0.1.2\n\tgithub.com/dsbasko/go-cfg v1.2.0\n\tgithub.com/go-playground/validator/v10 v10.22.1\n\tgithub.com/google/uuid v1.3.0\n\tgithub.com/julienschmidt/httprouter v1.3.0\n\tgithub.com/pborman/getopt v1.1.0\n\tgithub.com/prometheus/client_golang v1.11.1\n\tgithub.com/savaki/swag v0.0.0-20170722173931-3a75479e44a3\n\tsigs.k8s.io/yaml v1.4.0\n\n\tgithub.com/BurntSushi/toml v1.3.2 // indirect\n\tgithub.com/beorn7/perks v1.0.1 // indirect\n\tgithub.com/caarlos0/env/v10 v10.0.0 // indirect\n\tgithub.com/cespare/xxhash/v2 v2.1.1 // indirect\n\tgithub.com/gabriel-vasile/mimetype v1.4.3 // indirect\n\tgithub.com/go-playground/locales v0.14.1 // indirect\n\tgithub.com/go-playground/universal-translator v0.18.1 // indirect\n\tgithub.com/golang/protobuf v1.5.0 // indirect\n\tgithub.com/joho/godotenv v1.5.1 // indirect\n\tgithub.com/kr/text v0.2.0 // indirect\n\tgithub.com/leodido/go-urn v1.4.0 // indirect\n\tgithub.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect\n\tgithub.com/prometheus/client_model v0.2.0 // indirect\n\tgithub.com/prometheus/common v0.26.0 // indirect\n\tgithub.com/prometheus/procfs v0.6.0 // indirect\n\tgithub.com/spf13/pflag v1.0.5 // indirect\n\tgolang.org/x/crypto v0.31.0 // indirect\n\tgolang.org/x/net v0.33.0 // indirect\n\tgolang.org/x/sys v0.28.0 // indirect\n\tgolang.org/x/text v0.21.0 // indirect\n\tgoogle.golang.org/protobuf v1.33.0 // indirect\n\tgopkg.in/yaml.v3 v3.0.1 // indirect\n\t\n## ToDo\n\n- [x] Use environment variables in configuration\n- [x] Add support for metrics\n- [x] Input validate\n- [x] Swagger 2.0\n- [x] \"version\" command line\n- [ ] Dockerfile\n- [ ] docker_build in Makefile\n- [ ] docker_run in Makefile\n- [ ] docker_push in Makefile\n- [ ] Use protocol gRPC\n\n## Conclusion\n\nMicroservice does not claim the laurels of the only true solution, but on occasion, I hope, will help you create your own micro-architecture of the service, becoming the prototype for future applications.\n\n## Give us a star!\n\n\u003e [!TIP]\n\u003e If you like or are using this project to learn or start your solution, please give it a star. Thank you!\n\n## License\n\nGNU GENERAL PUBLIC LICENSE Version 3\n\n### Copyright \n\nCopyright © 2017-2025 Eduard Sesigin. All rights reserved. Contacts: claygod@yandex.ru\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FclayGod%2Fmicroservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FclayGod%2Fmicroservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FclayGod%2Fmicroservice/lists"}