{"id":49256,"library":"rxjs-grpc-minimal","title":"rxjs-grpc-minimal","description":"A lightweight, non-opinionated proxy that wraps @grpc/grpc-js server and client implementations with RxJS Observables. Version 0.2.31 is the current stable release, with low release cadence. Unlike the original rxjs-grpc, this package has no CLI and does not impose build tools, allowing you to use @grpc/proto-loader directly. It supports unary, server-streaming, client-streaming, and bidirectional calls via Observables, and provides built-in cancellation via grpcCancel(). Replaces the deprecated grpc package with @grpc/grpc-js. Requires RxJS 7.x and Node.js >= 20.","status":"active","version":"0.2.31","language":"javascript","source_language":"en","source_url":"https://github.com/brickhouse-tech/rxjs-grpc-minimal","tags":["javascript","rxjs","grpc","protobuf","protobuffers","reactive","proto"],"install":[{"cmd":"npm install rxjs-grpc-minimal","lang":"bash","label":"npm"},{"cmd":"yarn add rxjs-grpc-minimal","lang":"bash","label":"yarn"},{"cmd":"pnpm add rxjs-grpc-minimal","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Runtime peer dependency for gRPC core functionality","package":"@grpc/grpc-js","optional":false},{"reason":"Alternative to grpc-tools for loading .proto files (recommended)","package":"@grpc/proto-loader","optional":true},{"reason":"Peer dependency for Observable patterns (v7.x)","package":"rxjs","optional":false}],"imports":[{"note":"The library is ESM-only since v0.2; it does not provide a CommonJS default export.","wrong":"const toRxClient = require('rxjs-grpc-minimal').toRxClient","symbol":"toRxClient","correct":"import { toRxClient } from 'rxjs-grpc-minimal'"},{"note":"Named export only; default import is undefined.","wrong":"import toRxServer from 'rxjs-grpc-minimal'","symbol":"toRxServer","correct":"import { toRxServer } from 'rxjs-grpc-minimal'"},{"note":"TypeScript users may need this type for method signatures; it is not a runtime value.","wrong":null,"symbol":"RPCMethod","correct":"import type { RPCMethod } from 'rxjs-grpc-minimal'"}],"quickstart":{"code":"import grpc from '@grpc/grpc-js';\nimport protoLoader from '@grpc/proto-loader';\nimport { toRxClient, toRxServer } from 'rxjs-grpc-minimal';\nimport { of, Observable, Subject } from 'rxjs';\n\n// 1. Load proto\nconst packageDefinition = protoLoader.loadSync('./helloworld.proto', {\n  keepCase: false,\n  longs: String,\n  enums: String,\n  defaults: true,\n  oneofs: true\n});\nconst proto = grpc.loadPackageDefinition(packageDefinition).helloworld;\n\n// 2. Create RxJS client (wrapping proto)\nconst RxClient = toRxClient(proto);\n\n// 3. Instantiate client\nconst greeter = new RxClient.Greeter('localhost:50051', grpc.credentials.createInsecure());\n\n// 4. Make unary call\nawait greeter.sayHelloRx({ name: 'World' }).forEach((resp: { message: string }) => {\n  console.log(resp.message); // 'Hello World!'\n});\n\n// 5. Create RxJS server implementation\nconst rxImpl = {\n  sayHello({ value: { name } }: { value: { name: string } }) {\n    return of({ message: `Hello ${name}!` });\n  },\n  sayMultiHello({ value: { name, numGreetings } }: { value: { name: string; numGreetings: number } }) {\n    return new Observable((observer) => {\n      for (let i = 0; i < numGreetings; i++) {\n        observer.next({ message: `Hello ${name} (${i + 1})` });\n      }\n      observer.complete();\n    });\n  }\n};\n\nconst server = new grpc.Server();\nconst rxServer = toRxServer(server, 'helloworld.Greeter', rxImpl);\n\nserver.bindAsync('0.0.0.0:50051', grpc.ServerCredentials.createInsecure(), () => {\n  server.start();\n});","lang":"typescript","description":"Demonstrates loading a proto file, creating an RxJS client for unary calls, and setting up an RxJS server with async implementations."},"warnings":[{"fix":"Use ES module import syntax ('import { toRxClient } from 'rxjs-grpc-minimal'') and ensure your project is configured for ESM (e.g., 'type': 'module' in package.json).","message":"The library is ESM-only since v0.2. CommonJS require() or dynamic imports may fail.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Replace 'grpc' dependency with '@grpc/grpc-js' and use its loadPackageDefinition API.","message":"The original 'grpc' npm package is deprecated. This library only supports @grpc/grpc-js.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Always use Rx.Subject or another Observable from RxJS for client stream calls.","message":"Client streaming requires passing a Subject/Observable to the Rx method. If you pass a plain stream, it will be treated as a unary message.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always append 'Rx' to the protobuf method name when calling on the client. For server implementations, do NOT use the 'Rx' suffix.","message":"Method names in the proto are automatically suffixed with 'Rx' (e.g., 'sayHello' becomes 'sayHelloRx'). If you omit the suffix, the method is undefined.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Install '@grpc/proto-loader' and use protoLoader.loadSync() to load .proto files directly.","message":"Using 'grpc-tools' to generate JavaScript code is not recommended. Use '@grpc/proto-loader' instead.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Upgrade to Node.js >=20.","message":"Node.js <20 is not supported. The library uses modern ESM features and APIs unavailable in older versions.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Call stream$.grpcCancel() before unsubscribing, or use takeUntil() with a cancellation subject to properly clean up.","message":"Cancellation via grpcCancel() is a custom property attached to the Observable, not part of the RxJS contract. Use it carefully with operators that may unsubscribe the upstream Observable.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.2.31':22 '20':90 '7':86 'allow':49 'bidirect':65 'build':47 'built':72 'built-in':71 'cadenc':31 'call':66 'cancel':74 'cli':42 'client':16,62 'client-stream':61 'current':25 'deprec':79 'direct':54 'grpc':3,37,80,93 'grpc/grpc-js':13,83 'grpc/proto-loader':53 'grpccancel':76 'implement':17 'impos':46 'javascript':91 'lightweight':6 'low':29 'minim':4 'node.js':89 'non':8 'non-opinion':7 'observ':20,68 'opinion':9 'origin':34 'packag':39,81 'proto':97 'protobuf':94 'protobuff':95 'provid':70 'proxi':10 'reactiv':96 'releas':27,30 'replac':77 'requir':84 'rxjs':2,19,36,85,92 'rxjs-grpc':35 'rxjs-grpc-minim':1 'server':14,59 'server-stream':58 'stabl':26 'stream':60,63 'support':56 'tool':48 'unari':57 'unlik':32 'use':52 'version':21 'via':67,75 'wrap':12 'x':87","created_at":"2026-06-07T17:00:51.041916+00:00","updated_at":"2026-06-07T17:00:51.041916+00:00","problems":[{"fix":"Change to greeter.sayHelloRx({ name: 'World' }).forEach(...).","cause":"Forgot to append 'Rx' suffix to the method name when calling on the client.","error":"TypeError: greeter.sayHello is not a function"},{"fix":"Use import syntax: import { toRxClient } from 'rxjs-grpc-minimal'. Set 'type': 'module' in package.json or use .mjs extension.","cause":"The library is ESM-only and cannot be required via CommonJS.","error":"ERR_REQUIRE_ESM: require() of ES Module /node_modules/rxjs-grpc-minimal/index.js not supported"},{"fix":"Ensure you call toRxClient(grpcAPI.helloworld) where 'helloworld' is your proto package name, and that the proto is loaded correctly via '@grpc/proto-loader'.","cause":"Proto file not properly loaded or wrapped: the grpcAPI object lacks the service namespace.","error":"Cannot read properties of undefined (reading 'Greeter')"},{"fix":"npm uninstall grpc && npm install @grpc/grpc-js","cause":"Installed deprecated 'grpc' package instead of '@grpc/grpc-js'.","error":"Warning: The 'grpc' package is deprecated. Please use '@grpc/grpc-js' instead."},{"fix":"Use new Subject() as the argument to the Rx method: const writer = new Subject(); greeter.streamSayHelloRx(writer).","cause":"Incorrect usage when passing a plain function instead of RxJS Subject for client streaming.","error":"TypeError: observer is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/brickhouse-tech/rxjs-grpc-minimal#readme","github":"https://github.com/brickhouse-tech/rxjs-grpc-minimal","docs":null,"changelog":null,"pypi":null,"npm":"rxjs-grpc-minimal","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}