Improved NestJS Tracing with Recap.Dev

Arseny Yankovski

Arseny Yankovski

Lead Architect @ eMarketeer

We just released a new 1.9.0 version of the JavaScript client which exports a new wrapNestJsModule function. Which when used like this:

import { NestFactory } from '@nestjs/core';
import { wrapNestJsModule } from '';
const app = await NestFactory.create(wrapNestJsModule(AppModule));

will record calls and their timings of the controllers and injectables in the NestJS module.

A timeline with NestJS module wrapped

We decided to make it a function that wraps a module to allow you to trace your application to your liking.

Tracing individual functions allows for different unit naming strategies. One example is making the unit name a combination of an environment, controller name, and a controller method name. We can write a middleware to do that automatically.

app.use((req, res, next) => {
res.prependListener('finish', () => {

This will result in a unit name like this: local-AppController.getHello

Check the complete source code of an example NestJS project traced with here

Adding to your application won't take more than 5 minutes.

Click here to learn how to get started with