Skip to main content
All recipes

NestJS.

CodeModuleInterceptor

Register CheckUpstream as a Nest module so the SDK joins the DI container. The interceptor tags every outbound call with the controller and handler that issued it.

1. Install.

Bash
npm install @checkupstream/sdk

2. Register at bootstrap.

src/main.ts
import { NestFactory } from "@nestjs/core";
import { registerCheckUpstream } from "@checkupstream/sdk/integrations/nestjs";
import { AppModule } from "./app.module";

async function bootstrap() {
  registerCheckUpstream({
    sdkKey: process.env.CHECKUPSTREAM_SDK_KEY!,
  });

  const app = await NestFactory.create(AppModule);
  await app.listen(3000);
}

bootstrap();

3. Add the interceptor (optional).

Bind the interceptor globally if you want every controller's outbound calls tagged with handler context.

src/app.module.ts
import { Module } from "@nestjs/common";
import { APP_INTERCEPTOR } from "@nestjs/core";
import { CheckUpstreamInterceptor } from "@checkupstream/sdk/integrations/nestjs";

@Module({
  providers: [
    { provide: APP_INTERCEPTOR, useClass: CheckUpstreamInterceptor },
  ],
})
export class AppModule {}

Ship reliable upstream.

Drop the SDK in, point it at your project key, and start seeing live upstream telemetry inside the dashboard.