Database
Setup of Prisma and Supabase
We use Supabase for the database. It's free and open-source and Prisma as an ORM to help with the query.
Setup
Follow the steps at Supabase Sign up
-
Go to Supabase and create a new project and make sure to copy the generate password!, for region, choose the closest to you.
-
Wait a few minutes for the setup to complete, then click on "connect" on the top menu.
-
Navigate to ORMs tab, choose Prisma
-
Copy the
DATABASE_URL
andDIRECT_URL
values to your.env
file and replace "YOUR PASSWORD" accordingly:
- Initialize your database schema by running (already pre-configured for you):
That's it! all the basic configuration is done.
Database Schema Overview
The database schema is defined in /prisma/schema.prisma
. This schema file uses Prisma’s schema definition language to describe your database tables, relationships, and types.
Add new fields
To update your database schema, you can edit the schema.prisma.
For example to add a new table for articles
Apply our new migration and update our client.
Now your changes are available on the database!