This project uses Prisma with SQLite for local development. The database setup is fully automated, but this guide explains how it works and provides manual options.
For new developers, everything is automated:
git clone <repository-url>
cd gamedoora-ui
npm install # This automatically sets up the database!
npm run dev # Start developing immediatelyThe postinstall script automatically:
- ✅ Detects if it's a first-time setup
- ✅ Creates the SQLite database file
- ✅ Runs initial migrations to create tables
- ✅ Generates the Prisma client
- ✅ Handles existing installations gracefully
The database includes these tables:
id- Auto-increment primary keyname- User's full nameemail- Unique email addressphone- Optional phone numberpassword- Hashed passwordavatar- Optional avatar URLuserID- Unique identifier (cuid)isVerified- Verification statuscreated_at/updated_at- Timestamps
id- Session identifieruserId- Foreign key to Usertoken- Unique session tokenexpiresAt- Token expirationcreated_at- Creation timestamp
If you need to manage the database manually:
# Set up database (first time)
npm run db:setup
# Reset database (deletes all data)
npm run db:reset
# Apply pending migrations
npx prisma migrate deploy
# Generate Prisma client
npx prisma generate
# Open database GUI
npm run db:studioIf the automatic setup fails:
# Reset and try again
npm run db:reset
npm installIf you get migration errors:
# Reset database and migrations
npm run db:reset
# Then follow the prompts to recreateOn some systems, you might need to fix permissions:
chmod 644 prisma/dev.db- Database:
prisma/dev.db(SQLite file) - Schema:
prisma/schema.prisma(Table definitions) - Migrations:
prisma/migrations/(Version history) - Setup Script:
scripts/setup-db.js(Automation logic)
For production, you'll want to:
- Use a production database (PostgreSQL recommended)
- Update the
datasourceinschema.prisma - Set
DATABASE_URLenvironment variable - Run
prisma migrate deployin your deployment pipeline
This setup ensures that:
- ✅ New team members can start immediately
- ✅ Database schema stays in sync
- ✅ No manual setup steps required
- ✅ Works in CI/CD pipelines
- ✅ Handles both fresh installs and updates
Happy coding! 🎮