Docs
Guides
Database Setup

Database Setup

Learn how to connect your application to a database using Prisma ORM.

This project uses Prisma ORM for database interaction. It supports PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, and CockroachDB. By default, it is often configured for PostgreSQL.

Connection String

Set your database connection string in the .env file.

.env
# PostgreSQL example
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"

Running Migrations

After setting up your database URL, run the following command to push the schema to your database.

npx prisma migrate dev

This command will:

  • Update your database schema.
  • Generate the Prisma Client.
  • Seed the database (if a seed script is configured).

Prisma Studio

Prisma Studio is a visual editor for the data in your database. You can run it with:

npx prisma studio