{"id":18898265,"url":"https://github.com/powerpuffpenguin/jsgenerate_grpc","last_synced_at":"2026-05-10T07:55:58.883Z","repository":{"id":124271936,"uuid":"336934116","full_name":"powerpuffpenguin/jsgenerate_grpc","owner":"powerpuffpenguin","description":"grpc framework can work with gin and grpc-gateway","archived":false,"fork":false,"pushed_at":"2021-05-29T05:53:37.000Z","size":15586,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-05T00:14:22.732Z","etag":null,"topics":["angular","framework","gin","grpc-gateway","grpc-go"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/powerpuffpenguin.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":"2021-02-08T01:58:59.000Z","updated_at":"2021-05-29T05:53:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"f981f717-739a-400b-9ef9-eaa58a63ea4b","html_url":"https://github.com/powerpuffpenguin/jsgenerate_grpc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/powerpuffpenguin/jsgenerate_grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerpuffpenguin%2Fjsgenerate_grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerpuffpenguin%2Fjsgenerate_grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerpuffpenguin%2Fjsgenerate_grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerpuffpenguin%2Fjsgenerate_grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/powerpuffpenguin","download_url":"https://codeload.github.com/powerpuffpenguin/jsgenerate_grpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/powerpuffpenguin%2Fjsgenerate_grpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278898332,"owners_count":26064975,"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-08T02:00:06.501Z","response_time":56,"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":["angular","framework","gin","grpc-gateway","grpc-go"],"created_at":"2024-11-08T08:41:43.739Z","updated_at":"2025-10-08T06:11:47.381Z","avatar_url":"https://github.com/powerpuffpenguin.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Deprecated, please use the new template [https://github.com/powerpuffpenguin/jsgenerate_grpc-gateway](https://github.com/powerpuffpenguin/jsgenerate_grpc-gateway)\n\n# jsgenerate_grpc\n\n[中文](https://github.com/powerpuffpenguin/jsgenerate_grpc/blob/master/README_ZH.md)\n\nA grpc framework template Use [jsgenerate](https://github.com/powerpuffpenguin/jsgenerate) tool to quickly create a grpc server framework, which can work with gin grpc-gateway.\n\n# install\n\nAfter installing [jsgenerate](https://github.com/powerpuffpenguin/jsgenerate), clone the project to the **~/.jsgenerate/init** folder\n\n# new project\n\nUse the following command to initialize the frame in the current directory\n\n```\njsgenerate init jsgenerate_grpc -p your_domain/your_project -t init-supplement -t default\n```\n\nPlease replace **your_domain/your_project** with your own project package name\n\n|tag|meaning|\n|---|---|\n|init-supplement|Skip existing files|\n|init-trunc|Overwrite existing file|\n|gateway|Generate gateway code|\n|gin|Generate gateway,gin code|\n|view|Generate gateway, gin code and a default angular front-end code|\n|db|Generate database code|\n|default|gateway+gin+view+db|\n\n# Directory Structure\n\n* bin -\u003e output file directory\n* cmd -\u003e console command analysis\n   * cmd/internal/daemon -\u003e Frame entrance\n* Configure -\u003e project configuration file analysis\n* js-build -\u003e automation script implemented by typescript\n* build.js -\u003e automation script\n* logger -\u003e log system\n* management -\u003e grpc module management and middleware\n   * module -\u003e grpc module\n   * pb -\u003e grpc protocol definition\n   * protocol -\u003e golang grpc code generated by protoc\n* static -\u003e when using gin, embedded web static files\n* third_party -\u003e googleapis\n* utils -\u003e tool function types used in some projects\n* web -\u003e embedded gin support\n* view -\u003e angular front-end project created when using the view tag to initialize\n\n# module\n\nThe struct Management in package management implements module management and middleware management.DefaultManagement() will return the default module manager\n\nManagement will confirm the processing module according to the fullMethod requested by grpc. The fullMethod is parsed according to the prefix + module id + implementation method. For example\n1. The project prefix (generated from the project name) is /jsgenerate_kk.\n2. fullMethod is /jsgenerate_kk.features.logger/Service.Level\n3. At this time, Management will forward the request to the Service.Level of the features.logger module to respond\n4. At this time proto should be defined `package jsgenerate_kk.features.logger;`\n\n**pb/features** and **module/features** should be one-to-one correspondence, used to define grpc and implement grpc modules, respectively. You can refer to the generated default module to implement your own module.\n\nA Management module needs to implement the Module interface\n\n```\n// Module grpc module interface\ntype Module interface {\n\t// ID module id must lower case and unique\n\tID() string\n\n\t// OnStart callback at before started \n\tOnStart(basePath string, data json.RawMessage)\n\n\t// RegisterGRPC register grpc \n\tRegisterGRPC(srv *grpc.Server, middleware *Middleware) error\n\t// RegisterGateway  register grpc-gateway\n\tRegisterGateway(srv *runtime.ServeMux, clientConn *grpc.ClientConn) error\n\n\t// OnReload callback when module should reload configure\n\tOnReload(basePath string, data json.RawMessage, tag string) (e error)\n\n\t// OnClearDBCache callback when module should clear db cache\n\tOnClearDBCache(tag string) error\n\n\t// OnClearCache callback when module should clear cache\n\tOnClearCache(tag string) error\n\n\t// OnStop callback at before stoped \n\tOnStop()\n}\n```\n\n\u003e If you don't need to support grpc-gateway, you don't need to define RegisterGateway\n\n# middleware\n\n* Package management implements a middleware with two functions compatible with grpc interceptor. You should register the middleware for the function of the current module in RegisterGRPC\n* You can refer to the default module in **/module/features** to see how to use middleware\n* You can refer to the implementation in **/module/interceptor.go** to implement your own middleware\n\n# build.js\n\nbuild.js is an automation tool under nodejs that provides project compilation functions\n\n```\n$ ./build.js \nUsage: ./build.js [options] [command]\n\nOptions:\n  -h, --help         display help for command\n\nCommands:\n  linux [options]    build code to linux\n  freebsd [options]  build code to freebsd\n  darwin [options]   build code to darwin\n  windows [options]  build code to windows\n  version            update version/version.go\n  test [options]     run go test\n  grpc [options]     build *.proto to grpc code\n  source             build static source to golang code\n  help [command]     display help for command\n```\n\nexample\n```\n# Generate the proto in /pb into golang's grpc implementation\n# If grpc-gateway is enabled, please refer to https://github.com/grpc-ecosystem/grpc-gateway to configure the environment\n./build.js grpc -l go\n\n# Embed /static into the front end of the web page, if the gin function is not enabled, this operation is not required\n./build.js source\n\n# Compile the program under linux/freebsd/darwin/windows\n./build.js linux\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerpuffpenguin%2Fjsgenerate_grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowerpuffpenguin%2Fjsgenerate_grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerpuffpenguin%2Fjsgenerate_grpc/lists"}