Registry / devops / protocat

protocat

JSON →
library0.6.5-beta.1jsnpmunverified

ProtoCat is a modern, minimalist type-safe gRPC framework for Node.js, currently at version 0.6.5-beta.1. It provides a clean middleware-based API for building gRPC services with full TypeScript support. Unlike alternatives like Mali, ProtoCat emphasizes simplicity and type safety out of the box. The project is still in beta, with active development but no stable release yet. Release cadence is irregular as it's a newer project. Key differentiators include automatic type inference from generated protobuf definitions and a lightweight footprint.

npm install protocat
INSTALL
IMPORT
SIG · PROTOCAT
P
protocat
devopsjavascriptv0.6.5-beta.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.

ProtoCat
import { ProtoCat } from 'protocat'
import ProtoCat from 'protocat'
ProtoCat is a named export, not default.
ServiceDefinition
import type { ServiceDefinition } from 'protocat'
import { ServiceDefinition } from 'protocat'
ServiceDefinition is a TypeScript type, should be imported with 'import type' for clear semantics.
CallContext
import type { CallContext } from 'protocat'
const { CallContext } = require('protocat')
CallContext is a type; using require will result in undefined.

Shows how to create a ProtoCat server, add a gRPC service with a handler, and start listening. Uses async handlers and TypeScript types.

import { ProtoCat } from 'protocat' import { CatService } from '../dist/cat_grpc_pb' const app = new ProtoCat() app.addService(CatService, { getCat: async call => { const cat = await getCatByName(call.request?.getName() ?? '') call.response.setName(cat.name) .setHealth(cat.health) .setLevel(cat.level) .setClass(cat.profession ?? 'warrior') } }) app.start('0.0.0.0:3000')
Debug
Known issues
breakingProtoCat is still in beta (v0.x). API may change without major version bump.
fix
Pin exact version and test upgrades thoroughly.
affects: <=0.6.5-beta.1
gotchaRequires generated gRPC service definitions from protobuf files. Not a code-first framework.
fix
Use protoc to generate TypeScript/JavaScript service stubs first.
affects: all
gotchaCall handlers must manually set response fields; no automatic binding.
fix
Always call call.response.set* methods inside handlers.
affects: all
deprecatedThe request.getName() pattern is specific to protobuf-generated code; may change with different protoc plugins.
fix
Check generated code accessors for your protobuf version.
affects: all
Errors
Common errors & fixes
Cannot find module 'protocat'
Package not installed or wrong import path.
fix
Run npm install protocat and use import { ProtoCat } from 'protocat'.
ProtoCat is not a constructor
Wrong import style (default vs named).
fix
Use import { ProtoCat } from 'protocat' instead of import ProtoCat from 'protocat'.
TypeError: call.request.getName is not a function
Using a code-first service definition instead of protobuf-generated one.
fix
Generate service definitions using protoc and import the correct _grpc_pb file.
Upgrade
Version history
0.6.5-beta.1latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredCore gRPC implementation for Node.js
protobufjsrequiredProtobuf serialization/deserialization
Agent activity
8 hits · last 30 days
node
8
Resources