Registry / server / easy-grpc-server

easy-grpc-server

JSON →
library0.3.1jsnpmunverified

Quick gRPC server bootstrapping and mocking library for Node.js. Version 0.3.1 (stable, low release cadence). Allows starting a gRPC server directly from protobuf file definitions without needing to compile stubs. Supports service method handlers and mocking with GRPCError for error responses. Key differentiator: no code generation step, designed for rapid prototyping and mocking of gRPC services.

npm install easy-grpc-server
INSTALL
IMPORT
SIG · EASY-GRPC-SERVER
E
easy-grpc-server
serverjavascriptv0.3.1
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.

GRPCServer
const { GRPCServer } = require('easy-grpc-server')
import { GRPCServer } from 'easy-grpc-server'
Library is CommonJS-only; ES import syntax will fail.
GRPCError
const { GRPCError, status } = require('easy-grpc-server')
const GRPCError = require('easy-grpc-server').GRPCError
status is a named export containing gRPC status codes.
status
const { status } = require('easy-grpc-server')
const status = require('easy-grpc-server').status
status is an object with keys like INVALID_ARGUMENT, NOT_FOUND, etc.

Creates a gRPC server from a protobuf file, adds a handler for 'myMethod', and starts server on port 50051.

const { GRPCServer, GRPCError, status } = require('easy-grpc-server'); (async () => { const server = new GRPCServer({ protoPaths: ['service.proto'], includeDirs: ['/path/to/protos'], services: ['my.package.MyService'], port: 50051, secure: false, logger: console }); server.addHandler('my.package.MyService', 'myMethod', (call, callback) => { callback(null, { message: 'Hello ' + call.request.name }); }); try { const port = await server.start(); console.log(`Server started on port ${port}`); } catch (err) { console.error(err); process.exit(1); } })();
Debug
Known issues
gotchaThe `secure: false` option does not work for production; only insecure mode is supported.
fix
Use a reverse proxy (e.g., nginx) for TLS termination.
affects: >=0.1.0
breakingProto files must use correct import paths relative to includeDirs; otherwise, server start fails.
fix
Ensure protoPaths are relative to one of the includeDirs.
affects: >=0.1.0
gotchaHandlers that throw non-GRPCError errors will cause unhandled rejection.
fix
Always pass a GRPCError instance to the callback for errors.
affects: >=0.1.0
gotchaIf a service is registered but no handler is added, calls return `UNIMPLEMENTED`.
fix
Add handlers for all methods you intend to support.
affects: >=0.1.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '/some/path/service.proto'
protoPaths or includeDirs point to non-existent files.
fix
Verify paths are correct and absolute or relative to CWD.
Error: Failed to load proto file: some.proto: File not found.
Missing import directory for proto file dependencies.
fix
Add the root directory of imported protos to includeDirs.
TypeError: handler is not a function
addHandler called with non-function handler.
fix
Ensure handler is a function accepting (call, callback).
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredgRPC client/server implementation
protobufjsrequiredprotobuf parsing and reflection
google-protobufoptionalGoogle protobuf standard types
Agent activity
23 hits · last 30 days
node
18
OpenAI (training)
1
Resources
easy-grpc-server — npm install easy-grpc-server · libregistry