Welcome 👋 brothers and sisters to this amazing blog post where you will learn how to get started with Prisma setup in nextjs.
Things which we will need:
Supabase or Any other database
**Step1: **Make a Nextjs project and open the terminal
**Step2: **Write this command in the terminal
npm i @prisma/client
Then write this command:
Then you will find a new folder named: ‘prisma’ in your root directory.
Now go to ‘schema.prisma’
You can see something like this.
Then go to ‘.env’ file in your directory.
You have to paste your database URI there
So, let’s go to supabase to find the URI:
Just paste it into your .env file
Now you can enjoy it. You have set up all the things.
Now you have two situations. Either you have tables or you don’t have any tables inside your database.
Just write the command
prisma db pull
Then check out the ‘schema.prisma’ file
For example, you can write this command in your ‘schema.prisma’ to make tables.
Now, you have to write the command
prisma migrate dev
Then it will ask you for your migration name.
You can write there anything you want.
Then you will see one folder as **Migrations **in your **prisma **directory.
You can check your database and see the results.
Thanks for reading this blog post.
For people who Hindi:
For people who want to join discord:
Join the Next Dev's server Discord Server!