Registry / devops / nx-grpc-ts

nx-grpc-ts

JSON →
library0.1.196jsnpmunverified

nx-grpc-ts (npm package @lazurdit/nx-grpc) is a TypeScript library that generates gRPC client and server code from Protocol Buffer definitions for use with Nx workspaces. Current stable version is 0.1.196, updated frequently. It aims to simplify integrating gRPC into Nx monorepos by providing code generation and runtime helper utilities. In early development, with potential breaking changes. Not production-ready.

npm install nx-grpc-ts
INSTALL
IMPORT
SIG · NX-GRPC-TS
N
nx-grpc-ts
devopsjavascriptv0.1.196
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.

NxGrpcClient
import { NxGrpcClient } from '@lazurdit/nx-grpc'
import { NxGrpcClient } from 'nx-grpc-ts'
Package is published as @lazurdit/nx-grpc, not nx-grpc-ts.
NxGrpcServer
import { NxGrpcServer } from '@lazurdit/nx-grpc'
const NxGrpcServer = require('@lazurdit/nx-grpc').NxGrpcServer
ESM-only package; require() will fail unless using Node with ESM.
loadProto
import { loadProto } from '@lazurdit/nx-grpc'
This is the main loader function for .proto files.

Demonstrates loading a .proto file, starting a gRPC server, and making a client call.

import { NxGrpcServer, NxGrpcClient, loadProto } from '@lazurdit/nx-grpc'; // Load a proto file const protoDef = loadProto('path/to/service.proto'); // Create server const server = new NxGrpcServer({ proto: protoDef, address: '0.0.0.0:50051' }); server.start(); // Create client const client = new NxGrpcClient({ proto: protoDef, address: 'localhost:50051' }); const response = await client.call('MyMethod', { requestField: 'value' }); console.log(response); // Graceful shutdown process.on('SIGINT', () => { server.stop(); client.close(); });
Debug
Known issues
breakingPackage is in early development (v0.x). API and behavior may change without major version bump.
fix
Pin exact version in package.json and test upgrades carefully.
affects: >=0.0.0
gotchaThe npm package name is @lazurdit/nx-grpc, not nx-grpc-ts.
fix
Install using 'npm install @lazurdit/nx-grpc'.
affects: *
gotchaESM-only package. CommonJS require() will not work in Node < 16 or without "type": "module".
fix
Use ES import syntax or set type to module in package.json.
affects: *
gotchaDependencies @grpc/grpc-js and protobufjs must be installed explicitly.
fix
Run 'npm install @grpc/grpc-js protobufjs'.
affects: *
Errors
Common errors & fixes
Cannot find module '@lazurdit/nx-grpc'
Incorrect package name in import or missing installation.
fix
Install correct package: npm install @lazurdit/nx-grpc
TypeError: NxGrpcServer is not a constructor
Using CommonJS require() on ESM-only package.
fix
Use ES import: import { NxGrpcServer } from '@lazurdit/nx-grpc'
Error: Cannot find module '@grpc/grpc-js'
Missing peer dependency.
fix
npm install @grpc/grpc-js
Upgrade
Version history
0.1.196latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredRequired gRPC client/server runtime
protobufjsrequiredProtocol Buffer message encoding/decoding
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
nx-grpc-ts — npm install nx-grpc-ts · libregistry