{"id":13836953,"url":"https://github.com/devimteam/microgen","last_synced_at":"2026-01-31T20:52:36.176Z","repository":{"id":57485797,"uuid":"87704120","full_name":"devimteam/microgen","owner":"devimteam","description":"Tool to generate go-kit microservices","archived":false,"fork":false,"pushed_at":"2019-04-03T13:51:39.000Z","size":733,"stargazers_count":150,"open_issues_count":16,"forks_count":23,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-07-10T21:23:13.849Z","etag":null,"topics":["generator","go","gokit"],"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/devimteam.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":"2017-04-09T11:39:40.000Z","updated_at":"2024-10-29T19:11:00.000Z","dependencies_parsed_at":"2022-09-10T20:01:31.045Z","dependency_job_id":null,"html_url":"https://github.com/devimteam/microgen","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/devimteam/microgen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devimteam%2Fmicrogen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devimteam%2Fmicrogen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devimteam%2Fmicrogen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devimteam%2Fmicrogen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devimteam","download_url":"https://codeload.github.com/devimteam/microgen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devimteam%2Fmicrogen/sbom","scorecard":{"id":337653,"data":{"date":"2025-08-11","repo":{"name":"github.com/devimteam/microgen","commit":"b71c1fa49a6f38b0d3a0726c66534230fb643ddc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/3 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 28 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T05:07:42.398Z","repository_id":57485797,"created_at":"2025-08-18T05:07:42.399Z","updated_at":"2025-08-18T05:07:42.399Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28954393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["generator","go","gokit"],"created_at":"2024-08-04T15:00:57.959Z","updated_at":"2026-01-31T20:52:36.153Z","avatar_url":"https://github.com/devimteam.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Microgen\n\nTool to generate microservices, based on [go-kit](https://gokit.io/), by specified service interface.  \nThe goal is to generate code for service which not fun to write but it should be written.\n\n## Install\n```\ngo get -u github.com/devimteam/microgen/cmd/microgen\n```\n\nNote: If you have problems with building microgen, please, install [dep](https://github.com/golang/dep) and use `dep ensure` command to install correct versions of dependencies ([#29](https://github.com/devimteam/microgen/issues/29)).\n\n## Usage\n``` sh\nmicrogen [OPTIONS]\n```\nmicrogen tool search in file first `type * interface` with docs, that contains `// @microgen`.\n\ngeneration parameters provides through [\"tags\"](#tags) in interface docs after general `// @microgen` tag (space before @ __required__).\n\n#### Recommended project layout\nMicrogen uses [standard-like](https://github.com/golang-standards/project-layout) layout for generating boilerplate.\nDefault layout of project:\n```\n├── cmd\n│   └── user_service\n│       └── main.go\n├── pb\n│   └── api.proto\n├── service\n│   ├── caching.go\n│   ├── caching.microgen.go\n│   ├── error_logging.microgen.go\n│   ├── logging.microgen.go\n│   ├── middleware.microgen.go\n│   └── recovering.microgen.go\n├── transport                  // And may be some others in future, NATS or AMQP for example\n│   ├── grpc\n│   │   ├── client.microgen.go\n│   │   ├── protobuf_endpoint_converters.microgen.go\n│   │   ├── protobuf_type_converters.microgen.go\n│   │   └── server.microgen.go\n│   ├── http\n│   │   ├── client.microgen.go\n│   │   ├── converters.microgen.go\n│   │   └── server.microgen.go\n│   ├── client.microgen.go\n│   ├── endpoints.microgen.go\n│   ├── exchanges.microgen.go\n│   └── server.microgen.go\n├── usersvc\n│   ├── api.go\n│   └── user.go\n├── vendor/\n├── Dockerfile\n├── Gopkg.lock\n├── Gopkg.toml\n├── Makefile\n└── README.md\n```\n##### root directory\nContains other dirs and top-level project files, like `Dockerfile, Makefile, Readme.md`, etc.\n##### cmd\nContains applications.\n##### transport\nContains all transport specific code for all transports: http, grpc, amqp, udp, and so on.\n##### service\nMiddleware in past. Should contain service realisations and closures (middlewares).\u003cbr/\u003e\nIf you need new implementation of service, just add directory `/v2/` or something else.\n##### \\\u003cproject name\\\u003e\nContains domain-specific types.\n##### and others\nContains everything you want, just separate them by purposes.\n\nQ: How microgen generates for this layout?\u003cbr/\u003e\nA: `cd \u003cproject name\u003e; microgen -out=./..`\u003cbr/\u003e\n\nTo find more, check examples folder.\n\n### Options\n\n| Name   | Default    | Description                                                                   |\n|:------ |:-----------|:------------------------------------------------------------------------------|\n| -file  | service.go | Relative path to source file with service interface                           |\n| -out   | .          | Relative or absolute path to directory, where you want to see generated files |\n| -v     | 1          | Sets microgen verbose level. 0 - print only errors.                           |\n| -help  | false      | Print usage information                                                       |\n| -debug | false      | Print all microgen messages. Equivalent to -v=100.                            |\n| -.proto|            | Package field in protobuf file. If not empty, service.proto file will be generated. |\n\n\\* __Required option__\n\n### Markers\nMarkers is a general tags, that participate in generation process.\nTypical syntax is: `// @\u003ctag-name\u003e:`\n\n#### @microgen\nMain tag for microgen tool. Microgen scan file for the first interface which docs contains this tag.  \nTo add templates for generation, add their [tags](#tags), separated by comma after `@microgen:`\nExample:\n```go\n// @microgen middleware, logging\ntype StringService interface {\n    ServiceMethod(ctx context.Context) (err error)\n}\n```\n#### @protobuf\nProtobuf tag is used for package declaration of compiled with `protoc` grpc package.  \nExample:\n```go\n// @microgen grpc-server\n// @protobuf github.com/user/repo/path/to/protobuf\ntype StringService interface {\n    ServiceMethod(ctx context.Context) (err error)\n}\n```\n`@protobuf` tag is optional, but required for `grpc`, `grpc-server`, `grpc-client` generation.\n\n#### @grpc-addr\nThis tag allows to add construction for default grpc server addr in generated grpc client.\n```go\nif addr == \"\" {\n    addr = \"service.string.StringService\"\n}\n```\nExample:\n```go\n// @microgen grpc-client\n// @grpc-addr service.string.StringService\ntype StringService interface {\n    ServiceMethod(ctx context.Context) (err error)\n}\n```\n\n### Method's tags\n#### @microgen -\nMicrogen will ignore method with this tag everywere it can.\n\n```go\n// @microgen main, logging\ntype StringService interface {\n    // @microgen -\n    Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error)\n}\n```\n\n#### @logs-ignore\nThis tag is used for logging middleware, when some arguments or results should not be logged, e.g. passwords or files.  \nIf `context.Context` is first argument, it ignored by default.\nProvide parameters names, separated by comma, to exclude them from logs.  \nExample:\n```go\n// @microgen logging\ntype FileService interface {\n    // @logs-ignore data\n    UploadFile(ctx context.Context, name string, data []byte) (link string, err error)\n}\n```\n\n#### @logs-len\nThis tag is used for logging middleware. It prints length of parameters.\nExample:  \n```go\n// @microgen logging\ntype FileService interface {\n    // @logs-ignore data\n    // @logs-len data\n    UploadFile(ctx context.Context, name string, data []byte) (link string, err error)\n}\n```\n\n#### @http-method\nThis tag is used for http server and client to set different from POST method. This tag has special validation rules for GET method.\nExample:  \n```go\n// @microgen logging\ntype StringService interface {\n    // @http-method GET\n    Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error)\n}\n```\n\n#### cache-key\nThis tag is used for caching middleware and allows user to write expression that should be used as key for cache instance.\u003cbr/\u003e\nKey may be any string: it will directly writes to generated code.\n\n```go\n// @microgen caching\ntype StringService interface {\n    // @cache-key strings.ToLower(text)\n    Count(ctx context.Context, text string, symbol string) (count int, positions []int, err error)\n}\n```\n\n### Tags\nAll allowed tags for customize generation provided here.\n\n| Tag         | Description                                                                                                                   |\n|:------------|:------------------------------------------------------------------------------------------------------------------------------|\n| middleware  | General application middleware interface. Generates every time.                                                               |\n| logging     | Middleware that writes to logger all request/response information with handled time. Generates every time.                    |\n| error-logging | Middleware that writes to logger errors of method calls, if error is not nil.                                               |\n| recovering  | Middleware that recovers panics and writes errors to logger. Generates every time.                                            |\n| caching     | Middleware that caches responses of service. Adds missed functions.                                                           |\n| grpc-client | Generates client for grpc transport with request/response encoders/decoders. Do not generates again if file exist.            |\n| grpc-server | Generates server for grpc transport with request/response encoders/decoders. Do not generates again if file exist.            |\n| grpc        | Generates client and server for grpc transport with request/response encoders/decoders. Do not generates again if file exist. |\n| http-client | Generates client for http transport with request/response encoders/decoders. Do not generates again if file exist.            |\n| http-server | Generates server for http transport with request/response encoders/decoders. Do not generates again if file exist.            |\n| http        | Generates client and server for http transport with request/response encoders/decoders. Do not generates again if file exist. |\n| main        | Generates basic `package main` for starting service. Uses other tags for minimal user changes.                                |\n| tracing     | Generates options and params for opentracing.                                                                                 |\n| metrics     | Generates transport endpoints middlewares for common tracing purposes.                                                                                 |\n\n## Example\nYou may find examples in `examples` directory, where `svc` contains all, what you need for successful generation, and `generated` contains what you will get after `microgen`.\n\nFollow this short guide to try microgen tool.\n\n1. Create file `service.go` inside GOPATH and add code below.\n```go\npackage stringsvc\n\nimport (\n\t\"context\"\n\n\t\"github.com/devimteam/microgen/example/svc/entity\"\n)\n\n// @microgen middleware, logging, grpc, http, recovering, main\n// @protobuf github.com/devimteam/microgen/example/protobuf\ntype StringService interface {\n\t// @logs-ignore ans, err\n\tUppercase(ctx context.Context, stringsMap map[string]string) (ans string, err error)\n\tCount(ctx context.Context, text string, symbol string) (count int, positions []int, err error)\n\t// @logs-len comments\n\tTestCase(ctx context.Context, comments []*entity.Comment) (tree map[string]int, err error)\n}\n```\n2. Open command line next to your `service.go`.\n3. Enter `microgen`. __*__\n4. You should see something like that:\n```\n@microgen 0.5.0\nall files successfully generated\n```\n5. Now, add and generate protobuf file (if you use grpc transport) and write transport converters (from protobuf/json to golang and _vise versa_).\n6. Use endpoints in your `package main` or wherever you want. (tag `main` generates some code for `package main`)\n\n__*__ `GOPATH/bin` should be in your PATH.\n\n## Interface declaration rules\nFor correct generation, please, follow rules below.\n\nGeneral:\n* Interface should be valid golang code.\n* All interface method's arguments and results should be named and should be different (name duplicating unacceptable).\n* First argument of each method should be of type `context.Context` (from [standard library](https://golang.org/pkg/context/)).\n* Last result should be builtin `error` type.\n---\nGRPC and Protobuf:  \n* Name of _protobuf_ service should be the same, as interface name.\n* Function names in _protobuf_ should be the same, as in interface.\n* Message names in _protobuf_ should be named `\u003cFunctionName\u003eRequest` or `\u003cFunctionName\u003eResponse` for request/response message respectively.\n* Field names in _protobuf_ messages should be the same, as in interface methods (_protobuf_ - snake_case, interface - camelCase).\n---\nHTTP GET method (`// @http-method GET`)\n* Parameters types should be `string`, `int`, `int32`, `int64`, `uint`, `uint32` or `uint64`.\n\n## Dependency\nlist out of date!\nAfter generation your service may depend on this packages:\n```\n    \"net/http\"      // for http purposes\n    \"bytes\"\n    \"encoding/json\" // for http purposes\n    \"io/ioutil\"\n    \"strings\"\n    \"net\"           // for http and grpc listners\n    \"net/url\"       // for http purposes\n    \"fmt\"\n    \"context\"\n    \"time\"          // for logging\n    \"os\"            // for signal handling and os.Stdout\n    \"os/signal\"     // for signal handling \n    \"syscall\"       // for signal handling\n    \"errors\"        // for error handling\n    \n\n    \"google.golang.org/grpc\"                    // for grpc purposes\n    \"golang.org/x/net/context\"\n    \"github.com/go-kit/kit\"                     // for grpc purposes\n    \"github.com/golang/protobuf/ptypes/empty\"   // for grpc purposes\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevimteam%2Fmicrogen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevimteam%2Fmicrogen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevimteam%2Fmicrogen/lists"}