{"id":48961,"library":"prisma-nestjs-graphql","title":"prisma-nestjs-graphql","description":"Generate NestJS GraphQL object types, inputs, args, and enums from a Prisma schema file. Current stable version is 23.2.1. It integrates with @nestjs/graphql and is released regularly. Key differentiators: generates only necessary imports, combines nested/nullable filters, and avoids generating resolvers (application-specific). It supports a structured JavaScript config file instead of flat schema keys, and provides options for decorators, custom imports, and scalar types. Requires @prisma/generator-helper and identity-type as peer dependencies.","status":"active","version":"23.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/unlight/prisma-nestjs-graphql","tags":["javascript","nestjs","graphql","prisma","prisma-generator","nestjs-graphql"],"install":[{"cmd":"npm install prisma-nestjs-graphql","lang":"bash","label":"npm"},{"cmd":"yarn add prisma-nestjs-graphql","lang":"bash","label":"yarn"},{"cmd":"pnpm add prisma-nestjs-graphql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to run as a Prisma generator (peer dependency).","package":"@prisma/generator-helper","optional":false},{"reason":"Provides identity type utilities for generated types (peer dependency).","package":"identity-type","optional":false}],"imports":[{"note":"Named export for TypeScript config file type. Default export is the config factory function.","wrong":"import ExternalConfig from 'prisma-nestjs-graphql'","symbol":"ExternalConfig","correct":"import { ExternalConfig } from 'prisma-nestjs-graphql'"},{"note":"Config file must use ESM default export (type: 'module' in package.json or .mjs extension).","wrong":"module.exports = { output: '../src/@generated' }","symbol":"default (config export)","correct":"export default { output: '../src/@generated' }"},{"note":"Generated types are output to the configured output directory, not from @prisma/client. The exact path depends on outputFilePattern.","wrong":"import { User } from '@prisma/client'","symbol":"Generated types (e.g., User, UserCreateInput)","correct":"import { User } from './@generated/user/user.model'"}],"quickstart":{"code":"// schema.prisma\ngenerator nestgraphql {\n  provider = \"prisma-nestjs-graphql\"\n  output   = \"../src/@generated\"\n}\n\nmodel User {\n  id        Int      @id @default(autoincrement())\n  email     String   @unique\n  name      String?\n  posts     Post[]\n}\n\nmodel Post {\n  id        Int      @id @default(autoincrement())\n  title     String\n  content   String?\n  author    User?    @relation(fields: [authorId], references: [id])\n  authorId  Int?\n}\n\n// Run: npx prisma generate\n// Then use in NestJS:\nimport { ObjectType } from '@nestjs/graphql';\nimport { User } from './@generated/user/user.model';\n\n@ObjectType()\nexport class UserWithPosts extends User {\n  @Field(() => [Post])\n  posts: Post[];\n}","lang":"typescript","description":"Shows basic usage: add generator to schema.prisma, run prisma generate, and import generated types."},"warnings":[{"fix":"Migrate to configFile approach: create prisma/nestgraphql.config.mjs and move all options there as structured objects.","message":"Config file format changed from underscore-delimited keys to structured JS objects. Old flat keys are deprecated and may be removed in future versions.","severity":"breaking","affected_versions":"<23.0.0"},{"fix":"Use a structured config file as shown in the README.","message":"Using underscore-delimited keys (fields_Validator_from, decorate_1_type, etc.) directly in schema.prisma is deprecated.","severity":"deprecated","affected_versions":">=23.0.0"},{"fix":"Use absolute paths or ensure relative path is correct for your project structure.","message":"The output path in configFile is relative to the config file, not the schema file. If defined in schema.prisma, it's relative to the schema file.","severity":"gotcha","affected_versions":">=23.0.0"},{"fix":"Use .mjs extension or set 'type': 'module' in package.json.","message":"Config file must use ESM default export (export default) and be named .mjs or have 'type': 'module' in package.json.","severity":"gotcha","affected_versions":">=23.0.0"},{"fix":"Run: npm install graphql-type-json prisma-graphql-type-decimal","message":"Additional graphql scalar types (graphql-type-json, prisma-graphql-type-decimal) must be installed manually if models use Decimal or Json types.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'23.2.1':23 'applic':46 'application-specif':45 'arg':11 'avoid':42 'combin':38 'config':53 'current':19 'custom':65 'decor':64 'depend':78 'differenti':33 'enum':13 'file':18,54 'filter':40 'flat':57 'generat':5,34,43,85 'graphql':4,7,81,88 'ident':74 'identity-typ':73 'import':37,66 'input':10 'instead':55 'integr':25 'javascript':52,79 'key':32,59 'necessari':36 'nested/nullable':39 'nestj':3,6,80,87 'nestjs-graphql':86 'nestjs/graphql':27 'object':8 'option':62 'peer':77 'prisma':2,16,82,84 'prisma-gener':83 'prisma-nestjs-graphql':1 'prisma/generator-helper':71 'provid':61 'regular':31 'releas':30 'requir':70 'resolv':44 'scalar':68 'schema':17,58 'specif':47 'stabl':20 'structur':51 'support':49 'type':9,69,75 'version':21","created_at":"2026-06-07T16:59:21.113994+00:00","updated_at":"2026-06-07T16:59:21.113994+00:00","problems":[{"fix":"Ensure output path is correctly specified and configFile points to a valid .mjs file.","cause":"Missing or misconfigured configFile or output path.","error":"Error: Generator 'nestgraphql' failed: Could not find generator options..."},{"fix":"Run: npm install identity-type --save-dev","cause":"Missing peer dependency identity-type.","error":"Cannot find module 'identity-type'"},{"fix":"Install prisma-graphql-type-decimal and register in GraphQL module.","cause":"Prisma model uses Decimal type but the scalar type is not registered.","error":"Unknown type 'Decimal'. Please install prisma-graphql-type-decimal"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/unlight/prisma-nestjs-graphql","github":"https://github.com/unlight/prisma-nestjs-graphql","docs":null,"changelog":null,"pypi":null,"npm":"prisma-nestjs-graphql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}