Registry / devops / minimal-grpc-server

minimal-grpc-server

JSON →
library0.7.1jsnpmunverified

A lightweight TypeScript library that wraps Google's gRPC server to simplify starting a gRPC server. Version 0.7.1 requires Node >=16.13.0. It reduces boilerplate by providing a concise API for server configuration and startup, while still leveraging the full gRPC framework. Unlike full-featured frameworks, it focuses on minimal setup for quick prototyping and microservices.

npm install minimal-grpc-server
INSTALL
IMPORT
SIG · MINIMAL-GRPC-SERVE
M
minimal-grpc-server
devopsjavascriptv0.7.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
import { GrpcServer } from 'minimal-grpc-server'
const GrpcServer = require('minimal-grpc-server');
The package is ESM-only; CommonJS require will fail.
ServerCredentials
import { ServerCredentials } from 'minimal-grpc-server'
Same as GrpcServer, must be imported via named import.
startServer
import { startServer } from 'minimal-grpc-server'
import startServer from 'minimal-grpc-server';
startServer is a named export, not default.

Shows how to create a gRPC server with a proto file, add a service implementation, and start listening.

import { GrpcServer } from 'minimal-grpc-server'; import { loadSync } from '@grpc/proto-loader'; const packageDefinition = loadSync('./service.proto', { keepCase: true, longs: String, enums: String, defaults: true, oneofs: true }); const server = new GrpcServer(packageDefinition, { host: '0.0.0.0', port: 50051, tls: false }); // Add service implementation server.addService('myPackage.MyService', { myMethod: (call, callback) => { callback(null, { message: 'Hello ' + call.request.name }); } }); server.start(); console.log('Server running on port 50051');
Debug
Known issues
breakingBreaking change in v0.5.0: server.start() now returns a Promise instead of void.
fix
Await server.start() or use .then().
affects: >=0.5.0
deprecatedThe option 'insecure' in GrpcServer constructor is deprecated in favor of 'tls'.
fix
Replace 'insecure: true' with 'tls: false'.
affects: >=0.6.0
gotchaIf you omit the 'credentials' option, the server defaults to insecure (no TLS) which is not suitable for production.
fix
Explicitly set 'tls: true' and provide certificates for production use.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: server.start is not a function
Using an older version where start() was not yet a function or mis-imported default export.
fix
Ensure you are using >=0.5.0 and importing named export: import { GrpcServer } from 'minimal-grpc-server'
Error: Cannot find module '@grpc/grpc-js'
Missing peer dependency @grpc/grpc-js.
fix
npm install @grpc/grpc-js
TypeError: packageDefinition is not iterable
proto-loader might not be installed or the proto file path is incorrect.
fix
Ensure @grpc/proto-loader is installed and the proto file exists at the given path.
Upgrade
Version history
0.7.1latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC implementation for Node.js
@grpc/proto-loaderrequiredLoading .proto files for service definitions
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
minimal-grpc-server — npm install minimal-grpc-server · libregistry