Registry / devops / gerpc
library1.3.0jsnpmunverified

Expressive gRPC client and server with pluggable encoding, allowing use of custom encoders/decoders (e.g., JSON) instead of protobuf. Version 1.3.0 is the latest stable release. It provides a minimal, Koa/Mali-like API for defining RPC methods and middleware. Designed for scenarios where switching from HTTP to gRPC while keeping existing encoding is desired. Limited scope and not heavily maintained.

npm install gerpc
INSTALL
IMPORT
SIG · GERPC
G
gerpc
devopsjavascriptv1.3.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.

default
import gerpc from 'gerpc'
const gerpc = require('gerpc')
Package is CommonJS but ESM import works due to Node.js interop.
client
import { client } from 'gerpc'
Named export for client function.
server
import { server } from 'gerpc'
Named export for server function.
grpc
import { grpc } from 'gerpc'
import grpc from 'gerpc'
grpc is a named export, not default.

Sets up a gRPC server and client using JSON encoding, demonstrates method registration and calling.

import { client, server } from 'gerpc'; // Define encode/decode const encode = (input) => Buffer.from(JSON.stringify(input), 'utf8'); const decode = (input) => JSON.parse(input.toString('utf8')); // Server const srv = server({ encode, decode }); srv.method('ping', (req) => Promise.resolve('pong')); srv.start({ port: 8080 }); // Client const cli = client({ host: 'localhost', port: 8080, encode, decode }); cli.ready().then(async () => { const response = await cli.call('ping', { message: 'hello' }); console.log(response); // 'pong' cli.close(); });
Debug
Known issues
gotchaThe package scope is limited to the author's exact use case and may not be suitable for production or extended use.
fix
Evaluate if the library meets your requirements before adopting.
affects: all
gotchaMiddleware `request` and `metadata` objects are shared across handlers; mutating them may cause unintended side effects.
fix
Clone or copy objects if you need to modify them without affecting other handlers.
affects: all
gotchaIf request is a primitive value, middleware cannot mutate it (CAVEAT in documentation).
fix
Ensure request objects are non-primitive if mutation is needed.
affects: all
Errors
Common errors & fixes
TypeError: gerpc.client is not a function
Importing the package incorrectly (e.g., using default import instead of named import).
fix
Use `import { client } from 'gerpc'` instead of `import gerpc from 'gerpc'`.
Error: Method not found
Calling a method that hasn't been registered on the server.
fix
Register the server method with `server.method(name, handler)` before starting the server.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
packagegerpc
gerpc — npm install gerpc · libregistry