From the course: Next.js Ecommerce: Build a Shopping Platform from Scratch

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Prisma user-related models

Prisma user-related models

So now we're going to add our Prisma models for authentication. There's about four models we need to add. Now this documentation page at authjs.dev, so slash getting started slash adapters slash Prisma. It has this section here where you can choose the database in our case Postgres, and it shows us the models that we need. Now we need to change some stuff up here. There's some fields we need to add. There's some annotations we need to add and change. So I'm going to copy each one one by one, and then we'll go through it. Now, this Auth.js, basically NextAuth was originally created just for Next.js, but it's broadened to other frameworks. So that's where this Auth.js comes in. So a lot of the documentation that we're going to use is from Auth.js.dev. So let's grab the user model and copy it. And let's go into Prisma, schema.prisma. Actually, we can get rid of these comments. There's no need for those. And then we're going to paste this under our product model. And I'm just going to go…

Contents