{"id":15287491,"url":"https://github.com/lukasjarosch/godin","last_synced_at":"2026-02-15T09:36:13.532Z","repository":{"id":72433179,"uuid":"177431942","full_name":"lukasjarosch/godin","owner":"lukasjarosch","description":"An opinionated toolkit for go-kit microservices","archived":false,"fork":false,"pushed_at":"2019-07-23T12:23:36.000Z","size":14703,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-09-13T12:01:53.106Z","etag":null,"topics":["docker","generator","go","go-kit","godin","gokit","golang","grpc","kubernetes","microservice","microservice-toolkit","opinionated","templates","toolkit"],"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/lukasjarosch.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":"2019-03-24T15:18:34.000Z","updated_at":"2019-07-23T12:08:33.000Z","dependencies_parsed_at":"2023-07-24T11:16:14.592Z","dependency_job_id":null,"html_url":"https://github.com/lukasjarosch/godin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/lukasjarosch/godin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasjarosch%2Fgodin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasjarosch%2Fgodin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasjarosch%2Fgodin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasjarosch%2Fgodin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukasjarosch","download_url":"https://codeload.github.com/lukasjarosch/godin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukasjarosch%2Fgodin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006355,"owners_count":26084088,"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-10-11T02:00:06.511Z","response_time":55,"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":["docker","generator","go","go-kit","godin","gokit","golang","grpc","kubernetes","microservice","microservice-toolkit","opinionated","templates","toolkit"],"created_at":"2024-09-30T15:29:33.566Z","updated_at":"2025-10-11T06:01:57.300Z","avatar_url":"https://github.com/lukasjarosch.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://raw.githubusercontent.com/lukasjarosch/godin/develop/gopher.png\"\u003e\n    \u003cimg src=\"gopher.png\" alt=\"Logo\" width=\"250\" height=\"250\"\u003e\n  \u003c/a\u003e\n\n# Godin - An opinionated toolkit for [go-kit](https://github.com/go-kit/kit) microservices\n\u003e Work in progress, be careful.\n\nAfter starting your journey into the realm of microservices with Go, you sooner or later start to get lazy and copy\u0026paste stuff.\nThings get horrbile to maintain and all the joy of programming escapes.\n\n**Godin** to the rescue! It helps you to create, update and maintain microservices using [go-kit](https://github.com/go-kit/kit/)\nas foundation.\n\nA quick summary of what Godin can do:\n* [x] initialize a new microservice project including Makefile, Dockerfile and Kubernetes deployment/service manifests\n* [x] generate a running go-kit microservice application based on a single service-interface.\n* [x] update all necessary files with one command `godin update` and all new functions in the service interface are prepared \n* [x] remove tedious copy\u0026paste work when writing request/response de-/encoders\n* [ ] add new bundles to quickly up the game (mysql, mongodb, pub/sub, ...)\n* [ ] pre-generate tests\n\n\n### Built With\n* [cobra](https://github.com/spf13/cobra)\n* [viper](https://github.com/spf13/viper)\n* [go-kit](https://github.com/go-kit/kit/)\n* [go-astra](https://github.com/vetcher/go-astra)\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n### Prerequisites\n* Go (1.12)\n* make\n* [packr v1](https://github.com/gobuffalo/packr)(!)\n\n### Installation\nHead over to the **Releases** page and download the appropriate archive. \nSimply unpack, put the binary in your `$PATH` and you're ready to roll.\n\n### Examples\nExamples are now hosted in a separate repository: [godin-examples](https://github.com/lukasjarosch/godin-examples)\n\n## Usage\n\n### Available commands\n|      |      |\n|------|------|\n| **init** | initialize a new godin project in the current directory |\n| **update** | update the project in the current directory and regenerate necessary stuff |\n| **add** | add bundles to an existing project |\n| **version** | print godin version |\n| **help** | Help about any command |\n\n\n### godin init\nCalling `godin init` will generate the following project structure in the CWD. First you need to answer\na few prompts to configure the project. You only have to do this once, after that the configuration is stored\nin `godin.json`\n\n````bash\n.\n├── cmd\n│   └── greeter\n├── Dockerfile\n├── godin.json\n├── go.mod\n├── internal\n│   ├── grpc\n│   └── service\n│       ├── endpoint\n│       ├── greeter\n│       ├── middleware\n│       │   └── middleware.go\n│       └── service.go\n└── pkg\n    └── grpc\n````\n\n### godin update\nAfter writing out the service interface in `internal/service/service.go`, calling `godin update` will\ngenerate everything required to serve a gRPC server. Middleware will automatically be added based on the project configuration \nin `godin.json`.\n\nThis is the structure `godin update` currently creates\n```bash\n.\n├── cmd\n│   └── user\n│       └── main.go\n├── Dockerfile\n├── godin.json\n├── go.mod\n├── go.sum\n├── internal\n│   ├── grpc\n│   │   ├── encode_decode.go\n│   │   ├── request_response.go\n│   │   └── server.go\n│   └── service\n│       ├── endpoint\n│       │   ├── endpoints.go\n│       │   ├── request_response.go\n│       │   └── set.go\n│       ├── middleware\n│       │   ├── logging.go\n│       │   └── middleware.go\n│       ├── service.go\n│       └── user\n│           └── implementation.go\n└── pkg\n    └── grpc\n```\n\nNot all files will be generated fully every time `update` is executed. Below is a table to see which\nfiles you'd better not edit :sweat_smile:.\n\n| File                                             | Mode       |\n|--------------------------------------------------|------------|\n| `internal/service/middleware/middleware.go`        | full |\n| `internal/service/middleware/logging.go`           | update     |\n| `internal/service/endpoint/endpoints.go`           | update     |\n| `internal/service/endpoint/request_response.go`           | full     |\n| `internal/service/endpoint/set.go`           | full     |\n| `internal/service/\u003cserviceName\u003e/implementation.go`  | update     |\n| `internal/grpc/request_response.go` | full |\n| `internal/grpc/server.go` | full |\n| `internal/grpc/encode_decode.go` | update |\n\n\n### configuration\nAfter `godin init` is called, everything is based off your service definition plus the `godin.json`. \nAn example of such a config file is listed below.\n\n```json\n{\n  \"godin\": {\n    \"version\": \"0.3.0\"\n  },\n  \"project\": {\n    \"created\": \"Sun, 23 Jun 2019 10:15:02 CEST\",\n    \"updated\": \"Sun, 23 Jun 2019 12:14:26 CEST\"\n  },\n  \"protobuf\": {\n    \"package\": \"github.com/lukasjarosch/godin-examples/user/api\",\n    \"service\": \"UserService\"\n  },\n  \"service\": {\n    \"endpoints\": {\n      \"create\": {\n        \"protobuf\": {\n          \"request\": \"CreateRequest\",\n          \"response\": \"CreateResponse\"\n        }\n      },\n      \"delete\": {\n        \"protobuf\": {\n          \"request\": \"DeleteRequest\",\n          \"response\": \"DeleteResponse\"\n        }\n      },\n      \"get\": {\n        \"protobuf\": {\n          \"request\": \"GetRequest\",\n          \"response\": \"GetResponse\"\n        }\n      },\n      \"list\": {\n        \"protobuf\": {\n          \"request\": \"ListRequest\",\n          \"response\": \"ListResponse\"\n        }\n      }\n    },\n    \"middleware\": {\n      \"authorization\": false,\n      \"caching\": false,\n      \"logging\": true,\n      \"recovery\": true\n    },\n    \"module\": \"github.com/lukasjarosch/godin-examples/user\",\n    \"name\": \"user\",\n    \"namespace\": \"godin\"\n  },\n  \"transport\": {\n    \"grpc\": {\n      \"enabled\": true\n    }\n  }\n}\n```\n\n### Middleware\nThere are three middleware levels: **service**, **endpoint** and **transport**\n\n#### Service middleware\nIt's implementation specific and allows to define a middleware on domain-level.\nHere you have full access to request and response data of the business logic (implementation.go).\nBy default, Godin will generate and maintain a logging middleware which logs the request and\nresponse data, errors and the execution time of your business logic.\n\nOther use-cases of service middlewares are: \n * caching\n * authentication\n * monitoring of business metrics (users_logged_in, queue_size, ...)\n \n#### Endpoint middleware\nIt's only provided by godin and is applicable to every endpoint.\nThe middleware does only have `interface{}` access to the request and response data. \nThis makes the endpoint middleware a great place to put all the annoying stuff which most of \nthe developers should not have to deal with, like:\n\n* Endpoint instrumentation (prometheus)\n* Circuit breaking\n* Distributed tracing\n* Rate limiting\n* General logging (endpoint request duration)\n\nCurrently, Godin does not provide all of those middlewares. The following are implemented:\n* [x] Prometheus endpoint instrumentation (exposed via `0.0.0.0:3000/metrics`). \n  - **endpoint_request_duration_ms**\n  - **endpoint_requests_current**\n  - **endpoint_requests_total**\n* [x] General logging to capture endpoint request duration\n* [ ] Circuit breaking\n* [ ] Rate limiting\n* [ ] Distributed tracing\n\n#### Transport middleware\nIt's (obviously) transport specific. Godin is currently only providing a gRPC server\nas that's it's main use-case. In the future, HTTP might follow.\n\nGodin automatically registers the [go-grpc-prometheus](https://github.com/grpc-ecosystem/go-grpc-prometheus) interceptors.\nThus these metrics are also registered and available via `/metrics`.\n\n### Tips and tricks\n#### Rename protobuf request/responses\nBy default, Godin will construct Protobuf requests and responses like this: `\u003cEndpointName\u003eRequest` and `\u003cEndpointName\u003eResponse`.\nThis might not always be correct as Godin does not parse the protobuf definition.\nIf you need to change the name of a request/response, proceed as follows:\n* call `godin update` to generate the default names and also to ensure that the endpoint exists in `godin.json`\n* refactor the app (search and replace) to use the new request for example. Search for: `*pb.\u003cEndpoint\u003eRequest` and replace with your actual name. Then also replace the name in `godin.json`\n* calling `godin update` will now work as expected again, but using your custom type name\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasjarosch%2Fgodin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasjarosch%2Fgodin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasjarosch%2Fgodin/lists"}