{"id":25449761,"url":"https://github.com/utmhikari/protobuf-grpc-starter","last_synced_at":"2026-04-18T07:31:20.886Z","repository":{"id":100476000,"uuid":"352308381","full_name":"utmhikari/protobuf-grpc-starter","owner":"utmhikari","description":"a tiny project (web server + cache svr) to show the usage of protobuf \u0026 grpc in backend service development of Go language","archived":false,"fork":false,"pushed_at":"2021-04-01T05:06:50.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-16T09:07:23.268Z","etag":null,"topics":["backend","gin","golang","grpc","microservice","protobuf","webapp"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/utmhikari.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-28T11:14:17.000Z","updated_at":"2021-04-01T05:07:57.000Z","dependencies_parsed_at":"2023-05-15T02:00:15.316Z","dependency_job_id":null,"html_url":"https://github.com/utmhikari/protobuf-grpc-starter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/utmhikari/protobuf-grpc-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utmhikari%2Fprotobuf-grpc-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utmhikari%2Fprotobuf-grpc-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utmhikari%2Fprotobuf-grpc-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utmhikari%2Fprotobuf-grpc-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/utmhikari","download_url":"https://codeload.github.com/utmhikari/protobuf-grpc-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/utmhikari%2Fprotobuf-grpc-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31961078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["backend","gin","golang","grpc","microservice","protobuf","webapp"],"created_at":"2025-02-17T21:18:08.128Z","updated_at":"2026-04-18T07:31:20.871Z","avatar_url":"https://github.com/utmhikari.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# protobuf-grpc-starter\n\na tiny go project to show the feature \u0026 application of protobuf \u0026 grpc\n\n通过一个golang的应用来展示protobuf+grpc相关功能以及应用\n\n# Pre-Requisities\n\n- `golang` v1.16 (latest builtin libraries)\n- `protoc` for protobuf3, to compile protobuf files\n- `protoc-gen-go` for protoc, to generate `pb` files in `golang`\n- `protoc-gen-go-grpc` for protoc, to generate `grpc` files in `golang`\n- `make` for processing `Makefile` script\n\n# Description\n\n## Structure\n\n`Protobuf` is widely used in modern backend services for internal communication via `GRPC`\n\nThis project, inspired by [Pastebin](https://pastebin.com/), implements minimal functions of the application\n\n- user posts a text, `WebSvr` returns the shortLink\n- user can use shortLink as query/param to search a specific text, which may already be cached in `CacheSvr`\n- user can also use keyword/author to search specific texts, but these results won't be cached\n- shortLink query results should be cached in `CacheSvr`, which implements an in-memory LRU cache, at each query\n  - `WebSvr` calls `GetDocument` \u0026 `SetDocument` functions on `CacheSvr` via keep-alive `GRPC` connection\n  - `GetDocument`\n    - `Client` sends a query via http request to `WebSvr`\n    - if query contains a shortLink, query from `CacheSvr` by `GetDocument` rpc call\n      - if `CacheSvr` returns a doc, returns it\n      - otherwise, query `DB` for the result\n        - `DB` stores data in a single file\n        - if exists in `DB`, cache the result to `CacheSvr` by `SetDocument` rpc call\n    - if query does not contain a shortLink, query `DB` for results\n  - `SetDocument`\n    - `Client` posts a document to `WebSvr`\n    - `WebSvr` saves the document to `DB`\n  \n## Run Project\n\n- Run `make` to make protos and `CacheSvr` \u0026 `WebSvr` binaries\n- start `./bin/cachesvr`\n- start `./bin/websvr`\n  - http port of `WebSvr` should be the `externalPort` of `websvr` in `cluster.json`\n  - `WebSvr` uses [gin](https://github.com/gin-gonic/gin) as engine, see `internal/svr/websvr/main/websvr.go` for route definitions\n  - you can use `Postman` to mock http requests to `WebSvr`\n\n## References\n\n- protobuf\n  - [protobuf-github](https://github.com/golang/protobuf)\n  - [protobuf-go-tutorial](https://developers.google.com/protocol-buffers/docs/gotutorial)\n  - [protobuf-language-guide](https://developers.google.com/protocol-buffers/docs/proto3)\n  - [protobuf-examples](https://github.com/protocolbuffers/protobuf/tree/master/examples)\n- grpc\n  - [grpc-go-github](https://github.com/grpc/grpc-go)\n  - [grpc-go](https://grpc.io/docs/languages/go/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futmhikari%2Fprotobuf-grpc-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Futmhikari%2Fprotobuf-grpc-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Futmhikari%2Fprotobuf-grpc-starter/lists"}