- Check the link: PostgreSQL 安装教程
- Verify Installation: Open cmd and run
- Create a database: Open cmd and run
# Create a new database user 'app_user' with the password '12345'
psql -d postgres -c "CREATE USER app_user WITH PASSWORD '12345';"
# Transfer ownership of the 'approval_mis' database to 'app_user' so this user has full control
psql -d postgres -c "ALTER DATABASE approval_mis OWNER TO app_user;"
- Check the link: Bun 安装
- Verify Installation: Open cmd and run
DATABASE_URL="postgresql://app_user:12345@localhost:5432/approval_mis"
BETTER_AUTH_SECRET="your_secret_key"
BETTER_AUTH_URL="http://localhost:3000"
- Initialize the database (one command):
# Install dependencies
bun install
# Apply migrations and seed database automatically
bunx prisma migrate dev --name init
# Insert test data
bunx tsx prisma/seed.ts
- Start development server:
- (Optional) View the database in Prisma Studio: