{"id":28470675,"url":"https://github.com/xiaodongw/grpc-kt","last_synced_at":"2026-04-24T12:33:10.900Z","repository":{"id":57724156,"uuid":"154079724","full_name":"xiaodongw/grpc-kt","owner":"xiaodongw","description":"gRPC with Kotlin Coroutine","archived":false,"fork":false,"pushed_at":"2020-03-12T04:34:55.000Z","size":196,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-07T10:05:56.989Z","etag":null,"topics":["grpc","kotlin-coroutine"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/xiaodongw.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-10-22T02:57:38.000Z","updated_at":"2019-12-27T11:49:11.000Z","dependencies_parsed_at":"2022-09-02T06:44:42.507Z","dependency_job_id":null,"html_url":"https://github.com/xiaodongw/grpc-kt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xiaodongw/grpc-kt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaodongw%2Fgrpc-kt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaodongw%2Fgrpc-kt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaodongw%2Fgrpc-kt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaodongw%2Fgrpc-kt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiaodongw","download_url":"https://codeload.github.com/xiaodongw/grpc-kt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiaodongw%2Fgrpc-kt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263033158,"owners_count":23403106,"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":["grpc","kotlin-coroutine"],"created_at":"2025-06-07T10:05:33.873Z","updated_at":"2026-04-24T12:33:05.876Z","avatar_url":"https://github.com/xiaodongw.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GRPC-Kotlin\n[![Travis](https://travis-ci.org/xiaodongw/grpc-kt.svg?branch=master)](https://travis-ci.org/xiaodongw/grpc-kt)\n\nThis is a GRPC stub \u0026 compiler for Kotlin Coroutine. \nBy using Kotlin Coroutine, your code is totally asynchronous and non-blocking, \nbut still being written in a synchronous way make it easier to read and maintain.\n\nThe generated service base and client stub share the same service interface, so they can be easily swapped for dependency injection and test mocking.\n\nCheck [GRPC-RX](https://github.com/xiaodongw/grpc-rx) for RxJava2 binding.\n\n## Getting started\n\n* In your project, configure Gradle to use the grpc-kt stub and compiler plugin.\n```groovy\ndependencies {\n  compile \"com.github.xiaodongw:grpc-kt-stub:0.3.0\"\n}\n\nprotobuf {\n  protoc {\n    artifact = \"com.google.protobuf:protoc:3.5.1\"\n  }\n  plugins {\n    grpc {\n      artifact = 'com.github.xiaodongw:protoc-gen-grpc-kt:0.3.0'\n    }\n  }\n  generateProtoTasks {\n    all()*.plugins {\n      grpc {}\n    }\n  }\n}\n```\n\n* Server side (See [EchoServiceImpl.kt](grpc-kt-stub/src/test/kotlin/io/grpc/kt/EchoServiceImpl.kt) for full example.)\n```kotlin\nclass EchoServiceImpl : EchoGrpcKt.EchoImplBase() {\n  override suspend fun unary(req: EchoProto.EchoReq): EchoProto.EchoResp {\n    return EchoProto.EchoResp.newBuilder()\n      .setId(req.id)\n      .setValue(req.value)\n      .build()\n  }\n\n  ...\n\n  override suspend fun bidiStreaming(req: ReceiveChannel\u003cEchoProto.EchoReq\u003e): ReceiveChannel\u003cEchoProto.EchoResp\u003e {\n    return GlobalScope.produce {\n      for (reqMsg in req) {\n        val respMsg = EchoProto.EchoResp.newBuilder()\n          .setId(reqMsg.id)\n          .setValue(reqMsg.value)\n          .build()\n        send(respMsg)\n      }\n    }\n  }\n}\n```\n\n* Client side\n```kotlin\nval stub = EchoGrpcKt.newStub(channel)\n\n// unary\nrunBlocking {\n  val req = EchoProto.EchoReq.newBuilder()\n    .setId(1)\n    .setValue(\"Hello\")\n    .build()\n  val resp = stub.unary(req)\n}\n\n// bidirectional streaming\nrunBlocking {\n  val req: ReceivingChannel\u003cEchoProto.EchoReq\u003e = ...\n  val resp = stub.bidiStreaming(req)\n  for(msg in resp) {\n    // do something with the msg\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaodongw%2Fgrpc-kt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiaodongw%2Fgrpc-kt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiaodongw%2Fgrpc-kt/lists"}