{"id":22896288,"url":"https://github.com/loderunner/boilr-grpc","last_synced_at":"2025-08-25T20:14:50.225Z","repository":{"id":146302968,"uuid":"116608370","full_name":"loderunner/boilr-grpc","owner":"loderunner","description":"A boilr template for a gRPC service, with a REST Gateway","archived":false,"fork":false,"pushed_at":"2018-01-16T15:28:13.000Z","size":28,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-07T20:29:24.140Z","etag":null,"topics":["go","golang","grpc","grpc-gateway","protobuf"],"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/loderunner.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":"2018-01-07T23:51:16.000Z","updated_at":"2023-10-19T07:50:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"5bb174af-47fe-4a5c-86f2-fd503da799bc","html_url":"https://github.com/loderunner/boilr-grpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/loderunner/boilr-grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loderunner%2Fboilr-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loderunner%2Fboilr-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loderunner%2Fboilr-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loderunner%2Fboilr-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loderunner","download_url":"https://codeload.github.com/loderunner/boilr-grpc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loderunner%2Fboilr-grpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272124786,"owners_count":24877726,"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-08-25T02:00:12.092Z","response_time":1107,"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":["go","golang","grpc","grpc-gateway","protobuf"],"created_at":"2024-12-13T23:34:25.212Z","updated_at":"2025-08-25T20:14:50.218Z","avatar_url":"https://github.com/loderunner.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# boilr-grpc\n\nA [boilr](https://github.com/tmrts/boilr) template for a gRPC Go project with [REST Gateway](https://github.com/grpc-ecosystem/grpc-gateway).\n\n## Installation\n\n### Prerequisites\n\n* [boilr](https://github.com/tmrts/boilr)\n\n### Download the template\n\nTo download the template from GitHub and save it to the local registry, type the following command:\n\n```shell\nboilr template download loderunner/boilr-grpc grpc\n```\n\nReplace `grpc` at the end of the command line by any name you want to give the template in your local registry.\n\n## Usage\n\n### Prerequisites\n\n* [Protocol Buffers](https://developers.google.com/protocol-buffers/)\n* [`protoc` plugin for Go](https://github.com/golang/protobuf)\n* [gRPC for Go](https://grpc.io/docs/quickstart/go.html)\n* [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway)\n\n### Generate a gRPC project from template\n\nTo use the template from your registry, type the following command:\n\n```shell\nboilr template use grpc project-name\n```\n\nReplace `project-name` by any name you want to give to your project. If you set the template name to something other than `grpc` when downloading, remember to change that also.\n\n`boilr` will create a directory with the name you entered and generate a project using the template. You will be prompted to set some variables. You can set them yourself or use the default values.\n\n* `ImportPath`: The full Go import path of your project. Default: `\"github.com/loderunner/echo\"`\n* `PackageName`: The name of the package, usually the same as your project directory and the last component of the import path. Default: `\"echo\"`\n* `ServiceName` : This will be the name of the template gRPC service. This name is only used in the Protobuf file and in the generated code. Default: `\"Echo\"`\n* `GrpcPort` : The port on which the server expose a gRPC endpoint. Default: `8080`\n* `RestPort` : The port on which the server expose a REST endpoint. Default: `8081`\n\n\u003e _Note:_ Because of Go's import system, the best practice would be to generate your project directly inside your Go path at the correct location, and give it corresponding directory name, import path and package name.\n\u003e\n\u003e For example, assuming your project's import path is `\"github.com/yourname/echo\"`, first `cd` to `$GOPATH/src/github.com/yourname` and generate the project from template: `boilr template use grpc echo`. Use the following variables:\n\u003e\n\u003e * `ImportPath`: `\"github.com/yourname/echo\"`\n\u003e * `PackageName`: `\"echo\"`\n\n### Build the project\n\nTo build the project, `cd` to the project directory and type:\n\n```shell\nmake\n```\n\n### Run\n\nRun the server by typing:\n\n```shell\n./echo\n```\n\nThis should expose a HTTP/2 gRPC endpoint on port 8080, and a HTTP/1.1 REST endpoint on port 8081. The template RPC `echo` should be available. Test it with:\n\n```shell\ncurl -sv http://localhost:8081/echo -H \"Content-Type: application/json\" -d '{\"message\": \"Hello World\"}'\n```\n\n##### HTTP Request\n\n```\nPOST /echo HTTP/1.1\nHost: localhost:8081\nUser-Agent: curl/7.54.0\nAccept: */*\nContent-Type: application/json\nContent-Length: 26\n\n{\"message\":\"Hello World\"}\n```\n\n##### HTTP Response\n\n```\nHTTP/1.1 200 OK\nContent-Type: application/json\nDate: Thu, 11 Jan 2018 11:31:24 GMT\nContent-Length: 25\n\n{\"message\":\"Hello World\"}\n```\n\n## Template details\n\n### Files\n\nThis is the directory structure after generating a project named `echo` from the template.\n\n```\n├── Makefile        # The make build system (see below)\n├── api\n│   └── echo.proto  # The Protobuf definition of the service RPCs and messages\n├── echo.go         # The main server executable code\n└── server\n    ├── handlers.go # The handlers for the gRPC calls\n    └── server.go   # The code relating to starting the gRPC/REST server\n```\n\n### Makefile targets\n\n* `build`: build the main server executable\n* `api`: generate all API sources from the protobuf definition\n* `dep`: fetch Go dependencies\n* `test`: run the package tests\n* `race`: run the package tests with the [race detector](https://golang.org/doc/articles/race_detector.html)\n* `msan`: run the package tests with the [memory sanitizer](https://golang.org/cmd/go/#hdr-Compile_packages_and_dependencies). Supported only on linux/amd64, and only with Clang/LLVM as the host C compiler.\n\n### Generated files\n\n#### Protobuf\n\nThe following files are generated from the protobuf definition (`api/echo.proto`) using `make api`.\n\n* `api/echo.pb.go`: Go source file for gRPC\n* `api/echo.pb.gw.go`: Go source file for the gRPC REST gateway\n* `api/echo.swagger.json`: [OpenAPI](https://github.com/OAI/OpenAPI-Specification) specification of the HTTP/1.1 REST API\n\n#### Executables\n\n* `echo`: The server's main executable file\n\n----\n\nAn example of the generated repository can be found at [loderunner/echo](https://github.com/loderunner/echo). It should be up-to-date.\n\n## Contributing\n\nHave an issue? Want to request a feature? Feel free to report any problems you encounter or features you think are missing.\n\nWant to contribute some code? Just fork this repository and submit a pull request. Don't forget to add your name to the list of contributors below!\n\n## Contributors\n\n* [Charles Francoise](https://github.com/loderunner)\n\n## MIT License\n\nCopyright © 2018 Charles Francoise\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floderunner%2Fboilr-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floderunner%2Fboilr-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floderunner%2Fboilr-grpc/lists"}