{"id":21902057,"url":"https://github.com/ghasemloo/libraryservice","last_synced_at":"2026-04-20T09:31:29.794Z","repository":{"id":57526852,"uuid":"91416378","full_name":"ghasemloo/libraryservice","owner":"ghasemloo","description":"A simple LibraryService to demonstrate how to use Bazel+Go+gRPC","archived":false,"fork":false,"pushed_at":"2023-08-13T01:40:48.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-22T06:19:24.878Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ghasemloo.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":"2017-05-16T05:10:03.000Z","updated_at":"2023-08-11T04:51:41.000Z","dependencies_parsed_at":"2024-06-20T11:02:20.464Z","dependency_job_id":"725a3df6-754b-4c4f-9b9f-1664fe32cf80","html_url":"https://github.com/ghasemloo/libraryservice","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ghasemloo/libraryservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghasemloo%2Flibraryservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghasemloo%2Flibraryservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghasemloo%2Flibraryservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghasemloo%2Flibraryservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghasemloo","download_url":"https://codeload.github.com/ghasemloo/libraryservice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghasemloo%2Flibraryservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32041207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"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":[],"created_at":"2024-11-28T15:16:17.613Z","updated_at":"2026-04-20T09:31:29.769Z","avatar_url":"https://github.com/ghasemloo.png","language":"Starlark","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple LibraryService to demonstrate how to use Bazel+Go+gRPC\n\nA simple library service (server and client).\n\n* Service defined in [Protocol Buffer v3](https://developers.google.com/protocol-buffers/docs/proto3)\n(proto3).\n* Programming language [The Go Programming Langauge](https://golang.org/) (golang).\n* RPC framework [gRPC](https://www.grpc.io/).\n* Build tool [Bazel](https://bazel.build).\n\n## Pre-work\n\nThe following instructions are tested on Ubuntu 16.04 (LTS).\n\n1.  Install Bazel\n\n    [Bazel](https://bazel.build) is our build tool. It is written in [Java](https://www.java.com/). Install Java and then Bazel.\n\n    ```shell\n    $ sudo apt-get install bazel\n    ```\n\n    [Complete instructions for intalling Bazel on Ubuntu](https://bazel.build/versions/master/docs/install-ubuntu.html).\n\n1. Install Git\n\n    [Git](https://git-scm.com) is our version control system. It is used by Bazel to download some of our external dependencies (like [Protocol Buffers](https://github.com/google/protobuf), [gRPC](https://github.com/grpc/grpc-go), and Bazel's [Go rules](https://github.com/bazelbuild/rules_go).\n\n    ```shell\n    $ sudo apt-get install git\n    ```\n\n1. (Optional) Install Go\n\n    [Go](https://golang.org) is a programming language and is very good at writting large-scale distributed systems. Our service and client are written in Go.\n\n    ```shell\n    $ sudo apt-get install golang-go\n    ```\n\n    [Compelte instructions for installing Go on Ubuntu](https://github.com/golang/go/wiki/Ubuntu)\n\n1. (Optional) Install Gazelle\n\n    [Gazelle](https://github.com/bazelbuild/bazel-gazelle) is a helper tool that automatically generates Bazel BUILD files for Go and makes your life easier.\n\n    ```shell\n    $ go install github.com/bazelbuild/bazel-gazelle/cmd/gazelle@latest\n    ```\n\n1. (Optional) Install Buildifier\n\n    [Bazel Buildtools](https://github.com/bazelbuild/buildtools) are helpers tools for Bazel. [Buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md) cleans up and formats Bazel build files.\n\n    ```shell\n    $ go install github.com/bazelbuild/buildtools/buildifier@latest\n    ```\n\n## Clone\n\n```shell\n$ git clone git@github.com:ghasemloo/libraryservice.git\n$ cd libraryservice\n```\n\n## Bazel\n\n### Build and Test\n\n```shell\n$ bazel build ...\n$ bazel test ...\n```\n\n### Run the server and the client\n\nIn one terminal run the server:\n```shell\n$ bazel run server/server -- --logtostderr\n```\nIn another terminal run the client to send requests to the server:\n```shell\n$ bazel run client/client -- --logtostderr\n```\n\n## Go (without Bazel)\n\n### Go Module\n\n```shell\n$ go mod init github.com/ghasemloo/libraryservice\n$ go mod tidy\n```\n\n### Proto Compiler for Go\n\nInstall Protobuf Compiler to generate Go packages for proto files:\n\n```shell\n$ sudo apt-get install protobuf-compiler\n$ go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28\n$ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2\n```\n\n### Generated Go Proto Packages\n\n```shell\n$ protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ./proto/api/api.proto\n$ protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative ./proto/storage/storage.proto\n```\n\n### Build and Test\n\n```shell\n$ go build ./...\n$ go test ./...\n```\n\n### Run the server and the client\n\nIn two different terminals run:\n\n```shell\n$ go run ./server/main.go\n```\n\n```shell\n$ go run ./client/main.go\n```\n\n## Gazelle\n\nUpdating `WORKSPACE.bazel` from `go.mod`:\n\n```shell\n$ gazelle update-repos --proto_import_prefix=\"github.com/ghasemloo/libraryservice\" --from_file=./go.mod --prune\n```\n\nCreating/updating `BUILD.bazel` files:\n\n```shell\n$ gazelle fix -go_prefix github.com/ghasemloo/libraryservice\n```\n\nYou can also use Bazel (`gazelle` commands and paramters are configured in the `BUILD.bazel`):\n\n```shell\n$ bazel run //:gazelle-update-repos\n$ bazel run //:gazelle\n```\n\n## References\n\n* Bazel: http://bazel.build\n* Go: https://golang.org\n* Google API Style Guide: https://cloud.google.com/apis/design/\n* Proto3: https://developers.google.com/protocol-buffers/\n* gRPC: https://www.grpc.io/\n* gRPC Example: https://grpc.io/docs/languages/go/quickstart/\n* Google RPC [Status](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto) and \n[Canonical Error Codes](https://github.com/googleapis/googleapis/blob/master/google/rpc/codes.proto)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghasemloo%2Flibraryservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghasemloo%2Flibraryservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghasemloo%2Flibraryservice/lists"}