Registry / devops / quick-ts-proto

quick-ts-proto

JSON →
library1.0.5jsnpmunverified

A CLI tool for generating TypeScript gRPC code from protobuf files. Version 1.0.5 provides two commands: gen-grpc (for server/client gRPC code using @grpc/grpc-js) and gen-grpc-web (for gRPC-Web client code using @improbable-eng/grpc-web). It supports options for server-only, client-only, and types-only generation. Compared to alternatives like ts-proto or protobuf-ts, quick-ts-proto is a lightweight wrapper focused on quick setup with minimal configuration. However, it requires manual installation of runtime dependencies and does not support advanced features like custom imports or plugins. Release cadence is low; the package has not seen updates since mid-2023.

npm install quick-ts-proto
INSTALL
IMPORT
SIG · QUICK-TS-PROTO
Q
quick-ts-proto
devopsjavascriptv1.0.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.

gen-grpc
npx gen-grpc ./proto ./src/grpc
gen-grpc ./proto ./src/grpc (without npx if globally installed, but local install requires npx or script)
CLI command, not imported in code. Run via npx or npm script.
gen-grpc-web
npx gen-grpc-web ./proto ./src/grpc --only-types
Short option forms like -o for --only-types are not supported; use full option names.
CLI command for gRPC-Web clients. --only-types omits binary methods.
GrpcWebImpl
import { GrpcWebImpl } from './path/to/generated/grpc/example'
Import from 'quick-ts-proto' (it's a CLI tool, not a library)
Generated file path depends on output directory and proto file name.
ExampleGrpcServiceClientImpl
import { ExampleGrpcServiceClientImpl } from './path/to/generated/grpc/example'
import { ExampleGrpcServiceClient } from './example' (missing Impl suffix)
Generated client class name is constructed from the service name + 'ClientImpl'.

Demonstrates generating gRPC-Web client code from proto files and using the generated client with RxJS subscriptions.

// Install quick-ts-proto as dev dependency npm install quick-ts-proto --save-dev # Generate gRPC-Web client code npx gen-grpc-web ./proto ./src/grpc --only-types # Use the generated client in your app import { GrpcWebImpl, ExampleGrpcServiceClientImpl } from './src/grpc/example'; const rpc = new GrpcWebImpl('http://localhost:9090', { debug: true }); const client = new ExampleGrpcServiceClientImpl(rpc); // Subscribe to streaming calls client.SubscribeUserInfoChanged({}).subscribe({ next: (response) => console.log(response.message), error: (err) => console.error(err), });
Debug
Known issues
breakingThe package expects protobuf.js runtime to be installed separately. Missing it will cause runtime errors like 'Cannot find module protobufjs'.
fix
Run 'npm install protobufjs' before using generated code.
affects: >=1.0.0
deprecatedThe default output includes both server and client code, but server code may not work without additional configuration. Consider using --client or --only-types for clarity.
fix
Explicitly specify --client for client-only or --only-types for just TypeScript interfaces.
affects: >=1.0.0
gotchaThe gRPC-Web generated code uses @improbable-eng/grpc-web which is an older library and may not be compatible with modern gRPC-Web implementations (e.g., Envoy).
fix
Consider using @grpc/grpc-js with grpc-web or switch to modern alternatives like connect-es.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'protobufjs'
Missing runtime dependency protobufjs. The generated code requires it for encoding/decoding.
fix
Install protobufjs: npm install protobufjs
Error: no such option: --only-types (or -o recognized but not handled)
CLI only supports long-form options (--only-types), not short form (-o).
fix
Use --only-types instead of -o.
Error: Cannot find module '@improbable-eng/grpc-web'
Missing gRPC-Web transport dependency.
fix
Install @improbable-eng/grpc-web: npm install @improbable-eng/grpc-web
TypeError: exampleClient.SubscribeUserInfoChanged is not a function
Generated client expects the gRPC-Web transport (GrpcWebImpl) to be passed in the constructor. If not properly instantiated, methods are undefined.
fix
Ensure you create GrpcWebImpl with the correct endpoint and pass it to the client constructor: new ExampleGrpcServiceClientImpl(rpc)
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies
protobufjsrequiredRequired for both gRPC and gRPC-Web code generation as a peer dependency for encoding/decoding.
@grpc/grpc-jsoptionalRequired for gRPC server/client code generation.
rxjsoptionalRequired for client-side gRPC-Web streaming support.
longoptionalRequired for handling 64-bit integers in protobuf-Web generated code.
browser-headersoptionalRequired for gRPC-Web metadata handling.
@improbable-eng/grpc-weboptionalRequired for gRPC-Web transport layer.
Agent activity
4 hits · last 30 days
node
4
Resources
quick-ts-proto — npm install quick-ts-proto · libregistry