{"id":21660123,"url":"https://github.com/prohazko2/deno-grpc","last_synced_at":"2025-12-30T01:21:45.607Z","repository":{"id":39098554,"uuid":"358039549","full_name":"prohazko2/deno-grpc","owner":"prohazko2","description":"Very basic gRPC implementation for Deno ","archived":false,"fork":false,"pushed_at":"2023-09-29T10:45:16.000Z","size":206,"stargazers_count":49,"open_issues_count":8,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-02T22:42:04.227Z","etag":null,"topics":["deno","grpc"],"latest_commit_sha":null,"homepage":"https://deno.land/x/grpc_basic","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prohazko2.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":"2021-04-14T20:53:34.000Z","updated_at":"2025-01-27T09:42:54.000Z","dependencies_parsed_at":"2024-11-25T09:44:30.558Z","dependency_job_id":null,"html_url":"https://github.com/prohazko2/deno-grpc","commit_stats":{"total_commits":107,"total_committers":4,"mean_commits":26.75,"dds":"0.10280373831775702","last_synced_commit":"541a0023dfa342b816380956b1af978325fbaa42"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/prohazko2/deno-grpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prohazko2%2Fdeno-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prohazko2%2Fdeno-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prohazko2%2Fdeno-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prohazko2%2Fdeno-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prohazko2","download_url":"https://codeload.github.com/prohazko2/deno-grpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prohazko2%2Fdeno-grpc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265678452,"owners_count":23810114,"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":["deno","grpc"],"created_at":"2024-11-25T09:32:16.600Z","updated_at":"2025-12-30T01:21:45.540Z","avatar_url":"https://github.com/prohazko2.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# `/x/grpc_basic`\n\n- [latest](https://deno.land/x/grpc_basic)\n\n⚠️ You probably should wait for more mature and standard aligned implementation beacuse:\n 1. This lib doesn't use Deno's 1.9 HTTP/2 native bindings, but relies on JS implementation roughly ported from [node-http2](https://github.com/molnarg/node-http2)\n 2. I'm not an expert in gRPC or HTTP/2, I just moved HTTP/2 frames around until it worked \n 3. It was never meant for production use, only for fun and some integration tests and scripts\n 4. I have no plans on implementing full gRPC spec \n\n### goals - keep it simple\n\n- [x] load proto files\n- [x] `server` unary calls\n- [x] `client` unary calls\n- [x] multiplex calls\n- [x] `server` server streams\n- [x] `client` server streams\n- [ ] auto reconnects (without retries)\n- [ ] deadlines/cancellation with AbortController/AbortSignal\n- [ ] call metadata\n- [ ] logging interface\n\n### non goals - gRPC bloat\n\n- [x] no TLS\n- [x] no client streams\n- [x] no bidirectional streams\n- [x] no client side load balancing\n\n## hello world\n\n### `greeter.proto`\n\n```proto\nsyntax = \"proto3\";\n\npackage helloworld;\n\nservice Greeter {\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\n  rpc ShoutHello (HelloRequest) returns (stream HelloReply) {}\n}\n\nmessage HelloRequest {\n  string name = 1;\n}\n\nmessage HelloReply {\n  string message = 1;\n}\n```\n\n### `greeter.d.ts`\n\nService typings are not essential, but it's nice to have them\n\n```sh\n$ deno run --allow-read https://deno.land/x/grpc_basic@0.4.7/gen/dts.ts ./greeter.proto \u003e ./greeter.d.ts\n```\n\n```ts\nexport interface Greeter {\n  SayHello(request: HelloRequest): Promise\u003cHelloReply\u003e;\n  ShoutHello(request: HelloRequest): AsyncGenerator\u003cHelloReply\u003e;\n}\n\nexport interface HelloRequest {\n  name?: string;\n}\n\nexport interface HelloReply {\n  message?: string;\n}\n```\n\n### `server.ts`\n\n```ts\nimport { GrpcServer } from \"https://deno.land/x/grpc_basic@0.4.7/server.ts\";\nimport { Greeter } from \"./greeter.d.ts\";\n\nconst port = 50051;\nconst server = new GrpcServer();\n\nconst protoPath = new URL(\"./greeter.proto\", import.meta.url);\nconst protoFile = await Deno.readTextFile(protoPath);\n\nserver.addService\u003cGreeter\u003e(protoFile, {\n  \n  async SayHello({ name }) {\n    const message = `hello ${name || \"stranger\"}`;\n    return { message };\n  },\n\n  async *ShoutHello({ name }) {\n    for (const n of [0, 1, 2]) {\n      const message = `hello ${name || \"stranger\"} #${n}`;\n      yield { message };\n    }\n  }\n});\n\nconsole.log(`gonna listen on ${port} port`);\nfor await (const conn of Deno.listen({ port })) {\n  server.handle(conn);\n}\n\n```\n\n### `client.ts`\n\n```ts\nimport { getClient } from \"https://deno.land/x/grpc_basic@0.4.7/client.ts\";\nimport { Greeter } from \"./greeter.d.ts\";\n\nconst protoPath = new URL(\"./greeter.proto\", import.meta.url);\nconst protoFile = await Deno.readTextFile(protoPath);\n\nconst client = getClient\u003cGreeter\u003e({\n  port: 50051,\n  root: protoFile,\n  serviceName: \"Greeter\",\n});\n\n/* unary calls */\nconsole.log(await client.SayHello({ name: \"unary #1\" }));\nconsole.log(await client.SayHello({ name: \"unary #2\" }));\n\n/* server stream */\nfor await (const reply of client.ShoutHello({ name: \"streamed\" })) {\n  console.log(reply);\n}\n\nclient.close();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprohazko2%2Fdeno-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprohazko2%2Fdeno-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprohazko2%2Fdeno-grpc/lists"}