npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@voodoo-ts/nest

v0.4.2

Published

This integrates [voodoo-ts](https://github.com/voodoo-ts/voodoo-ts) into [NestJS](https://docs.nestjs.com/).

Readme

About

This integrates voodoo-ts into NestJS.

Getting started

Install

npm install @voodoo-ts/nest

General setup 🫡

First create an instance of voodoo-ts and export it, so it can be shared between modules

// voodoo.instance.ts

import {
  StringToBooleanValueTransformer,
  StringToNumberValueTransformer,
  TransformerInstance,
} from '@voodoo-ts/voodoo-ts';

export const voodoo = TransformerInstance.withDefaultProject({
  additionalValueTransformerFactories: [new StringToNumberValueTransformer(), new StringToBooleanValueTransformer()],
});

Validation

Use the validation pipeline

// main.ts

import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@voodoo-ts/nest';

import { AppModule } from './app.module';
import { voodoo } from './validation.instance';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalPipes(new ValidationPipe({ transformerInstance: voodoo }));
  await app.listen(3000);
}
bootstrap();

Now you can use voodoo-ts to validate @Body() and @Query() payloads as usual.

// app.constroller.ts

import { voodoo } from './validation.instance';

@voodoo.Dto()
class LoginDto {
  email!: string;
  password!: string;
}

@Controller()
export class AppController {
  /*
   * This the postHello method
   */
  @Post('/login')
  login(@Body() body: LoginDto): string {
    // ... stuff ...
    return `Hello ${body.email}`;
  }
}

This will work only for classes decorated as @Dto(). And for primitive data types if you specify the field name, e.g. @Query('foo') foo: number. Unlike the default validation pipeline this will throw errors if it encounters a type reference it can't validate.

Swagger

Create an instance of the OpenApiVoodoo class in your central voodoo.instance.ts, or whereever you like.

// voodoo.instance.ts

import {
  StringToBooleanValueTransformer,
  StringToNumberValueTransformer,
  TransformerInstance,
} from '@voodoo-ts/voodoo-ts';

export const voodoo = TransformerInstance.withDefaultProject({
  additionalValueTransformerFactories: [new StringToNumberValueTransformer(), new StringToBooleanValueTransformer()],
});

export const { ApiModel, additionalModels } = new OpenApiVoodoo(voodoo).unwrap();

Now can use @ApiModel() to decorate Dto classes. This will ensure all properties are wrapped with @ApiProperty() and enrich their Swagger types and documentation. Call the processApiModels() method after all imports are settled, preferably in main.ts. It's still recommended to enable the swagger-cli plugin from NestJS, but you should disable the class-validator shims

// nest-cli.json
{
  "$schema": "https://json.schemastore.org/nest-cli",
  "collection": "@nestjs/schematics",
  "sourceRoot": "src",
  "compilerOptions": {
    "deleteOutDir": true,
    "plugins": [
      {
        "name": "@nestjs/swagger",
        "options": {
          "classValidatorShim": false,
          "introspectComments": true
        }
      }
    ]
  }
}

voodoo-swagger will automatically create classes for intersections, unions and partials. But you need to expose them to @nestjs/swagger. These classes will be tracked in additionalModels.

// main.ts

import { additionalModels } from './voodoo.instance.ts';

async function bootstrap() {
  // ...
  const document = SwaggerModule.createDocument(app, config, { extraModels: additionalModels });
  SwaggerModule.setup('api', app, document, { customCssUrl: '/theme.css' });
  // ...
}

Make sure everything is imported at this point.

Environment helper

Use the environment helper

// app.module.ts

import { Global, Module } from '@nestjs/common';
import { ConfigModule } from '@voodoo-ts/nest';
import { From } from '@voodoo-ts/voodoo-ts';

import { AppController } from './app.controller';
import { AppService } from './app.service';
import { voodoo } from './validation.instance';

@voodoo.Dto()
class Env {
  @From('HOME')
  home!: string;
}

// If you don't want to import the ConfigModule in each module
@Global()
@Module({
  imports: [ConfigModule.register(transformer, Env)],
  exports: [ConfigModule],
})
export class GlobalModule {}

@Module({
  imports: [GlobalModule],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}