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
- Node.js 18.17 or later
- PostgreSQL database (local or hosted β NeonΒ , SupabaseΒ , or RailwayΒ work great)
- npm or pnpm (recommended)
Setup Steps
Clone the Repository
git clone https://github.com/ibobdb/nextjs-starter-docs
cd dbsInstall Dependencies
npm install
# or
pnpm installConfigure Environment Variables
Copy the example file and fill in your values:
cp .env.example .envOpen .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 initGenerate the Prisma Client
npx prisma generateSeed the Database
The seed script populates roles, permissions, menu items, and a default super_admin user:
npm run db:seed
# or
npx prisma db seedThe 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 devOpen http://localhost:3000Β and log in with your seeded super admin account.
Environment Variable Reference
| Variable | Required | Description |
|---|---|---|
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 pushProduction 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 deployNever 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.