Sample project using NestJS with Prisma
$ docker run --name mydb -e POSTGRES_USER=root -e POSTGRES_PASSWORD=root -p 5440:5432 -d postgres
$ npm i -g @nestjs/cli
$ nest new nestjs-api
$ yarn add prisma
$ yarn prisma init
-
Install the Prisma Plugin
-
Go to VSCode Settings and add the snippet below:
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma",
"editor.formatOnSave": true
}
- Create the models and run the command to create all tables:
$ yarn prisma migrate dev
- (Optional) Prisma Studio (to see the DB using an IDE):
$ yarn prisma studio
- Generate the modules automatically:
$ nest g resource {module-name}