Skip to Content
Welcome to the official DBS Documentation! πŸ“š
Getting StartedInstallation

Installation

This guide walks you through setting up DBS from scratch. By the end, you will have a fully running local environment with a seeded database, working authentication, and a live dashboard.

Prerequisites

Setup Steps

Clone the Repository

git clone https://github.com/ibobdb/nextjs-starter-docs cd dbs

Install Dependencies

npm install # or pnpm install

Configure Environment Variables

Copy the example file and fill in your values:

cp .env.example .env

Open .env and configure all required variables:

# ── Database ────────────────────────────────────────────────────────── DATABASE_URL="postgresql://user:password@localhost:5432/dbs_db" # ── Better Auth ──────────────────────────────────────────────────────── # Generate with: openssl rand -hex 32 BETTER_AUTH_SECRET="your-super-secret-key-at-least-32-chars" BETTER_AUTH_URL="http://localhost:3000" # ── Email (Resend) ───────────────────────────────────────────────────── RESEND_API_KEY="re_your_resend_api_key" EMAIL_FROM="noreply@yourdomain.com" # ── App ──────────────────────────────────────────────────────────────── NEXT_PUBLIC_APP_URL="http://localhost:3000"

BETTER_AUTH_SECRET must be at least 32 characters. In production, use a cryptographically random value: openssl rand -hex 32.

Run Prisma Migrations

This creates all required database tables:

npx prisma migrate dev --name init

Generate the Prisma Client

npx prisma generate

Seed the Database

The seed script populates roles, permissions, menu items, and a default super_admin user:

npm run db:seed # or npx prisma db seed

The default super admin credentials are defined in prisma/seed.ts. Change them immediately after your first login or set them via environment variables before seeding.

Start the Development Server

npm run dev

Open http://localhost:3000Β  and log in with your seeded super admin account.

Environment Variable Reference

VariableRequiredDescription
DATABASE_URLβœ…PostgreSQL connection string
BETTER_AUTH_SECRETβœ…Secret for session signing (32+ chars)
BETTER_AUTH_URLβœ…Full base URL of your app
RESEND_API_KEYβœ…Resend API key for transactional email
EMAIL_FROMβœ…Sender email address (must be verified with Resend)
NEXT_PUBLIC_APP_URLβœ…Public-facing app URL (used in email links)

Some settings (like RESEND_API_KEY) can optionally be stored in the database via the system settings panel and loaded dynamically with getSystemConfig(). Environment variables serve as the fallback.

Database Management

# Open Prisma Studio (GUI for your DB) npx prisma studio # Reset the database (drops all data + re-migrates + re-seeds) npx prisma migrate reset # Push schema changes without creating a migration file (prototyping) npx prisma db push

Production Deployment

DBS is optimized for deployment on Vercel with SSR. Set all environment variables in your Vercel project settings. Run prisma migrate deploy (not dev) in CI/CD:

npx prisma migrate deploy

Never run prisma migrate reset or prisma db seed in production. Use prisma migrate deploy in your build pipeline and manage seed data through the admin UI or controlled scripts.

Last updated on