Overview
Learn how to interact with the database in the monorepo.
The database serves as the bakbone for storing data, handling queries and making sure users get what they need fast.
Prisma
The starter kit uses Prisma as its data access solution.
Why choose Prisma? Prisma is a versatile and database-agnostic object-relational mapper (ORM) that supports a wide range of database engines, including PostgreSQL, MySQL and even NoSQL options like MongoDB. Contrary to popular belief, it's not slow anymore. You can find the current benchmarks here.
Client
Schema
Database driver
The project uses PostgreSQL as the default database provider, offering seamless integration out of the box. However, switching to alternatives like MySQL, MariaDB, PlanetScale, Supabase or Neon is straightforward. Additionally, Turso and D1 can be used with minimal adjustments.
Using MongoDB is possible, though it may require a few hours to change the prisma schema to use Mongo ObjectId
and change a few v4()
uuid calls in the codebase.
For a comprehensive list of supported database drivers, visit Prisma's Databases.
Prisma Studio
Prisma's visual database editor allows you to view and edit your database records. You can open it with:
pnpm --filter prisma-studio dev
Make sure packages/database/.env
has a correct DATABASE_URL
defined.