Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
nestjs-prisma
Advanced tools
Library and schematics to add Prisma integration to a NestJS application
Easy Prisma support for your NestJS application.
Use the nest add command to automatically setup the library, Prisma and Docker (optionally):
nest add nestjs-prisma
Add nestjs-prisma
library to your NestJS application:
# npm
npm install nestjs-prisma
# yarn
yarn add nestjs-prisma
Furthermore, setup Prisma in your NestJS application, if you haven't already.
npm i -D prisma
npm install @prisma/client
npx prisma init
Add PrismaModule
to the imports
section in your AppModule
or other modules to gain access to PrismaService
.
import { Module } from '@nestjs/common';
import { PrismaModule } from 'nestjs-prisma';
@Module({
imports: [PrismaModule.forRoot()],
})
export class AppModule {}
Use the PrismaService
via dependency injection in your controller, resolver, services, guards and more:
import { Injectable } from '@nestjs/common';
import { PrismaService } from 'nestjs-prisma';
@Injectable()
export class AppService {
constructor(private prisma: PrismaService) {}
users() {
return this.prisma.user.findMany();
}
user(userId: string) {
return this.prisma.user.findUnique({
where: { id: userId },
});
}
}
You have access to all exposed methods and arguments of the generated PrismaClient
through PrismaService
.
Visit our official documentation.
You are welcome to contribute to this project.
The code is split up into three directories:
+-- docs
+-- examples
+-- lib
+-- schematics
The docs
directory contains an astro website and the docs content.
The examples
directory contains example applications.
The lib
directory contains everything exposed by nestjs-prisma
as a library.
The schematics
directory contains the blue prints for installing the library with the schematic command.
Here are some tips if you like to make changes to the schematics.
Install @angular-devkit/schematics-cli
to be able to use schematics
command
npm i -g @angular-devkit/schematics-cli
Now build the schematics and run the schematic.
npm run build:schematics
# or
npm run dev:schematics
# dry-run
schematics .:nest-add
# execute schematics
schematics .:nest-add --debug false
# or
schematics .:nest-add --dry-run false
Helpful article about Custom Angular Schematics which also applies to Nest.
FAQs
Library and schematics to add Prisma integration to a NestJS application
The npm package nestjs-prisma receives a total of 15,890 weekly downloads. As such, nestjs-prisma popularity was classified as popular.
We found that nestjs-prisma demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.