diff --git a/content/200-orm/200-prisma-client/150-using-raw-sql/200-raw-queries.mdx b/content/200-orm/200-prisma-client/150-using-raw-sql/200-raw-queries.mdx index 557e2b0b73..d38c2f03ab 100644 --- a/content/200-orm/200-prisma-client/150-using-raw-sql/200-raw-queries.mdx +++ b/content/200-orm/200-prisma-client/150-using-raw-sql/200-raw-queries.mdx @@ -823,7 +823,7 @@ const result = await prisma.user.findRaw({ .findRaw(args?: {filter?: InputJsonObject, options?: InputJsonObject}): PrismaPromise; ``` -- `filter`: The query predicate filter. If unspecified, then all documents in the collection will match the [predicate](https://www.mongodb.com/docs/manual/reference/operator/query). +- `filter`: The query predicate filter. If unspecified, then all documents in the collection will match the [predicate](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/). - `options`: Additional options to pass to the [`find` command](https://www.mongodb.com/docs/manual/reference/command/find/#command-fields). ### `aggregateRaw()` @@ -849,7 +849,7 @@ const result = await prisma.user.aggregateRaw({ .aggregateRaw(args?: {pipeline?: InputJsonObject[], options?: InputJsonObject}): PrismaPromise; ``` -- `pipeline`: An array of aggregation stages to process and transform the document stream via the [aggregation pipeline](https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline). +- `pipeline`: An array of aggregation stages to process and transform the document stream via the [aggregation pipeline](https://www.mongodb.com/docs/atlas/data-federation/supported-unsupported/supported-aggregation/). - `options`: Additional options to pass to the [`aggregate` command](https://www.mongodb.com/docs/manual/reference/command/aggregate/#command-fields). #### Caveats diff --git a/content/200-orm/800-more/400-comparisons/03-prisma-and-mongoose.mdx b/content/200-orm/800-more/400-comparisons/03-prisma-and-mongoose.mdx index 35e6bcfd31..37fd86d58c 100644 --- a/content/200-orm/800-more/400-comparisons/03-prisma-and-mongoose.mdx +++ b/content/200-orm/800-more/400-comparisons/03-prisma-and-mongoose.mdx @@ -116,7 +116,7 @@ Prisma ORM generates many [additional filters](/orm/prisma-client/queries/filter **Mongoose** -Mongoose exposes the [MongoDB query selectors](https://www.mongodb.com/docs/manual/reference/operator/query/#query-selectors) as filter criteria. +Mongoose exposes the [MongoDB query selectors](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/logical/) as filter criteria. ## Relation filters diff --git a/content/800-guides/080-turborepo.mdx b/content/800-guides/080-turborepo.mdx index 4b2c01852f..6a42b30274 100644 --- a/content/800-guides/080-turborepo.mdx +++ b/content/800-guides/080-turborepo.mdx @@ -23,7 +23,7 @@ This guide will show you how to set up Prisma as a standalone package in a Turbo - Integrating the Prisma package into other applications in the monorepo. ### Prerequisites -- [Node.js 18+](https://nodejs.org/) +- [Node.js 20+](https://nodejs.org/) ## 1. Set up your project diff --git a/content/800-guides/090-nextjs.mdx b/content/800-guides/090-nextjs.mdx index 6f76b719d8..ac9db4b2e6 100644 --- a/content/800-guides/090-nextjs.mdx +++ b/content/800-guides/090-nextjs.mdx @@ -27,7 +27,7 @@ This guide shows you how to use Prisma with Next.js 15, a fullstack React framew You can find a [deployment-ready example on GitHub](https://github.com/prisma/prisma-examples/blob/latest/orm/nextjs). ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - A Vercel account (if you want to deploy your application) ## 1. Set up your project diff --git a/content/800-guides/150-multiple-databases.mdx b/content/800-guides/150-multiple-databases.mdx index 3fe59fb5c6..2327858288 100644 --- a/content/800-guides/150-multiple-databases.mdx +++ b/content/800-guides/150-multiple-databases.mdx @@ -20,7 +20,7 @@ This guide shows you how to use multiple databases using Prisma ORM in a single Before you begin, make sure that you have the following: -- Node.js 18+ installed. +- Node.js 20+ installed. - A [Prisma Data Platform account](https://pris.ly/pdp?utm_campaign=multi-client&utm_source=docs). - A Vercel account (if you plan to deploy your application). diff --git a/content/800-guides/180-solid-start.mdx b/content/800-guides/180-solid-start.mdx index dc2076e4c3..dc33f95c66 100644 --- a/content/800-guides/180-solid-start.mdx +++ b/content/800-guides/180-solid-start.mdx @@ -15,7 +15,7 @@ Prisma ORM streamlines database access with type-safe queries and a smooth devel In this guide, you'll learn how to integrate Prisma ORM with a Prisma Postgres database in a SolidStart project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/solid-start). ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) ## 1. Set up your project diff --git a/content/800-guides/190-sveltekit.mdx b/content/800-guides/190-sveltekit.mdx index f7f4bcf605..7bc7ffe291 100644 --- a/content/800-guides/190-sveltekit.mdx +++ b/content/800-guides/190-sveltekit.mdx @@ -17,7 +17,7 @@ In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres datab ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - [Svelte VSCode extension](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode) (Recommended by Svelte) diff --git a/content/800-guides/200-clerk-nextjs.mdx b/content/800-guides/200-clerk-nextjs.mdx index 2abf74bfe4..c0601a54c8 100644 --- a/content/800-guides/200-clerk-nextjs.mdx +++ b/content/800-guides/200-clerk-nextjs.mdx @@ -16,7 +16,7 @@ In this guide you'll wire Clerk into a brand-new [Next.js](https://nextjs.org/) ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - [Clerk account](https://clerk.com) - [ngrok account](https://ngrok.com) diff --git a/content/800-guides/220-astro.mdx b/content/800-guides/220-astro.mdx index 836ec1580d..d528ddbf2c 100644 --- a/content/800-guides/220-astro.mdx +++ b/content/800-guides/220-astro.mdx @@ -24,7 +24,7 @@ Prisma ORM offers type-safe database access, and [Astro](https://astro.build/) i In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in an Astro project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/astro). ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - [Astro VSCode extension (recommended)](https://marketplace.visualstudio.com/items?itemName=astro-build.astro-vscode) ## 1. Set up your project diff --git a/content/800-guides/230-betterauth-nextjs.mdx b/content/800-guides/230-betterauth-nextjs.mdx index 6fc3d76667..61e48510de 100644 --- a/content/800-guides/230-betterauth-nextjs.mdx +++ b/content/800-guides/230-betterauth-nextjs.mdx @@ -16,7 +16,7 @@ In this guide, you'll wire Better Auth into a brand-new [Next.js](https://nextjs ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - Basic familiarity with Next.js App Router and Prisma ## 1. Set up your project diff --git a/content/800-guides/330-github-actions.mdx b/content/800-guides/330-github-actions.mdx index f18f3c0309..56785234bd 100644 --- a/content/800-guides/330-github-actions.mdx +++ b/content/800-guides/330-github-actions.mdx @@ -20,7 +20,7 @@ After the PR is closed, the database is automatically deleted. This allows you t Make sure you have the following: -- Node.js 18 or later +- Node.js 20 or later - A [Prisma Data Platform](https://console.prisma.io?utm_source=actions_guide&utm_medium=docs) account - GitHub repository diff --git a/content/800-guides/340-ai-sdk-nextjs.mdx b/content/800-guides/340-ai-sdk-nextjs.mdx index c1c7e3b222..bfac7d06f0 100644 --- a/content/800-guides/340-ai-sdk-nextjs.mdx +++ b/content/800-guides/340-ai-sdk-nextjs.mdx @@ -15,7 +15,7 @@ Prisma ORM streamlines database access with type-safe queries, and when paired w In this guide, you'll learn to build a chat application using AI SDK with Next.js and Prisma ORM to store chat sessions and messages in a Prisma Postgres database. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/ai-sdk-nextjs). ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - An [OpenAI API key](https://platform.openai.com/api-keys) or other AI provider API key ## 1. Set up your project diff --git a/content/800-guides/350-authjs-nextjs.mdx b/content/800-guides/350-authjs-nextjs.mdx index 8f30a64212..b74251fb27 100644 --- a/content/800-guides/350-authjs-nextjs.mdx +++ b/content/800-guides/350-authjs-nextjs.mdx @@ -16,7 +16,7 @@ In this guide, you'll wire Auth.js into a brand-new [Next.js](https://nextjs.org ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - Basic familiarity with Next.js App Router and Prisma ## 1. Set up your project diff --git a/content/800-guides/360-embed-studio-nextjs.mdx b/content/800-guides/360-embed-studio-nextjs.mdx index e6dc11afd2..fdfd99c1b8 100644 --- a/content/800-guides/360-embed-studio-nextjs.mdx +++ b/content/800-guides/360-embed-studio-nextjs.mdx @@ -38,7 +38,7 @@ Currently, Embedded Prisma Studio supports [**Prisma Postgres**](/postgres), wit ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - Basic knowledge of React and Next.js - A Prisma Postgres database diff --git a/content/800-guides/400-betterauth-astro.mdx b/content/800-guides/400-betterauth-astro.mdx index 56857da2be..26050049d5 100644 --- a/content/800-guides/400-betterauth-astro.mdx +++ b/content/800-guides/400-betterauth-astro.mdx @@ -16,7 +16,7 @@ In this guide, you'll wire Better Auth into a brand-new [Astro](https://astro.bu ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) - Basic familiarity with Astro and Prisma ## 1. Set up your project diff --git a/content/800-guides/430-nestjs.mdx b/content/800-guides/430-nestjs.mdx new file mode 100644 index 0000000000..0be7bc23c4 --- /dev/null +++ b/content/800-guides/430-nestjs.mdx @@ -0,0 +1,519 @@ +--- +title: 'How to use Prisma ORM with NestJS' +metaTitle: 'How to use Prisma ORM with NestJS' +description: 'Learn how to use Prisma ORM in a NestJS app' +sidebar_label: 'NestJS' +image: '/img/guides/prisma-nestjs-cover.png' +completion_time: '20 min' +tags: + - NestJS + - REST API +community_section: true +--- + +## Introduction + +This guide shows you how to use Prisma ORM with [NestJS](https://nestjs.com/), a progressive Node.js framework for building efficient and scalable server-side applications. You'll build a REST API with NestJS that uses Prisma ORM to store and retrieve data from a database. + +[Prisma ORM](https://www.prisma.io) is an open-source ORM for Node.js and TypeScript. It is used as an **alternative** to writing plain SQL, or using another database access tool such as SQL query builders (like [knex.js](https://knexjs.org/)) or ORMs (like [TypeORM](https://typeorm.io/) and [Sequelize](https://sequelize.org/)). Prisma currently supports PostgreSQL, MySQL, SQL Server, SQLite, MongoDB and CockroachDB. + +While Prisma can be used with plain JavaScript, it embraces TypeScript and provides a level of type-safety that goes beyond the guarantees other ORMs in the TypeScript ecosystem offer. + +You can find a ready-to-run example [here](https://github.com/prisma/prisma-examples/tree/latest/orm/nest) + +## Prerequisites + +- [Node.js 20+](https://nodejs.org) + +## 1. Create your NestJS project + +Install the NestJS CLI and create a new project: + +```terminal +npm install -g @nestjs/cli +nest new nestjs-prisma +``` + +When prompted, select **npm** as your package manager. Navigate to the project directory: + +```terminal +cd nestjs-prisma +``` + +You can run `npm start` to start your application at `http://localhost:3000/`. Over the course of this guide, you'll add routes to store and retrieve data about _users_ and _posts_. + +## 2. Set up Prisma + +### 2.1. Install Prisma and dependencies + +Install the necessary Prisma packages and database drivers: + +```terminal +npm install prisma --save-dev +npm install @prisma/client @prisma/adapter-pg pg +``` + +:::info + +If you are using a different database provider (PostgreSQL, MySQL, SQL Server), install the corresponding driver adapter package instead of `@prisma/adapter-pg`. For more information, see [Database drivers](/orm/overview/databases/database-drivers). + +::: + +### 2.2. Initialize Prisma + +Initialize Prisma in your project: + +```terminal +npx prisma init --db --output ../src/generated/prisma +``` + +This creates a new `prisma` directory with the following contents: + +- `schema.prisma`: Specifies your database connection and contains the database schema +- `prisma.config.ts`: A configuration file for your projects +- `.env`: A [dotenv](https://github.com/motdotla/dotenv) file, typically used to store your database credentials in a group of environment variables + +### 2.3. Set the generator output path + +Specify your output `path` for the generated Prisma client either by passing `--output ../src/generated/prisma` during `prisma init`, or directly in your Prisma schema: + +```prisma file=prisma/schema.prisma +generator client { + provider = "prisma-client" + output = "../src/generated/prisma" +} +``` + +### 2.4. Configure your database connection + +Your database connection is configured in the `datasource` block in your `schema.prisma` file. By default it's set to `postgresql` which is what you need for this guide. + +```prisma file=prisma/schema.prisma +generator client { + provider = "prisma-client" + output = "../src/generated/prisma" +} + +datasource db { + provider = "postgresql" +} +``` + +Now, open up `.env` and you should see a `DATABASE_URL` already specified: + +```bash file=.env +DATABASE_URL="" +``` +:::note + +Make sure you have a [ConfigModule](https://docs.nestjs.com/techniques/configuration) configured, otherwise the `DATABASE_URL` variable will not be picked up from `.env`. + +::: + +### 2.5. Define your data model + +Add the following two models to your `schema.prisma` file: + +```prisma file=prisma/schema.prisma +model User { + id Int @id @default(autoincrement()) + email String @unique + name String? + posts Post[] +} + +model Post { + id Int @id @default(autoincrement()) + title String + content String? + published Boolean? @default(false) + author User? @relation(fields: [authorId], references: [id]) + authorId Int? +} +``` + +### 2.6. Create and run your migration + +With your Prisma models in place, you can generate your SQL migration files and run them against the database. Run the following commands in your terminal: + +```terminal +npx prisma migrate dev --name init +``` + +This `prisma migrate dev` command generates SQL files and directly runs them against the database. In this case, the following migration files was created in the existing `prisma` directory: + +```bash +$ tree prisma +prisma +├── migrations +│ └── 20201207100915_init +│ └── migration.sql +└── schema.prisma +``` + +### 2.7. Generate Prisma Client + +Once installed, you can run the generate command to generate the types and Client needed for your project. If any changes are made to your schema, you will need to rerun the `generate` command to keep those types in sync. + +```terminal +npx prisma generate +``` + +## 3. Create a Prisma service + +You're now able to send database queries with Prisma Client. When setting up your NestJS application, you'll want to abstract away the Prisma Client API for database queries within a service. To get started, you can create a new `PrismaService` that takes care of instantiating `PrismaClient` and connecting to your database. + +Inside the `src` directory, create a new file called `prisma.service.ts` and add the following code to it: + +```typescript file=src/prisma.service.ts +import { Injectable } from '@nestjs/common'; +import { PrismaClient } from './generated/prisma/client'; +import { PrismaPg } from '@prisma/adapter-pg'; + +@Injectable() +export class PrismaService extends PrismaClient { + constructor() { + const adapter = new PrismaPg({ + connectionString: process.env.DATABASE_URL as string, + }); + super({ adapter }); + } +} +``` + +## 4. Create User and Post services + +Next, you can write services that you can use to make database calls for the `User` and `Post` models from your Prisma schema. + +### 4.1. Create the User service + +Still inside the `src` directory, create a new file called `user.service.ts` and add the following code to it: + +```typescript file=src/user.service.ts +import { Injectable } from '@nestjs/common'; +import { PrismaService } from './prisma.service'; +import { User, Prisma } from './generated/prisma/client'; + +@Injectable() +export class UserService { + constructor(private prisma: PrismaService) {} + + async user( + userWhereUniqueInput: Prisma.UserWhereUniqueInput, + ): Promise { + return this.prisma.user.findUnique({ + where: userWhereUniqueInput, + }); + } + + async users(params: { + skip?: number; + take?: number; + cursor?: Prisma.UserWhereUniqueInput; + where?: Prisma.UserWhereInput; + orderBy?: Prisma.UserOrderByWithRelationInput; + }): Promise { + const { skip, take, cursor, where, orderBy } = params; + return this.prisma.user.findMany({ + skip, + take, + cursor, + where, + orderBy, + }); + } + + async createUser(data: Prisma.UserCreateInput): Promise { + return this.prisma.user.create({ + data, + }); + } + + async updateUser(params: { + where: Prisma.UserWhereUniqueInput; + data: Prisma.UserUpdateInput; + }): Promise { + const { where, data } = params; + return this.prisma.user.update({ + data, + where, + }); + } + + async deleteUser(where: Prisma.UserWhereUniqueInput): Promise { + return this.prisma.user.delete({ + where, + }); + } +} +``` + +Notice how you're using Prisma Client's generated types to ensure that the methods that are exposed by your service are properly typed. You therefore save the boilerplate of typing your models and creating additional interface or DTO files. + +### 4.2. Create the Post service + +Now do the same for the `Post` model. + +Still inside the `src` directory, create a new file called `post.service.ts` and add the following code to it: + +```typescript file=src/post.service.ts + +import { Injectable } from '@nestjs/common'; +import { PrismaService } from './prisma.service'; +import { Post, Prisma } from './generated/prisma/client'; + +@Injectable() +export class PostService { + constructor(private prisma: PrismaService) {} + + async post( + postWhereUniqueInput: Prisma.PostWhereUniqueInput, + ): Promise { + return this.prisma.post.findUnique({ + where: postWhereUniqueInput, + }); + } + + async posts(params: { + skip?: number; + take?: number; + cursor?: Prisma.PostWhereUniqueInput; + where?: Prisma.PostWhereInput; + orderBy?: Prisma.PostOrderByWithRelationInput; + }): Promise { + const { skip, take, cursor, where, orderBy } = params; + return this.prisma.post.findMany({ + skip, + take, + cursor, + where, + orderBy, + }); + } + + async createPost(data: Prisma.PostCreateInput): Promise { + return this.prisma.post.create({ + data, + }); + } + + async updatePost(params: { + where: Prisma.PostWhereUniqueInput; + data: Prisma.PostUpdateInput; + }): Promise { + const { data, where } = params; + return this.prisma.post.update({ + data, + where, + }); + } + + async deletePost(where: Prisma.PostWhereUniqueInput): Promise { + return this.prisma.post.delete({ + where, + }); + } +} +``` + +Your `UserService` and `PostService` currently wrap the CRUD queries that are available in Prisma Client. In a real world application, the service would also be the place to add business logic to your application. For example, you could have a method called `updatePassword` inside the `UserService` that would be responsible for updating the password of a user. + +## 5. Implement REST API routes + +### 5.1. Create the controller + +Finally, you'll use the services you created in the previous sections to implement the different routes of your app. For the purpose of this guide, you'll put all your routes into the already existing `AppController` class. + +Replace the contents of the `app.controller.ts` file with the following code: + +```typescript file=src/app.controller.ts +import { + Controller, + Get, + Param, + Post, + Body, + Put, + Delete, +} from '@nestjs/common'; +import { UserService } from './user.service'; +import { PostService } from './post.service'; +import { User as UserModel } from './generated/prisma/client'; +import { Post as PostModel } from './generated/prisma/client'; + +@Controller() +export class AppController { + constructor( + private readonly UserService: UserService, + private readonly postService: PostService, + ) {} + + @Get('post/:id') + async getPostById(@Param('id') id: string): Promise { + return this.postService.post({ id: Number(id) }); + } + + @Get('feed') + async getPublishedPosts(): Promise { + return this.postService.posts({ + where: { published: true }, + }); + } + + @Get('filtered-posts/:searchString') + async getFilteredPosts( + @Param('searchString') searchString: string, + ): Promise { + return this.postService.posts({ + where: { + OR: [ + { + title: { contains: searchString }, + }, + { + content: { contains: searchString }, + }, + ], + }, + }); + } + + @Post('post') + async createDraft( + @Body() postData: { title: string; content?: string; authorEmail: string }, + ): Promise { + const { title, content, authorEmail } = postData; + return this.postService.createPost({ + title, + content, + author: { + connect: { email: authorEmail }, + }, + }); + } + + @Post('user') + async signupUser( + @Body() userData: { name?: string; email: string }, + ): Promise { + return this.UserService.createUser(userData); + } + + @Put('publish/:id') + async publishPost(@Param('id') id: string): Promise { + return this.postService.updatePost({ + where: { id: Number(id) }, + data: { published: true }, + }); + } + + @Delete('post/:id') + async deletePost(@Param('id') id: string): Promise { + return this.postService.deletePost({ id: Number(id) }); + } +} +``` + +This controller implements the following routes: + +#### `GET` + +- `/post/:id`: Fetch a single post by its `id` +- `/feed`: Fetch all _published_ posts +- `/filtered-posts/:searchString`: Filter posts by `title` or `content` + +#### `POST` + +- `/post`: Create a new post + - Body: + - `title: String` (required): The title of the post + - `content: String` (optional): The content of the post + - `authorEmail: String` (required): The email of the user that creates the post +- `/user`: Create a new user + - Body: + - `email: String` (required): The email address of the user + - `name: String` (optional): The name of the user + +#### `PUT` + +- `/publish/:id`: Publish a post by its `id` + +#### `DELETE` + +- `/post/:id`: Delete a post by its `id` + +### 5.2. Register services in the app module + +Remember to register the new services in the app module. + +Update `src/app.module.ts` to register all services: + +```typescript file=src/app.module.ts +import { Module } from '@nestjs/common'; +import { AppController } from './app.controller'; +import { ConfigModule } from '@nestjs/config'; +import { AppService } from './app.service'; +//add-start +import { PrismaService } from './prisma.service'; +import { UserService } from './user.service'; +import { PostService } from './post.service'; +//add-end + +@Module({ + imports: [ConfigModule.forRoot()], + controllers: [AppController], + //add-next-line + providers: [AppService, PrismaService, UserService, PostService], +}) +export class AppModule {} +``` + +## 6. Test your API + +Start your application: + +```terminal +npm start +``` + +Test your endpoints with curl, [Postman](https://www.postman.com/), or [HTTPie](https://httpie.io/). + +**Create a user:** +```bash +curl -X POST http://localhost:3000/user \ + -H "Content-Type: application/json" \ + -d '{"name": "Alice", "email": "alice@prisma.io"}' +``` + +**Create a post:** +```bash +curl -X POST http://localhost:3000/post \ + -H "Content-Type: application/json" \ + -d '{"title": "Hello World", "authorEmail": "alice@prisma.io"}' +``` + +**Get published posts:** +```bash +curl http://localhost:3000/feed +``` + +**Publish a post:** +```bash +curl -X PUT http://localhost:3000/publish/1 +``` + +**Search posts:** +```bash +curl http://localhost:3000/filtered-posts/hello +``` + +## Summary + +In this guide, you learned how to use Prisma ORM with NestJS to implement a REST API. The controller that implements the routes of the API is calling a `PrismaService` which in turn uses Prisma Client to send queries to a database to fulfill the data needs of incoming requests. + +If you want to learn more about using NestJS with Prisma, be sure to check out the following resources: + +- [NestJS & Prisma](https://www.prisma.io/nestjs) +- [Ready-to-run example projects for REST & GraphQL](https://github.com/prisma/prisma-examples/) +- [Production-ready starter kit](https://github.com/notiz-dev/nestjs-prisma-starter#instructions) +- [Video: Accessing Databases using NestJS with Prisma (5min)](https://www.youtube.com/watch?v=UlVJ340UEuk&ab_channel=Prisma) by [Marc Stammerjohann](https://github.com/marcjulian) diff --git a/content/800-guides/999-making-guides.mdx b/content/800-guides/999-making-guides.mdx index c51510d433..5e1f599b32 100644 --- a/content/800-guides/999-making-guides.mdx +++ b/content/800-guides/999-making-guides.mdx @@ -255,7 +255,7 @@ Prisma ORM streamlines database access with type-safe queries, and when paired w In this guide, you'll learn to integrate Prisma ORM with a Prisma Postgres database in a __________ project from scratch. You can find a complete example of this guide on [GitHub](https://github.com/prisma/prisma-examples/tree/latest/orm/__________). ## Prerequisites -- [Node.js 18+](https://nodejs.org) +- [Node.js 20+](https://nodejs.org) ## 1. Set up your project diff --git a/sidebars.ts b/sidebars.ts index b5c4a99034..7bf54d57d2 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -360,6 +360,7 @@ const sidebars: SidebarsConfig = { collapsible: false, items: [ "guides/nextjs", + "guides/nestjs", "guides/nuxt", "guides/sveltekit", "guides/astro", diff --git a/static/img/guides/prisma-nestjs-cover.png b/static/img/guides/prisma-nestjs-cover.png new file mode 100644 index 0000000000..7a702d5037 Binary files /dev/null and b/static/img/guides/prisma-nestjs-cover.png differ