{"id":20843820,"url":"https://github.com/num30/go-rest-service-template","last_synced_at":"2025-07-29T02:38:20.837Z","repository":{"id":200042923,"uuid":"704106232","full_name":"num30/go-rest-service-template","owner":"num30","description":"Rest API service template. Swagger(OpenAPI), Metrics, configuration management, CI/CD, service tests","archived":false,"fork":false,"pushed_at":"2024-07-05T21:29:15.000Z","size":222,"stargazers_count":12,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-09T01:47:52.904Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/num30.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,"zenodo":null}},"created_at":"2023-10-12T14:47:18.000Z","updated_at":"2024-09-29T11:14:20.000Z","dependencies_parsed_at":"2023-12-01T16:27:02.205Z","dependency_job_id":"f919ad99-6ca6-4e8a-9cc6-b94b0cf6a86f","html_url":"https://github.com/num30/go-rest-service-template","commit_stats":null,"previous_names":["num30/go-rest-service-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/num30/go-rest-service-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/num30%2Fgo-rest-service-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/num30%2Fgo-rest-service-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/num30%2Fgo-rest-service-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/num30%2Fgo-rest-service-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/num30","download_url":"https://codeload.github.com/num30/go-rest-service-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/num30%2Fgo-rest-service-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267620579,"owners_count":24116810,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-18T02:07:26.280Z","updated_at":"2025-07-29T02:38:20.816Z","avatar_url":"https://github.com/num30.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rest Service Boilerplate\n\n## :gift: What is inside\n- Rest service based on [Gin](https://github.com/gin-gonic/gin) and [Fizz](https://github.com/wI2L/fizz) for OpenApi spec generation\n- Basic healthcheck (ping handler) (in `common` package)\n- Swagger UI available on `http://localhost:8080/swagger` an Open API spec on `http://localhost:8080/openapi.json`\n- serving Prometheus metrics on `http://localhost:10250/metrics`\n- custom metrics defined in [metrics.go](pkg/metrics/custom_metrics.go)\n- unit test for handlers in [pkg/server/router_test.go](pkg/server/router_test.go)\n- service-test tests in [/test/stest](test/stest/service_test.go). Refer to [service tests](https://github.com/num30/api-integration-test#rest-api-integration-test-example) repo for more info\n- Dockerfiles for service and [service test](Int.Dockerfile)\n- Basic configuration [config.go](pkg/config.go) based on [config](https://github.com/num30/config) package\n- CI with [Github Actions](.github/workflows/build.yaml) \n- Github actions for publishing docker image with versioning( tags set to `github-sha` and `branch-[build-number]`). Separate tags used for application and test image\n\n# :computer: Try it\n- run unit tests `go test ./... -v`\n- run server `go run cmd/server/main.go` \n- run service tests from another terminal `go test ./test/stest -tags servicetest  -v -count=1`\n- Send PUT request:\n```\n        curl -X 'PUT' 'http://localhost:8080/things/first-thing' \\\n        -d '{ \"value\": \"thing value\" }'  \n```\n- Send GET request \n```\n        curl 'http://localhost:8080/things/first-thing'\n```\n- Check swagger `http://localhost:8080/swagger`\n- Check Open API spec `http://localhost:8080/openapi.json`\n- Check Prometheus metrics `http://localhost:10250/metrics`\n\n## :whale: Try Docker Without Cloning the code \n- run service  `docker run -p 8080:8080 -p 10250:10250 orsol/go-rest-service-template:latest`\n- try steps from 3 to the end from [Try it](#computer-try-it) section\n\n\n## :bulb: Hints to get started \n\n- Copy whole directory \n- Replace `rest-service` with your service name everywhere in the project. Including Dockerfiles,  Makefile and go.mod\n- Adjust paths in go.mod according to the location of your project\n- Adjust import paths if needed\n- run `go mod tidy`\n- update routes and handlers in [pkg/server/router.go](pkg/server/router.go) defining API objects in [pkg/server/api.go](pkg/server/api.go)\n- Define you configuration structure in [pkg/config.go](pkg/config.go)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnum30%2Fgo-rest-service-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnum30%2Fgo-rest-service-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnum30%2Fgo-rest-service-template/lists"}