Registry / devops / grpc-kit

grpc-kit

JSON →
library0.2.0jsnpmunverified

grpc-kit is a Node.js library (v0.2.0, no recent updates) that simplifies working with gRPC by providing a higher-level API for creating servers and clients from .proto files. It wraps the official `grpc` and `@grpc/proto-loader` packages, offering a declarative route definition style with support for unary, client, server, and bidirectional streaming. Notable features include async route handlers and built-in proto loader options. The library is minimal but currently unmaintained; users should consider modern alternatives like `@grpc/grpc-js` with manual proto loading for active support.

npm install grpc-kit
INSTALL
IMPORT
SIG · GRPC-KIT
G
grpc-kit
devopsjavascriptv0.2.0
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.

createServer
const { createServer } = require('grpc-kit')
import { createServer } from 'grpc-kit'; // Not valid ESM; library is CommonJS only.
CommonJS require is required; ESM import will fail.
createClient
const { createClient } = require('grpc-kit')
import { createClient } from 'grpc-kit'; // Not valid ESM; library is CommonJS only.
CommonJS require is required; ESM import will fail.
default import
const grpcKit = require('grpc-kit')
import grpcKit from 'grpc-kit'; // Not valid ESM; library is CommonJS only.
No default export; use destructuring or require.

Creates a gRPC server and client for a simple greeter service using grpc-kit.

const { createServer, createClient } = require('grpc-kit'); // Server const server = createServer(); server.use({ protoPath: '/path/to/greeter.proto', packageName: 'greeter', serviceName: 'Greeter', routes: { hello: (call, callback) => { callback(null, { message: `Hello, ${call.request.name}` }); }, goodbye: async (call) => { return { message: `Goodbye, ${call.request.name}` }; } }, options: { keepCase: true, longs: String, enums: String, defaults: true, oneofs: true } }); server.listen('0.0.0.0:50051'); // Client const client = createClient({ protoPath: '/path/to/greeter.proto', packageName: 'greeter', serviceName: 'Greeter', options: { keepCase: true, longs: String, enums: String, defaults: true, oneofs: true } }, '0.0.0.0:50051'); client.hello({ name: 'Alice' }, (err, response) => { if (err) throw err; console.log(response.message); });
Debug
Known issues
deprecatedgrpc-kit is no longer maintained. The underlying `grpc` package is deprecated in favor of `@grpc/grpc-js`. Use at your own risk.
fix
Migrate to `@grpc/grpc-js` directly and handle proto loading manually or use a maintained wrapper like `grpc-reflection`.
affects: >=0.1.0
breakingThe `grpc` package (peer dep) is deprecated and native bindings may fail on newer Node.js versions. `@grpc/grpc-js` is the pure JavaScript successor.
fix
Replace `grpc` with `@grpc/grpc-js` in your project, but note that grpc-kit does not support `@grpc/grpc-js` directly.
affects: >=0.2.0
gotchaLibrary is CommonJS only. Attempting to use ESM `import` syntax will result in a runtime error.
fix
Use `require('grpc-kit')` or configure your bundler to handle CommonJS.
affects: >=0.1.0
gotchaRoute handlers for server streaming must call `call.end()` explicitly; otherwise, the client stream may hang.
fix
Always call `call.end()` after writing all responses in server streaming handlers.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'grpc-kit'
Package not installed or missing peer dependencies.
fix
Run: npm install grpc @grpc/proto-loader grpc-kit
TypeError: grpc.load is not a function
Grpc-kit internally calls `grpc.load` which is deprecated in newer `grpc` versions.
fix
Use an older version of `grpc` (e.g., 1.24.x) or migrate away from grpc-kit.
Error: The method 'hello' is not supported by the service
Route names must match exactly the RPC method name in the proto file (case-sensitive).
fix
Ensure routes object keys match the exact RPC names (e.g., 'hello' not 'Hello').
Unhandled stream error: Error: 14 UNAVAILABLE: Connection dropped
Server not reachable or wrong address.
fix
Verify server address and port. Ensure server is listening before client connects.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies
grpcrequiredPeer dependency: provides the core gRPC implementation. grpc-kit wraps this to simplify server/client creation.
@grpc/proto-loaderrequiredPeer dependency: loads .proto files and generates service definitions. grpc-kit uses it internally.
Agent activity
17 hits · last 30 days
node
16
Amazon
1
Resources
grpc-kit — npm install grpc-kit · libregistry