Registry / storage / hera-grpc

hera-grpc

JSON →
library0.2.5jsnpmunverified

Hera-gRPC is a library built around Node.js gRPC (@grpc/grpc-js) for efficient data transfer in a distributed system without the need of a centralized repository for protocol buffer files (gRPC IDL). It simplifies gRPC service definition and client creation by allowing TypeScript interfaces to be used directly as service definitions, eliminating the need for .proto file management. Version 0.2.5 is the latest stable release, with active development focused on developer experience and TypeScript integration. Unlike standard gRPC implementations that require a centralized .proto repository, Hera-gRPC enables decentralized service definitions, making it ideal for microservices architectures where teams need to independently define and consume gRPC services without sharing protocol buffer files.

npm install hera-grpc
INSTALL
IMPORT
SIG · HERA-GRPC
H
hera-grpc
storagejavascriptv0.2.5
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.

createServer
import { createServer } from 'hera-grpc'
const createServer = require('hera-grpc').createServer
ESM-only since v0.2.0; use import syntax
createClient
import { createClient } from 'hera-grpc'
import { createClient } from 'hera-grpc/client'
createClient is exported from the main package, not a submodule
ServiceDefinition
import type { ServiceDefinition } from 'hera-grpc'
import { ServiceDefinition } from 'hera-grpc'
Use type import for TypeScript type-only exports to avoid runtime overhead

Shows how to define a service interface and create both a server and client without .proto files.

import { createServer, createClient } from 'hera-grpc'; import { EventEmitter } from 'events'; // Define a service interface (no .proto file needed) interface Greeter { sayHello(request: { name: string }): Promise<{ message: string }>; } // Implement the service const greeterImpl: Greeter = { async sayHello({ name }) { return { message: `Hello, ${name}!` }; }, }; // Create a gRPC server const server = createServer('localhost:50051', { Greeter: greeterImpl, }); // Create a client async function main() { const client = createClient<Greeter>('localhost:50051'); const response = await client.sayHello({ name: 'World' }); console.log(response.message); // 'Hello, World!' } main().catch(console.error);
Debug
Known issues
gotchaService interface methods must return Promise; synchronous methods are not supported.
fix
Wrap synchronous code in Promise or use async/await.
affects: <0.3.0
deprecatedThe 'createServer' function's second parameter type changed; previously accepted an array of service implementations.
fix
Pass an object mapping service names to implementations, not an array.
affects: >=0.2.0 <0.3.0
gotchaAll service method names are automatically lowercased internally; ensure client calls match the lowercase version.
fix
Use lowercase method names when calling from client, e.g., client.sayhello instead of client.sayHello.
affects: >=0.2.0
Errors
Common errors & fixes
Error: Cannot find module 'hera-grpc'
Package not installed
fix
Run 'npm install hera-grpc'
TypeError: createServer is not a function
Using CommonJS require with an ESM-only package
fix
Use 'import { createServer } from 'hera-grpc'' instead of 'require'
Upgrade
Version history
0.2.5latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC implementation for Node.js, required for all communication
Agent activity
27 hits · last 30 days
node
26
Resources
hera-grpc — npm install hera-grpc · libregistry