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

@drzl/generator-nestjs

v0.2.1

Published

Generate NestJS DTO and entity classes from a Drizzle schema, plain classes carrying a static Standard Schema v1 validator plus an emitted pipe that runs it, with no decorators in the generated code.

Readme

@drzl/generator-nestjs

Generate NestJS DTO and entity classes from a Drizzle schema: per table, the insert, update, select and params shapes as plain classes whose fields state the parsed result and whose static schema carries a Standard Schema v1 validator, plus a small emitted SchemaValidationPipe that runs it. The controllers stay yours.

Why plain classes, not class-validator decorators

Settled from the registry and from measurement rather than taste. @nestjs/common lists class-validator and class-transformer as optional peers, and class-transformer, the half that would convert wire values, last published in 2021. Measured on class-validator 0.15.1: what a decorator DTO accepts depends on the consumer's pipe options rather than the DTO (enableImplicitConversion reads "" as 0, "0x10" as 16 and "1e5" as 100000, the exact family DRZL's route generators refuse); @IsOptional() cannot tell { bio: null } from {}; bigint has no story at all; and @Type(() => Date) accepts "1" as the year 2001. A static schema carries its policy with it, and no pipe option can loosen it.

The plain classes also compile under every tsconfig: no experimentalDecorators needed in the generated files (class-validator decorators fail TS1240 without it, measured). Your app keeps its standard Nest flags; the generated code does not require them.

Install

npm install -D @drzl/generator-nestjs

The generated code imports @nestjs/common (which a Nest app has by definition) and the validation library you chose: zod by default, valibot or arktype via validation.library.

Configure

import { defineConfig } from '@drzl/cli/config';

export default defineConfig({
  schema: 'src/db/schema.ts',
  outDir: 'src/dto',
  generators: [{ kind: 'nestjs', path: 'src/dto' }],
});

Consume

import { Body, Controller, Param, Patch, Post } from '@nestjs/common';
import { CreateUsersDto, UpdateUsersDto, UsersParamsDto } from './dto/index.js';

@Controller('users')
export class UsersController {
  @Post()
  create(@Body() body: CreateUsersDto) {
    // body is the parsed output: undeclared keys stripped, wire forms transformed.
  }

  @Patch(':id')
  update(@Param() params: UsersParamsDto, @Body() body: UpdateUsersDto) {
    // params.id is a real number, parsed by the strict segment schema.
  }
}
import { SchemaValidationPipe } from './dto/index.js';

app.useGlobalPipes(new SchemaValidationPipe());

The shape of the DTOs

  • Create<T>Dto is the insert shape: generated columns absent, and a column the database can fill in optional. That means a defaulted column, and also a nullable one, because an INSERT that omits a nullable column stores NULL (measured against a real Postgres).
  • Update<T>Dto is all-optional with the primary key columns excluded, so an id in a PATCH body is an undeclared key and is stripped.
  • <T>ParamsDto parses key segments strictly: ^-?\d+(\.\d+)?$ into a number, digits kept as a string for bigint, strict ISO datetime into a Date, the member set for an enum. The Number('') family ("", " ", "0x10", "1e5") is refused; Nest's own ParseIntPipe is nearly as strict but silently rounds "9007199254740993" (measured).
  • <T>Entity is one row at its select shape. Date columns are Date; bigint columns stay digit strings on both sides, because JSON.stringify throws on a real bigint.
  • Every class pairs with its schema through a typed static, so schema-vs-field drift is a compile error inside the generated file. The pipe validates any class carrying one and passes everything else through untouched.

Docs

https://use-drzl.github.io/drzl/generators/nestjs

License

Apache-2.0