Registry / devops / grpc-powerkit

grpc-powerkit

JSON →
library1.0.6jsnpmunverified

grpc-powerkit is a TypeScript-based gRPC server framework using decorators for routing and service configuration. Version 1.0.6 provides an elegant way to define gRPC services with classes and decorators, integrating with @grpc/grpc-js and @grpc/proto-loader. It includes built-in error handling via GrpcError and supports custom proto files. The framework targets TypeScript-first projects, offering strong typing and decorator-based API. Release cadence is unknown; it is a niche alternative to manual gRPC setup.

npm install grpc-powerkit
INSTALL
IMPORT
SIG · GRPC-POWERKIT
G
grpc-powerkit
devopsjavascriptv1.0.6
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 'grpc-powerkit'
const GrpcServer = require('grpc-powerkit').GrpcServer
ESM-only; CommonJS require works but destructure required.
GrpcService
import { GrpcService } from 'grpc-powerkit'
import GrpcService from 'grpc-powerkit'
Named export, not default.
GrpcMethod
import { GrpcMethod } from 'grpc-powerkit'
import { GrpcMethod } from 'grpc-powerkit/dist'
No subpath imports; use root package.
GrpcError
import { GrpcError } from 'grpc-powerkit'
Also a named export.
status
import { status } from 'grpc-powerkit'
import { status } from '@grpc/grpc-js'
grpc-powerkit re-exports status from @grpc/grpc-js.

Shows a complete gRPC server with a decorator-based service, including error handling and server startup.

import { GrpcServer, GrpcService, GrpcMethod, GrpcError, status } from 'grpc-powerkit'; @GrpcService({ protoPath: './proto/hello.proto', package: 'hello', service: 'HelloService' }) class HelloController { @GrpcMethod('HelloService', 'SayHello') async sayHello(request: { name: string }) { if (!request.name) { throw new GrpcError('Name is required', status.INVALID_ARGUMENT); } return { message: `Hello ${request.name}!` }; } } async function bootstrap() { const server = new GrpcServer({ port: 50051, keepCase: true }); server.addController(HelloController); await server.start(); } bootstrap().catch(console.error);
Debug
Known issues
gotchareflect-metadata must be imported once at the entry point of your application for decorators to work.
fix
Add import 'reflect-metadata' at the top of your main file.
affects: >=1.0.0
gotchaDecorators require TypeScript compiler option 'experimentalDecorators' and 'emitDecoratorMetadata' to be enabled.
fix
Set "experimentalDecorators": true and "emitDecoratorMetadata": true in tsconfig.json.
affects: >=1.0.0
gotchaprotoPath must be an absolute or relative path from the current working directory, not from the source file location.
fix
Use path.join(__dirname, 'proto/hello.proto') or process.cwd() based path.
affects: >=1.0.0
gotchaThe package version is 1.0.6 and may have limited community support; breaking changes may occur in minor versions.
fix
Pin to exact version in package.json or monitor releases.
affects: >=1.0.0
gotchaGrpcError with status code defaults to INTERNAL if omitted; always provide appropriate gRPC status codes.
fix
Always pass a status constant (e.g., status.INVALID_ARGUMENT) when throwing GrpcError.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'reflect-metadata'
Missing reflect-metadata import or not installed as a dependency
fix
Run 'npm install reflect-metadata' and add 'import "reflect-metadata"' at the top of your entry file.
TypeError: Class extends value undefined is not a constructor or null
Missing @GrpcService decorator or incorrect proto file path
fix
Ensure the controller has @GrpcService decorator with valid protoPath, package, and service names.
Error: ENOENT: no such file or directory, open '...'
protoPath in @GrpcService config does not point to a valid .proto file
fix
Verify the proto file exists and path is correct relative to the working directory.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredPeer dependency: core gRPC client-server library
@grpc/proto-loaderrequiredPeer dependency: loads .proto files
reflect-metadatarequiredPeer dependency: required for decorators to work
Agent activity
10 hits · last 30 days
node
10
Resources
grpc-powerkit — npm install grpc-powerkit · libregistry