{"id":20785924,"url":"https://github.com/gogo/grpc-example","last_synced_at":"2025-04-13T05:07:58.059Z","repository":{"id":57484292,"uuid":"122256104","full_name":"gogo/grpc-example","owner":"gogo","description":"An example of using Go gRPC and tools from the greater gRPC ecosystem together with the GoGo Protobuf Project.","archived":false,"fork":false,"pushed_at":"2021-11-27T01:54:22.000Z","size":19798,"stargazers_count":452,"open_issues_count":0,"forks_count":87,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-13T05:07:49.511Z","etag":null,"topics":["gogo-protobuf","golang","grpc","grpc-gateway","openapi-ui","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gogo.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":"2018-02-20T21:04:31.000Z","updated_at":"2025-03-21T10:42:26.000Z","dependencies_parsed_at":"2022-08-26T13:41:24.462Z","dependency_job_id":null,"html_url":"https://github.com/gogo/grpc-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogo%2Fgrpc-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogo%2Fgrpc-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogo%2Fgrpc-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gogo%2Fgrpc-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gogo","download_url":"https://codeload.github.com/gogo/grpc-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665747,"owners_count":21142123,"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","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":["gogo-protobuf","golang","grpc","grpc-gateway","openapi-ui","protobuf"],"created_at":"2024-11-17T14:49:34.714Z","updated_at":"2025-04-13T05:07:58.041Z","avatar_url":"https://github.com/gogo.png","language":"Go","readme":"# gRPC-Example\n[![Build Status](https://travis-ci.org/gogo/grpc-example.svg?branch=master)](https://travis-ci.org/gogo/grpc-example)\n\nThis repo is an example of using [Go gRPC](https://github.com/grpc/grpc-go)\nand tools from the greater gRPC ecosystem together with  the\n[GoGo Protobuf Project](https://github.com/gogo/protobuf).\n\n![OpenAPI UI in action](./swagger.png)\n\n## Installation\n\n```bash\n$ go get -u github.com/gogo/grpc-example\n```\n\n## Running it\n\n```bash\n$ grpc-example\nINFO: Serving gRPC on https://localhost:10000\nINFO: parsed scheme: \"passthrough\"\nINFO: ccResolverWrapper: sending new addresses to cc: [{localhost:10000 0  \u003cnil\u003e}]\nINFO: ClientConn switching balancer to \"pick_first\"\nINFO: pickfirstBalancer: HandleSubConnStateChange: 0xc420097cd0, CONNECTING\nINFO: pickfirstBalancer: HandleSubConnStateChange: 0xc420097cd0, READY\nINFO: Serving gRPC-Gateway on https://localhost:11000\nINFO: Serving OpenAPI Documentation on https://localhost:11000/openapi-ui/\n```\n\nAfter starting the server, you can access the OpenAPI UI on\n[https://localhost:11000/openapi-ui/](https://localhost:11000/openapi-ui/)\n\n## Development\n\nTo regenerate the proto files, ensure you have installed the generate dependencies:\n\n```bash\n$ GO111MODULE=on make install\ngo get \\\n        github.com/gogo/protobuf/protoc-gen-gogo \\\n        github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \\\n        github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \\\n        github.com/mwitkow/go-proto-validators/protoc-gen-govalidators \\\n        github.com/rakyll/statik\ngo: finding github.com/mwitkow/go-proto-validators/protoc-gen-govalidators latest\ngo: finding github.com/mwitkow/go-proto-validators latest\ngo: finding github.com/gogo/protobuf/protoc-gen-gogo latest\ngo: finding github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger latest\ngo: finding github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway latest\n```\n\nIt also requires you to have the Google Protobuf compiler `protoc` installed.\nPlease follow instructions for your platform on the\n[official protoc repo](https://github.com/google/protobuf#protocol-compiler-installation).\n\nRegenerate the files by running `make generate`:\n\n```bash\n$ make generate\n# Generate gogo, gRPC-Gateway, swagger, go-validators output.\n#\n# -I declares import folders, in order of importance\n# This is how proto resolves the protofile imports.\n# It will check for the protofile relative to each of these\n# folders and use the first one it finds.\n#\n# --gogo_out generates GoGo Protobuf output with gRPC plugin enabled.\n# --grpc-gateway_out generates gRPC-Gateway output.\n# --swagger_out generates an OpenAPI 2.0 specification for our gRPC-Gateway endpoints.\n# --govalidators_out generates Go validation files for our messages types, if specified.\n#\n# The lines starting with Mgoogle/... are proto import replacements,\n# which cause the generated file to import the specified packages\n# instead of the go_package's declared by the imported protof files.\n#\n# $GOPATH/src is the output directory. It is relative to the GOPATH/src directory\n# since we've specified a go_package option relative to that directory.\n#\n# proto/example.proto is the location of the protofile we use.\nprotoc \\\n        -I proto \\\n        -I vendor/github.com/grpc-ecosystem/grpc-gateway/ \\\n        -I vendor/github.com/gogo/googleapis/ \\\n        -I vendor/ \\\n        --gogo_out=plugins=grpc,\\\nMgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\\\nMgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\\\nMgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\\\n$GOPATH/src/ \\\n        --grpc-gateway_out=allow_patch_feature=false,\\\nMgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\\\nMgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\\\nMgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\\\n$GOPATH/src/ \\\n        --swagger_out=third_party/OpenAPI/ \\\n        --govalidators_out=gogoimport=true,\\\nMgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\\\nMgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,\\\nMgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api,\\\nMgoogle/protobuf/field_mask.proto=github.com/gogo/protobuf/types:\\\n$GOPATH/src \\\n        proto/example.proto\n# Workaround for https://github.com/grpc-ecosystem/grpc-gateway/issues/229.\nsed -i.bak \"s/empty.Empty/types.Empty/g\" proto/example.pb.gw.go \u0026\u0026 rm proto/example.pb.gw.go.bak\n# Generate static assets for OpenAPI UI\nstatik -m -f -src third_party/OpenAPI/\n```\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogo%2Fgrpc-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgogo%2Fgrpc-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgogo%2Fgrpc-example/lists"}