{"id":21808590,"url":"https://github.com/kondi/rxjs-grpc","last_synced_at":"2025-04-05T22:09:43.981Z","repository":{"id":18227579,"uuid":"83833223","full_name":"kondi/rxjs-grpc","owner":"kondi","description":"Typesafe gRPC with RxJS in TypeScript","archived":false,"fork":false,"pushed_at":"2022-12-08T15:43:15.000Z","size":476,"stargazers_count":202,"open_issues_count":28,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-14T19:20:44.640Z","etag":null,"topics":["grpc","rxjs","typescript"],"latest_commit_sha":null,"homepage":null,"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/kondi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-03-03T19:22:33.000Z","updated_at":"2023-09-05T21:36:57.000Z","dependencies_parsed_at":"2023-01-14T07:45:15.841Z","dependency_job_id":null,"html_url":"https://github.com/kondi/rxjs-grpc","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kondi%2Frxjs-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kondi%2Frxjs-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kondi%2Frxjs-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kondi%2Frxjs-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kondi","download_url":"https://codeload.github.com/kondi/rxjs-grpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406111,"owners_count":20933806,"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","rxjs","typescript"],"created_at":"2024-11-27T13:15:38.113Z","updated_at":"2025-04-05T22:09:43.959Z","avatar_url":"https://github.com/kondi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/kondi/rxjs-grpc.svg?branch=master)](https://travis-ci.org/kondi/rxjs-grpc)\n[![npm version](https://badge.fury.io/js/rxjs-grpc.svg)](https://badge.fury.io/js/rxjs-grpc)\n\n# rxjs-grpc\n\n## Installation\n\n```sh\n$ npm install rxjs-grpc rxjs grpc\n```\n\n## Quickstart\n\nCreate your protobuf definition file `sample.proto`:\n\n```protobuf\nsyntax = \"proto3\";\n\npackage sample;\n\nservice Greeter {\n  rpc SayHello (HelloRequest) returns (HelloReply) {}\n}\n\nmessage HelloRequest {\n  string name = 1;\n}\n\nmessage HelloReply {\n  string message = 1;\n}\n```\n\nGenerate your TypeScript interfaces:\n\n```sh\n$ ./node_modules/.bin/rxjs-grpc -o grpc-namespaces.ts *.proto\n```\n\nImplement your typesafe server returning `Observable\u003csample.HelloReply\u003e`:\n\n```typescript\nimport { of } from 'rxjs';\nimport { serverBuilder } from 'rxjs-grpc';\nimport { sample } from './grpc-namespaces';\n\n// Pass the path of proto file and the name of namespace\nconst server = serverBuilder\u003csample.ServerBuilder\u003e('sample.proto', 'sample')\n// Add implementation\nserver.addGreeter({\n  sayHello(request: sample.HelloRequest) {\n    return of({\n      message: 'Hello ' + request.name\n    });\n  }\n})\n// Start the server to listen on port 50051\nserver.start('0.0.0.0:50051');\n```\n\nCall it from a client:\n\n```typescript\nimport { clientFactory } from 'rxjs-grpc';\nimport { sample } from './grpc-namespaces';\n\n// Pass the path of proto file and the name of namespace\nconst Services = clientFactory\u003csample.ClientFactory\u003e('sample.proto', 'sample');\n// Create a client connecting to the server\nconst services = new Services('localhost:50051');\n// Get a client for the Greeter service\nconst greeter = services.getGreeter();\n\n// Call the service by passing a sample.HelloRequest\ngreeter.sayHello({ name: 'world' }).forEach(response =\u003e {\n  console.log(`Greeting: ${response.message}`);\n});\n```\n\n## Generated interfaces\n\n```typescript\nimport { Observable } from 'rxjs';\n\nexport namespace sample {\n\n  export interface ClientFactory {\n    getGreeter(): sample.Greeter;\n  }\n\n  export interface ServerBuilder {\n    addGreeter(impl: sample.Greeter): sample.ServerBuilder;\n  }\n\n  export interface Greeter {\n    sayHello(request: sample.HelloRequest): Observable\u003csample.HelloReply\u003e;\n  }\n\n  export interface HelloRequest {\n    name?: string;\n  }\n\n  export interface HelloReply {\n    message?: string;\n  }\n\n}\n```\n\n## Examples\n\nYou can see a simple example project in the [examples folder](examples).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkondi%2Frxjs-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkondi%2Frxjs-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkondi%2Frxjs-grpc/lists"}