{"id":27525663,"url":"https://github.com/nexcode/rpcplatform","last_synced_at":"2026-04-13T20:32:52.583Z","repository":{"id":57644848,"uuid":"444540994","full_name":"nexcode/rpcplatform","owner":"nexcode","description":"Microservers are easy!","archived":false,"fork":false,"pushed_at":"2026-03-30T22:09:59.000Z","size":219,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-30T23:42:38.701Z","etag":null,"topics":["etcd","go","grpc","microservices","opentelemetry"],"latest_commit_sha":null,"homepage":"","language":"Go","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/nexcode.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-04T19:34:39.000Z","updated_at":"2026-03-30T21:39:29.000Z","dependencies_parsed_at":"2024-04-16T20:27:16.805Z","dependency_job_id":"0047f977-240c-4dcd-8d83-45ba4abb1cdd","html_url":"https://github.com/nexcode/rpcplatform","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/nexcode/rpcplatform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexcode%2Frpcplatform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexcode%2Frpcplatform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexcode%2Frpcplatform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexcode%2Frpcplatform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nexcode","download_url":"https://codeload.github.com/nexcode/rpcplatform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nexcode%2Frpcplatform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31770720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T20:17:16.280Z","status":"ssl_error","status_checked_at":"2026-04-13T20:17:08.216Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["etcd","go","grpc","microservices","opentelemetry"],"created_at":"2025-04-18T14:28:10.422Z","updated_at":"2026-04-13T20:32:52.570Z","avatar_url":"https://github.com/nexcode.png","language":"Go","readme":"# RPCPlatform\n\n[![Build](https://github.com/nexcode/rpcplatform/actions/workflows/build.yml/badge.svg)](https://github.com/nexcode/rpcplatform/actions/workflows/build.yml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/nexcode/rpcplatform)](https://pkg.go.dev/github.com/nexcode/rpcplatform)\n[![GoReportCard](https://goreportcard.com/badge/github.com/nexcode/rpcplatform)](https://goreportcard.com/report/github.com/nexcode/rpcplatform)\n[![CodeCov](https://codecov.io/gh/nexcode/rpcplatform/graph/badge.svg)](https://codecov.io/gh/nexcode/rpcplatform)\n[![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go)\n\nAn **easy-to-use** platform for building microservices without complex infrastructure dependencies.\nOnly [etcd](https://etcd.io) is required. Out of the box, you get service discovery, distributed tracing, and other useful features.\n[gRPC](https://grpc.io) is used for communication between services.\n\n## etcd is required\n\nIf you don't have etcd in your infrastructure, you can run it via\n[Docker](https://etcd.io/docs/v3.6/op-guide/container/) for testing:\n\n```shell\ndocker run -d --name etcd \\\n\t-p 2379:2379 -p 2380:2380 \\\n\t-e ETCD_NAME=etcd -e ETCD_INITIAL_CLUSTER=etcd=http://127.0.0.1:2380 \\\n\t-e ETCD_INITIAL_ADVERTISE_PEER_URLS=http://127.0.0.1:2380 -e ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 \\\n\t-e ETCD_ADVERTISE_CLIENT_URLS=http://127.0.0.1:2379 -e ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 \\\n\tgcr.io/etcd-development/etcd:v3.6.5\n```\n\nOf course, you can use Docker in production or install etcd using your favorite package manager.\nJust remember that the example above is for testing purposes!\n\n## How does it work?\n\nAll you need to do is assign a name to your server. When it starts, it automatically selects an available port and listens on it (unless you specify otherwise).\nAll clients will connect to this server by its name. If there are multiple server instances with the same name, the load is automatically distributed among them.\n\n\u003e The following code examples use a pre-built [proto](examples/quickstart/proto).\n\nFirst, let's create a new `rpcplatform` instance and a new server named `myServerName`, register the implementation of our `Sum` service, and run it on localhost:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\n\t\"github.com/nexcode/rpcplatform\"\n\t\"github.com/nexcode/rpcplatform/examples/quickstart/proto\"\n\tetcd \"go.etcd.io/etcd/client/v3\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/credentials/insecure\"\n)\n\ntype sumServer struct {\n\tproto.UnimplementedSumServer\n}\n\nfunc (s *sumServer) Sum(_ context.Context, request *proto.SumRequest) (*proto.SumResponse, error) {\n\treturn proto.SumResponse_builder{\n\t\tSum: new(request.GetA() + request.GetB()),\n\t}.Build(), nil\n}\n\nfunc main() {\n\tetcdClient, err := etcd.New(etcd.Config{\n\t\tEndpoints: []string{\"localhost:2379\"},\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trpcp, err := rpcplatform.New(\"rpcplatform\", etcdClient,\n\t\trpcplatform.PlatformOptions.ClientOptions(\n\t\t\trpcplatform.ClientOptions.GRPCOptions(grpc.WithTransportCredentials(insecure.NewCredentials())),\n\t\t),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tserver, err := rpcp.NewServer(\"myServerName\", \"localhost:\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tproto.RegisterSumServer(server.Server(), \u0026sumServer{})\n\n\tif err = server.Serve(context.Background()); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\nFor the client, we also create a new `rpcplatform` instance and a new client named `myServerName`:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"math/rand\"\n\t\"time\"\n\n\t\"github.com/nexcode/rpcplatform\"\n\t\"github.com/nexcode/rpcplatform/examples/quickstart/proto\"\n\tetcd \"go.etcd.io/etcd/client/v3\"\n\t\"google.golang.org/grpc\"\n\t\"google.golang.org/grpc/credentials/insecure\"\n)\n\nfunc main() {\n\tetcdClient, err := etcd.New(etcd.Config{\n\t\tEndpoints: []string{\"localhost:2379\"},\n\t})\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trpcp, err := rpcplatform.New(\"rpcplatform\", etcdClient,\n\t\trpcplatform.PlatformOptions.ClientOptions(\n\t\t\trpcplatform.ClientOptions.GRPCOptions(grpc.WithTransportCredentials(insecure.NewCredentials())),\n\t\t),\n\t)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tclient, err := rpcp.NewClient(context.Background(), \"myServerName\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tsumClient := proto.NewSumClient(client.Client())\n\n\tfor {\n\t\ttime.Sleep(time.Second)\n\n\t\tsumRequest := proto.SumRequest_builder{\n\t\t\tA: new(int64(rand.Intn(10))),\n\t\t\tB: new(int64(rand.Intn(10))),\n\t\t}.Build()\n\n\t\tsumResponse, err := sumClient.Sum(context.Background(), sumRequest)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Println(sumRequest.GetA(), \"+\", sumRequest.GetB(), \"=\", sumResponse.GetSum())\n\t}\n}\n```\n\nThat's all you need: add or remove server instances dynamically and create clients at any time — `rpcplatform` automatically handles service discovery and load balancing.\n\n### OpenTelemetry\n\nTo visualize our **service graph** and get **telemetry for all gRPC methods**, we need to run containers with telemetry services and enable telemetry in `rpcplatform`.\n\nLet's run containers with Zipkin and Jaeger:\n\n```shell\ndocker run -d --name zipkin -p 9411:9411 openzipkin/zipkin\ndocker run -d --name jaeger -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one\n```\n\nNow let's create the necessary collectors and add the `OpenTelemetry` option to the `rpcplatform` instance:\n\n```go\notlpExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithEndpoint(\"localhost:4317\"), otlptracegrpc.WithInsecure())\nif err != nil {\n\tpanic(err)\n}\n\nzipkinExporter, err := zipkin.New(\"http://localhost:9411/api/v2/spans\")\nif err != nil {\n\tpanic(err)\n}\n\nrpcp, err := rpcplatform.New(\"rpcplatform\", etcdClient,\n\trpcplatform.PlatformOptions.OpenTelemetry(\"myServiceName\", 1, otlpExporter, zipkinExporter),\n\t// other options...\n)\n\nif err != nil {\n\tpanic(err)\n}\n```\n\nThe tracing dashboards are available at:\n\n| Zipkin (`http://localhost:9411`)             | Jaeger (`http://localhost:16686`)            |\n| :------------------------------------------: | :------------------------------------------: |\n| ![Zipkin](examples/opentelemetry/zipkin.png) | ![Jaeger](examples/opentelemetry/jaeger.png) |\n\n## Usage examples\n\n- [QuickStart](examples/quickstart): contains the simplest example without additional features\n- [OpenTelemetry](examples/opentelemetry): example integrating distributed tracing systems\n- [Attributes](examples/attributes): example using additional settings for client and server\n","funding_links":[],"categories":["Distributed Systems"],"sub_categories":["Search and Analytic Databases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexcode%2Frpcplatform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnexcode%2Frpcplatform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnexcode%2Frpcplatform/lists"}