Docs
Database

Database

Let's take a look at the project Database.

BuouNext utilizes Prisma as its ORM. We've seamlessly integrated it with NextAuth, Stripe(Paypal) and Others.

Setting Up the Database

You can use PostgreSQL or MySQL only by configure environment variables.

DATABASE_URL="mysql://user:pwd@service:port/database"

Setting Up the Prisma

Prisma Client

The Prisma Client, located at lib/db.ts, is globally instantiated and exported for use in your API routes. We recommend using this instance instead of importing it separately in each file.

Schema

The Prisma schema file (/prisma/schema.prisma) defines your database schema and models. It's used to generate the Prisma Client.

Migrations

The Prisma migrations file (/prisma/migrations/schema.prisma) defines your database sql.

Integration with NextAuth.js

NextSaaS integrates NextAuth with Prisma. The schema file is preconfigured with recommended values for models like User, Session, Account, Post and VerificationToken, as per NextAuth.js documentation.

Extra Info