From the course: Master Next.js by Building Scalable Apps with Routing, Databases, and Performance

Unlock this course with a free trial

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

Database creation

Database creation

So, now that we have the interface ready, let's start setting up the database. We are going to use the SQLite database along with Prisma as the ORM driver. So let's install Prisma first. I'll open the terminal and write npm install prisma, enter. And let's configure the SQLite database by saying npx prisma init hyphen hyphen data source hyphen provider and now the database that is SQLite. Alright so now the Prisma files are created. Let's go ahead and define the model for users in the schema. In the schema file, I'll write model admin user, giving the id integer. Here I will say at id default autoincrement, then the user type, which will be of string, user name, string, and giving the unique clause. This means that the value has to be unique, and the password, which will be of type string. Alright, now let's save the schema changes and make sure that you have completed the Prisma section. I have discussed all these steps in detail. So moving on, I'll open the terminal and write npx…

Contents