
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
@grpc.ts/nestjs-client
Advanced tools
NestJS's Dynamic Module for Client.
npm install --save @grpc.ts/nestjs-client
# or
yarn add @grpc.ts/nestjs-client
# or
pnpm add @grpc.ts/nestjs-client
// example.proto
syntax = "proto3";
import "google/protobuf/timestamp.proto";
package example.v1;
message Message {
string message = 1;
google.protobuf.Timestamp created_at = 2;
}
message SendMessageRequest {
string message = 1;
google.protobuf.Timestamp created_at = 2;
}
message GetMessageResponse { Message message = 1; }
service ExampleService {
rpc SendMessage(SendMessageRequest) returns (GetMessageResponse);
}
In NestJS
// client.module.ts
import { Module } from '@nestjs/common';
import { GrpcClient } from '@grpc.ts/nestjs-client';
import { ClientController } from './client.controller';
@Module({
imports: [
GrpcClient.register([
{
url: 'localhost:3010',
package: [
{
packageName: 'example.v1',
protoPath: '../proto/example.proto',
},
{
packageName: 'example2.v1',
protoPath: '../proto/example2.proto',
},
{
protoPath: '../proto/example3.proto',
},
],
packageDefinitionOptions: {
oneofs: true,
longs: String,
enums: String,
defaults: true,
},
options: {
keepaliveTimeMs: 5_000,
},
},
]),
],
controllers: [ClientController],
})
export class ClientModule {}
// client.controller.ts
import { Controller, Get } from '@nestjs/common';
import {
GrpcService,
createMetadata,
dateToGrpcTimestamp,
} from '@grpc.ts/nestjs-client';
@Controller('/client')
export class ClientController {
constructor(
@GrpcService({
serviceName: 'ExampleService',
})
private readonly exampleService: any,
) {}
@Get()
public async sendMessage(): Promise<string> {
this.exampleService
.sendMessage(
{ message: 'hello', createdAt: dateToGrpcTimestamp(new Date()) },
createMetadata({
meta: 'test',
}),
)
.then((data) => {
console.log(data);
})
.catch((err) => {
console.log(err);
});
return 'Ok!';
}
}
FAQs
NestJS package for client
We found that @grpc.ts/nestjs-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.