{"_id":"@averildwi/nest-prisma","_rev":"10-0942406386b81d45092287c35f6d3987","name":"@averildwi/nest-prisma","dist-tags":{"latest":"2.0.0"},"versions":{"1.0.0":{"name":"@averildwi/nest-prisma","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.0","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"2455e83a9eae56a1c19c68c46b63dcbbfc61276c","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.0.tgz","fileCount":4,"integrity":"sha512-KCqVyMBhKzJq5K9YtvMxlWLcqFaEEGJIVm5V3sQK/BdUEZzXRHzVqxM3mdG7BtcpXzcCm/lCXDqcEr4cRZ0TfQ==","signatures":[{"sig":"MEQCIEfU0udRF472ZYns09QQdWl3CX1tmbsxzDVVtx/40aKxAiAGPWlXznhcnyF1EhvA/oNUJCDjRsTcZdGtVE+ayRyIJQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7251},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.0_1784089987919_0.7980926927622551","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@averildwi/nest-prisma","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.1","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"b4c88c9107221b72b4e60fec83a7e005e496e007","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.1.tgz","fileCount":4,"integrity":"sha512-+CDSggjJmwhlua4j2L8QSRg3sHz7Z8JLqJ2Tge70y9RsRIBHyxrlaFnTLrAF0tm8LdKoFZVxIQU9AinRtmqeTA==","signatures":[{"sig":"MEMCICBefKkqkWMDlUDBtuwk6bcBfC8pGRN/IZuHa1uhIaWiAh9/TMfiJ9xGtpmnvTlsgtXFrXoqKpUPuCuDMJMoppGD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7112},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.1_1784090510860_0.43084269124468033","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@averildwi/nest-prisma","version":"1.0.2","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.2","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"f084bb8e3cad7fc2cca20c64a7e23a2759a8ef94","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.2.tgz","fileCount":4,"integrity":"sha512-SXOVD/RAImeUfSUSV91gHR/zVyQSfJKklyFZtseg54QZfM/FfYsN7GHTcgcvC4sauDCufEWC2YBK2ujjTDH/lQ==","signatures":[{"sig":"MEUCIEZ0eInOkUOdBjqwJY9b1hOiR3uZNqbG/e4JMY1aGSljAiEAgYtIXIwFdK4ZhfyvhIEmr/FP6LqqNJzdqYa1v6GTF/Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7120},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.2_1784090645207_0.44159509541759334","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@averildwi/nest-prisma","version":"1.0.3","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.3","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"de70c758245c8a6638b4ff4172854863b8a652fd","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.3.tgz","fileCount":4,"integrity":"sha512-oTRe1qCh52hnREJC0d2628R/x3sKfuEYZI5K2AziHbsEtu9be5KQb+TpgDQ6KcMrPdlx8CUGb6A0rCSRK2LGvQ==","signatures":[{"sig":"MEYCIQClR7FZgs653Vc9LKQUiXPOFM3jtuJeG6TsC0Ipka0rKQIhAOP7F1LRQlJ1uE3X1siJd3Jv5eIyHnPBwANsKCuAW2Vx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9985},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.3_1784091197844_0.7504013060227164","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@averildwi/nest-prisma","version":"1.0.4","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.4","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"03668fc189a79bc7c1994b06e3a5bcb3af09ec66","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.4.tgz","fileCount":4,"integrity":"sha512-7RaayvAvnp+JFGSnY1oal1LxlbKv7aTxN/m2oNgZNSbZt0K9GsphQYCyq8yVlpnpawQpRKKs3wwsbw7KBnUaqA==","signatures":[{"sig":"MEUCIFM53XDirCxdGdUvQoyalmk1sBEFmvlknd46oL8O6cSvAiEAwQyiUC2RjkW+xOI951vijL8NPKAJm9SzLTrqs7MN51o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11050},"main":"index.js","type":"commonjs","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.4_1784091525497_0.1600269621446373","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@averildwi/nest-prisma","version":"1.0.5","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.5","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"d117e606d646fa194acf450939b521ae5a382716","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.5.tgz","fileCount":6,"integrity":"sha512-YscYWYcZhC8KyWpfo6SImZejxR62Rb3dPxWbsbkXpBZS3p8VHBeaExVNXE5hmjHlRTwi2WGlZ6F+x2HAm0EVqA==","signatures":[{"sig":"MEUCIQDw1XmaqfWh9iNmv0Sb9YoY6oEdXJd5r+PqJrC6naVVcgIgH+hmIOjVc3KIzxO4E9Vy/pV+efV7MBBkFktqpKszKTk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16977},"main":"index.js","type":"commonjs","gitHead":"67bb2c85ca0606199a1e568f2d9b258e2bb97f32","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.5_1784110817367_0.8788640314675757","host":"s3://npm-registry-packages-npm-production"}},"1.0.6":{"name":"@averildwi/nest-prisma","version":"1.0.6","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.6","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"06d9f6e9c3c830017e6beecb86b88729e3e32ef5","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.6.tgz","fileCount":6,"integrity":"sha512-yJdJJmq6s5agRFsR4Q6NvXlPhoyh23vaHqFg/Zjt5rms2SlbA2HTQ4HAYjGT2dvjYykgjN2Iq8GxWdx2XBLOFw==","signatures":[{"sig":"MEUCIQC/OhU+If9uXpL/KUrzS1C45O0kKLLT0RjyWaiD3Fui4AIgET10ufskY09K7RPwYVjKlIZXtcHIfpebr2u+/Wv0R1o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16940},"main":"index.js","type":"commonjs","gitHead":"446717a6e15646c261f43f1214bfaede781ff77b","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.6_1784111014082_0.09467778009489924","host":"s3://npm-registry-packages-npm-production"}},"1.0.7":{"name":"@averildwi/nest-prisma","version":"1.0.7","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.0.7","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"index.js"},"dist":{"shasum":"e35c6b00ec937e071b949bea647c17ec84a93b57","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.0.7.tgz","fileCount":6,"integrity":"sha512-I0KAR1TaaLLSuwSFXx7koO0tqNGRnwnC3iMmw0ZeSt47lU1XzH+Wx1po3e617uJBkK8JJlA6Km/K43lbhBvNSg==","signatures":[{"sig":"MEUCIQCe+QP1mPb9zBjZpB6TYTsXPiNVQpbn2LWtpw48Y3GLHwIgVjYrzWMkFWW//Aoyi1uLu6x43Sq5vwMX89VmWOM6DvA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":21005},"main":"index.js","type":"commonjs","gitHead":"136ee75667ee244debd37bc1825fa9568b908c78","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.0.7_1784134686817_0.7749094403898462","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@averildwi/nest-prisma","version":"1.1.0","keywords":[],"author":"","license":"ISC","_id":"@averildwi/nest-prisma@1.1.0","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"bin":{"nest-prisma":"bin/generate-interactive.js"},"dist":{"shasum":"99f953318ae871e93c32cf069e5f13cc035073d9","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-1.1.0.tgz","fileCount":20,"integrity":"sha512-VIPAqNDUqrgcMpcFOXDRqmsPfZIXzGAfXef0rFaKwJV4FlA3w6skrTufuLCLIxKncOUrwYedE0NE7HkiO4fXrQ==","signatures":[{"sig":"MEYCIQDXIoinQOjIeUaWjHLu0P/8FbKEAoU/A7huG8++DmJs/wIhAMiX4wBJ4BHosa/LB1r+BNd+Sm3JdvMSCtHs5nu2MbqE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26181},"main":"bin/generate-interactive.js","type":"commonjs","gitHead":"639ad07c355060d06dcad87af58920209f2ccff0","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"_npmVersion":"11.7.0","description":"An interactive CLI generator to scaffold Prisma ORM with flexible version handling (stable vs latest) for NestJS projects.","directories":{},"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/nest-prisma_1.1.0_1784145919991_0.5448923601434756","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"_id":"@averildwi/nest-prisma@2.0.0","bin":{"nest-prisma":"bin/generate-interactive.js"},"bugs":{"url":"https://github.com/averildwi/nest-prisma/issues"},"dist":{"shasum":"57521190ed47b90a2e71f187d71003bd76747bd8","tarball":"https://registry.npmjs.org/@averildwi/nest-prisma/-/nest-prisma-2.0.0.tgz","fileCount":26,"integrity":"sha512-mVugojFRkWa0SpCMDgMAA9PsLxRScPAm14/Zk+/MHDO5J2l1v6VET6oSsIf0FkjjbxFE9YraEBNBPcwUMIpnLA==","signatures":[{"sig":"MEUCIANQQFxG3UsmWY2ugspfBOYbFXexRd/jvsyLxMO3O8vdAiEA9R4Ctn8S8YNKNOMPJTeUk6JC5b1DRnTvXZxbQIjXQug=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDZLmMxRIGNBVu1faW4w3n9/1bmuKd9Kbuj7905CBtrMAiEA98IocOPw7FttkkeNGknp4odisIAG0fxEyVt6Ms71F6s="}],"unpackedSize":61566},"main":"bin/generate-interactive.js","name":"@averildwi/nest-prisma","type":"commonjs","author":{"name":"averildwi"},"engines":{"node":"^20.19 || ^22.12 || >=24.0"},"gitHead":"c6ea93d334f4076c0ddee581f3b71a19da00e71e","license":"MIT","scripts":{"test":"node --test test/unit.test.js"},"version":"2.0.0","_npmUser":{"name":"averildwi","email":"averildwiy@gmail.com"},"homepage":"https://github.com/averildwi/nest-prisma#readme","keywords":["nestjs","prisma","cli","scaffold","postgresql","mysql","mariadb","driver-adapter"],"repository":{"url":"git+https://github.com/averildwi/nest-prisma.git","type":"git"},"_npmVersion":"11.20.0","description":"Interactive CLI that sets up Prisma ORM 7 with a driver adapter (PostgreSQL or MySQL/MariaDB) in an existing NestJS project.","directories":{},"maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"_nodeVersion":"22.17.1","dependencies":{"fs-extra":"^11.3.6","inquirer":"^9.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nest-prisma_2.0.0_1790922689847_0.1085534264309167"}}},"time":{"created":"2026-07-15T04:33:07.792Z","modified":"2026-10-02T06:31:30.065Z","1.0.0":"2026-07-15T04:33:08.066Z","1.0.1":"2026-07-15T04:41:50.991Z","1.0.2":"2026-07-15T04:44:05.321Z","1.0.3":"2026-07-15T04:53:17.982Z","1.0.4":"2026-07-15T04:58:45.648Z","1.0.5":"2026-07-15T10:20:17.508Z","1.0.6":"2026-07-15T10:23:34.221Z","1.0.7":"2026-07-15T16:58:06.984Z","1.1.0":"2026-07-15T20:05:20.145Z","2.0.0":"2026-10-02T06:31:29.930Z"},"license":"MIT","keywords":["nestjs","prisma","cli","scaffold","postgresql","mysql","mariadb","driver-adapter"],"description":"Interactive CLI that sets up Prisma ORM 7 with a driver adapter (PostgreSQL or MySQL/MariaDB) in an existing NestJS project.","maintainers":[{"name":"averildwi","email":"averildwiy@gmail.com"}],"readme":"# @averildwi/nest-prisma\n\n[![npm version](https://img.shields.io/npm/v/@averildwi/nest-prisma.svg)](https://www.npmjs.com/package/@averildwi/nest-prisma)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js](https://img.shields.io/badge/node-%5E20.19%20%7C%7C%20%5E22.12%20%7C%7C%20%3E%3D24-brightgreen)](https://nodejs.org)\n[![NestJS](https://img.shields.io/badge/NestJS-v11-red)](https://nestjs.com)\n\nAn interactive CLI that sets up [Prisma ORM](https://www.prisma.io/) 7 with a\ndriver adapter inside an existing [NestJS](https://nestjs.com/) project. One\ncommand installs the packages, creates the schema, writes `PrismaService` and\n`PrismaModule`, registers the module, and generates the client.\n\n## Quick start\n\nRun it from the root of your NestJS project:\n\n```bash\nnpx @averildwi/nest-prisma\n```\n\nThe CLI asks which database you use, shows the full list of planned changes,\nand applies them only after you confirm.\n\n```\n  Planned changes\n    $ npm install @prisma/client@7.10.0 @prisma/adapter-pg dotenv\n    $ npm install --save-dev prisma@7.10.0\n    $ npx prisma init --datasource-provider postgresql --output ../src/generated/prisma --no-skills\n    + prisma/schema.prisma (generator set for the driver adapter)\n    + src/prisma/prisma.service.ts\n    + src/prisma/prisma.module.ts\n    ~ src/app.module.ts (add PrismaModule to imports)\n    ~ .gitignore (add /src/generated/prisma)\n    ~ tsconfig.build.json (exclude the Prisma config file)\n    $ npx prisma generate\n\n? Apply these changes? (Y/n)\n```\n\n## Options\n\n| Option | Description |\n|---|---|\n| `--db <name>` | `postgres` or `mysql` (aliases: `pg`, `postgresql`, `mariadb`) |\n| `--prisma <ver>` | Prisma version to install (default: latest supported) |\n| `--pm <name>` | `npm`, `pnpm`, `yarn` or `bun` (default: auto-detect) |\n| `--no-generate` | Skip `prisma generate` |\n| `--no-install` | Only write files, don't install packages |\n| `-y, --yes` | Skip prompts and use defaults |\n| `--dry-run` | Show the plan without changing anything |\n| `--no-color` | Disable colours (`NO_COLOR` is respected too) |\n| `-v, --version` / `-h, --help` | Version / help |\n\nNon-interactive use (CI, scripts):\n\n```bash\nnpx @averildwi/nest-prisma --db postgres --yes\n```\n\nWithout a TTY the CLI never waits for input. If `--db` is missing it exits with\ncode 2 and tells you what to pass.\n\nThe package manager is picked from `--pm`, then the lockfile, then the command\nthat launched the CLI (for example `pnpm dlx`), then npm.\n\n## Supported databases\n\n| Database | Adapter | Class |\n|---|---|---|\n| PostgreSQL | `@prisma/adapter-pg` | `PrismaPg` |\n| MySQL / MariaDB / Percona | `@prisma/adapter-mariadb` | `PrismaMariaDb` |\n\nEach adapter brings its own database driver, so `pg` or `mysql2` are not\ninstalled separately.\n\n## What gets generated\n\n```typescript\n// src/prisma/prisma.service.ts\nimport 'dotenv/config';\nimport { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common';\nimport { PrismaClient } from '../generated/prisma/client';\nimport { PrismaPg } from '@prisma/adapter-pg';\n\n@Injectable()\nexport class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy {\n  constructor() {\n    const connectionString = process.env.DATABASE_URL;\n    if (!connectionString) {\n      throw new Error('DATABASE_URL is not set. Add it to your .env file before starting the app.');\n    }\n    super({ adapter: new PrismaPg(connectionString) });\n  }\n\n  async onModuleInit() { await this.$connect(); }\n  async onModuleDestroy() { await this.$disconnect(); }\n}\n```\n\n`PrismaModule` is `@Global()` and is added to the `imports` of `AppModule`, so\n`PrismaService` can be injected anywhere:\n\n```typescript\n@Injectable()\nexport class UsersService {\n  constructor(private readonly prisma: PrismaService) {}\n\n  findAll() {\n    return this.prisma.user.findMany();\n  }\n}\n```\n\n## After setup\n\n1. Set `DATABASE_URL` in `.env`.\n2. Add models to `prisma/schema.prisma` and run `npx prisma migrate dev --name init`.\n3. Start the app with `npm run start:dev`.\n\n## Behaviour notes\n\n- **Safe to re-run.** Each step checks the project first and skips work that is\n  already done. Running the CLI on a configured project prints\n  \"Nothing to do\".\n- **Fails with a clear report.** If a step fails, the CLI lists the steps that\n  finished and the files that changed, so you know the state of the project.\n  Fix the problem and run the command again.\n- **Checks the project first.** It refuses to run outside a NestJS project\n  (`@nestjs/core` must be in `package.json`), on an unsupported Node version, or\n  in an ESM (`\"type\": \"module\"`) project.\n- **The client lives in `src/generated/prisma`.** Generating it inside `src/`\n  keeps Nest's build output at `dist/main.js`. The folder is added to\n  `.gitignore`.\n- **The Prisma config file is excluded from the build.** `prisma init` creates a\n  `.ts` config at the project root. The CLI adds it to the `exclude` list in\n  `tsconfig.build.json` so `npm run start:prod` keeps working.\n- **Prisma 8 is not supported yet.** Prisma 8 replaces `@prisma/client` with new\n  packages and a different API. It will be added once it has a stable release.\n\n## Development\n\n```bash\nnpm install\nnpm test        # unit tests (node:test, no extra dependencies)\nnpm link        # makes the `nest-prisma` command point at this checkout\n```\n\nTo test end to end, create a throwaway project and run the CLI inside it:\n\n```bash\nnest new demo --package-manager npm --skip-git\ncd demo\nnest-prisma --db postgres --dry-run   # check the plan\nnest-prisma --db postgres --yes       # apply it\nnpm run build                         # must produce dist/main.js\nnest-prisma --db postgres --yes       # must print \"Nothing to do\"\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","homepage":"https://github.com/averildwi/nest-prisma#readme","repository":{"url":"git+https://github.com/averildwi/nest-prisma.git","type":"git"},"author":{"name":"averildwi"},"bugs":{"url":"https://github.com/averildwi/nest-prisma/issues"}}