Registry / testing / qp-rxjs-grpc

qp-rxjs-grpc

JSON →
library0.2.12jsnpmunverified

Type-safe gRPC client and server library for TypeScript using RxJS Observables. Current stable version is 0.2.12. Release cadence is low. Key differentiator: generates TypeScript namespaces from .proto files and provides strongly-typed server builder and client factory, enabling reactive stream-based communication instead of raw callbacks. Compared to alternatives like @grpc/grpc-js, this library adds Observable interfaces for all RPC methods.

npm install qp-rxjs-grpc
INSTALL
IMPORT
SIG · QP-RXJS-GRPC
Q
qp-rxjs-grpc
testingjavascriptv0.2.12
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

serverBuilder
import { serverBuilder } from 'qp-rxjs-grpc'
import serverBuilder from 'qp-rxjs-grpc'
Named export, not default. ESM only.
clientFactory
import { clientFactory } from 'qp-rxjs-grpc'
const clientFactory = require('qp-rxjs-grpc').clientFactory
Named export. CommonJS require also works but ESM is recommended.
customNamespace
import { sample } from './grpc-namespaces'
import * as sample from './grpc-namespaces'
Generated namespace file exports individual namespaces as named exports; star import will also work but named import is idiomatic.

Demonstrates setting up a typesafe gRPC server and client using Observables.

// server.ts import { of } from 'rxjs'; import { serverBuilder } from 'qp-rxjs-grpc'; import { sample } from './grpc-namespaces'; const server = serverBuilder<sample.ServerBuilder>('sample.proto', 'sample'); server.addGreeter({ sayHello(request: sample.HelloRequest) { return of({ message: 'Hello ' + request.name }); } }); server.start('0.0.0.0:50051'); // client.ts import { clientFactory } from 'qp-rxjs-grpc'; import { sample } from './grpc-namespaces'; const Services = clientFactory<sample.ClientFactory>('sample.proto', 'sample'); const services = new Services('localhost:50051'); const greeter = services.getGreeter(); greeter.sayHello({ name: 'world' }).forEach(response => { console.log(`Greeting: ${response.message}`); });
Debug
Known issues
gotchaGenerated namespace files must be regenerated whenever .proto files change; manual import update may miss changes.
fix
Run generator as part of build step (e.g., npm run generate).
affects: all
gotchaRequires both `rxjs` and `grpc` as peer dependencies; missing them leads to runtime errors.
fix
Install both with npm: npm install rxjs grpc
affects: >=0.1.0
breakingVersion 0.2.x changed the generator command from `rxjs-grpc` to `rxjs-grpc`; old commands may not work.
fix
Use `./node_modules/.bin/rxjs-grpc` with `-o` flag.
affects: <0.2.0
deprecatedThe npm package `grpc` is deprecated in favor of `@grpc/grpc-js`; this library still uses `grpc`.
fix
Consider switching to a more modern gRPC library or fork this one.
affects: all
gotchaTypeScript type-checking relies on correct generic parameters (e.g., `ServerBuilder`, `ClientFactory`) from generated namespace; wrong type leads to silent errors at compile time.
fix
Always import the generated namespace type and use it precisely.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
Missing peer dependency `grpc`.
fix
npm install grpc
TypeError: serverBuilder is not a function
Default import instead of named import.
fix
import { serverBuilder } from 'qp-rxjs-grpc'
Error: Cannot find module './grpc-namespaces'
Generated types file not created or path incorrect.
fix
Run generator: ./node_modules/.bin/rxjs-grpc -o grpc-namespaces.ts *.proto
rxjs_1.of is not a function
Incorrect import of of from rxjs.
fix
import { of } from 'rxjs'
Upgrade
Version history
0.2.12latest on npm
Audit
Dependencies
rxjsrequiredPeer dependency for Observable streams
grpcrequiredPeer dependency: gRPC runtime
Agent activity
6 hits · last 30 days
node
6
Resources
qp-rxjs-grpc — npm install qp-rxjs-grpc · libregistry