Database
Setup your database locally or useSupabase
Setup Database locally
1. If you want to setup the database locally then visitthis pageand follow instructions to setup database locally.
2. Then rename.env.exampleto.env. Then add your connection string toPOSTGRESQL_URLandPOSTGRESQL_DIRECT_URLin.env.
.env
POSTGRESQL_URL=postgres://[Username]:[YOUR-PASSWORD]@[Host]:[Port]/[Database-Name]?schema=public POSTGRESQL_DIRECT_URL=postgres://[Username]:[YOUR-PASSWORD]@[Host]:5432/[Database-Name]?schema=public
Setup Supabase Database
1. Set up a new project on a PostgreSQL hosting service like Supabase Postgres
You can also use other PostgreSQL hosting services and use thePOSTGRESQL_URLandPOSTGRESQL_DIRECT_URLin.env.
2. Login tosupabase.com
3. Go toDashboard
4. Create a new project and provide the details they are asking
5. Remember the password you set for database
6. After the project created successfully, click the connect button on top right side of page. Then, a pop up appear, which showed in a picture below. Replace[YOUR-PASSWORD]with yourDatabase Password.

7. Rename.env.exampleto.env.Then add the copied url toPOSTGRESQL_URLin.env. Also add the copied url toPOSTGRESQL_DIRECT_URLin.envbut change the port to5432.
8. Run the below command in the terminal, this will add tables in database that are define inschema.prisma.
terminal
npx prisma migrate dev --name initial_migration
9. (Optional) If you update theschema.prismafile after the initial migration, run the following commands in the terminal to update the database with the new changes:
terminal
npx prisma migrate dev npx prisma generate