Registry / devops / grpc-server-ts

grpc-server-ts

JSON →
library1.1.4jsnpmunverified

A gRPC server-side module built with TypeScript for defining and running gRPC services using decorators. Current version 1.1.4 (released 2024). It simplifies gRPC server setup by providing decorators like @Service and @Route to define services and methods, and a RpcRegistry class to start the server with TLS settings. Differentiates from other gRPC Node libraries (e.g., @grpc/grpc-js) by offering a TypeScript-first, decorator-based API with minimal boilerplate, though it has limited documentation and a small user base.

npm install grpc-server-ts
INSTALL
IMPORT
SIG · GRPC-SERVER-TS
G
grpc-server-ts
devopsjavascriptv1.1.4
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.

Route
import { Route } from 'grpc-server-ts'
const Route = require('grpc-server-ts').Route
ESM-only; default is not a function
Service
import { Service } from 'grpc-server-ts'
import { Service } from 'grpc-server-ts'
Use as a decorator on a class
RpcRegistry
import { RpcRegistry } from 'grpc-server-ts'
import { RpcRegistry } from 'grpc-server-ts'
Extend this class and call .start()
Settings
import { Settings } from 'grpc-server-ts'
const Settings = require('grpc-server-ts').Settings
ESM-only; use as decorator on your registry class

Defines a gRPC service with a say method, configures TLS settings, and starts the server.

import { Route, Service, RpcRegistry, Settings } from 'grpc-server-ts'; @Service('./hello.proto') export class HelloService { @Route public async say() { return 'hello world'; } } const settings = { port: '3333', host: 'localhost', ca: './ca.crt', cert: './server.crt', key: './server.key' }; @Settings(settings) class RPC extends RpcRegistry {} RPC.start();
Debug
Known issues
gotchaThe .proto file path in @Service is relative to the current working directory, not the source file.
fix
Use an absolute path or ensure the working directory is correct.
affects: >=1.0.0
gotchaTLS files (ca, cert, key) are required; the server will fail to start without them.
fix
Provide valid file paths for ca, cert, and key in settings.
affects: >=1.0.0
gotchaThe @Route decorator must be used on a method that returns a value; streaming is not fully supported.
fix
For streaming, consider using @grpc/grpc-js directly.
affects: >=1.0.0
breakingVersion 1.1.0 dropped support for Node.js < 12.
fix
Upgrade Node.js to version 12 or higher.
affects: >=1.1.0
Errors
Common errors & fixes
Error: ENOENT: no such file or directory, open '.../hello.proto'
The .proto file path is incorrect or relative to a different working directory.
fix
Provide the absolute path to the .proto file in @Service.
TypeError: Class extends value undefined is not a constructor or null
RpcRegistry may not be properly imported or the class extension is invalid.
fix
Ensure import { RpcRegistry } from 'grpc-server-ts' is correct.
Error: listen EADDRINUSE :::3333
Another process is already using the specified port.
fix
Change the port in settings or kill the conflicting process.
Upgrade
Version history
1.1.4latest on npm
Audit
Dependencies
grpcrequiredCore gRPC library for Node.js
Agent activity
6 hits · last 30 days
node
6
Resources
grpc-server-ts — npm install grpc-server-ts · libregistry