Database
Set up and manage your PostgreSQL database with Prisma.
This SaaS boilerplate uses Prisma as an ORM (Object-Relational Mapping) tool to interact with a PostgreSQL database. Prisma simplifies database operations and provides type safety. if want to use any other database like MySQL, MongoDB, SQLite, etc. you can easily do that by changing the database URL in the .env
file.
Database Features
- Type-safe database queries
- Database migrations
- Prisma Studio for database management
- Support for multiple databases
Database Setup
Step 1: Create new database in postgres
Go to NeonDB and create a new project. Once created → Connect → Copy the connection string → paste it in the .env
file.
DATABASE_URL="your-neon-db-url"
Step 2: Run Migrations
npx prisma migrate dev --name init
Step 3: Run Generate
npx prisma generate
Step 4: Run Push
npx prisma db push
Step 5: Explore Your Database (Optional)
npx prisma studio
Optional: If you want to explore your database in the localhost, you can run this command. otherwise you can see neonDB dashboard → tables.
Explore Database Schema
- Database schema is already applied in
prisma/schema.prisma
file. you can modify it as you want.