Menu

1 / 2

Prisma Generator NestJS DTO — pluggable DTOs with annotations and custom generators

DEV Community: nestjs·Tommaso Meli·5 months ago
#F0lLYpFH
#dev#afterall#prisma#nestjs#generator
Reading 0:00
15s threshold

If you build NestJS APIs on top of Prisma, you've probably felt the friction: your schema is the source of truth, but your DTOs, validation rules, and Swagger metadata live somewhere else — and they drift.

Most Prisma DTO generators solve the basics (Create / Update / Entity classes with decorators). That's useful, but the moment you need custom output — audit metadata, GraphQL types, RBAC manifests, your own validators — you're back to hand-written glue code.

@tommasomeli/prisma-generator-nestjs-dto is a Prisma generator built for that second phase. It emits the usual NestJS DTOs, then gets out of your way — with a plugin API , annotation-driven decorators , and a type-safe config file when the Prisma schema block isn't enough.

What you get out of the box

For every Prisma model User , run npx prisma generate and you get:

src/generated/nestjs-dto/ user/ user.entity.ts create-user.dto.ts update-user.dto.ts index.ts index.ts

Enter fullscreen mode

Exit fullscreen mode

Each file ships…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.