π Interactive Database Seeding
Added
-
Interactive Seed Prompts: Custom username and password input during first-time setup
npx prisma db seednow prompts for credentials instead of using hardcoded defaults- Hidden password input (displayed as
*) for security - Password confirmation to prevent typos
- Automatic validation:
- Username minimum 3 characters
- Password minimum 4 characters
- Duplicate username check
- Password match verification
- Default values (admin/admin) if no input provided
- Skip seeding if admin already exists
- Beautiful formatted output with emojis and separators
-
Enhanced Security: No more hardcoded credentials in source code
- Passwords never visible during input
- Bcrypt hashing (10 rounds) before storage
- Custom credentials from the start
- Production-ready security by default
-
Documentation: Comprehensive guides for interactive seeding
docs/interactive-seeding.md- Complete feature documentationdocs/QUICK_START_SEEDING.md- Quick start guidedocs/interactive-seed-demo.sh- Demo script showing workflow- Updated README.md with interactive seeding examples
Changed
-
prisma/seed.ts: Complete rewrite with interactive prompts
- Uses Node.js
readlinefor terminal input - Custom
questionPassword()function with hidden input - Raw mode terminal handling for secure password entry
- Comprehensive error handling and validation
- User-friendly messages and visual feedback
- Uses Node.js
-
README.md: Updated deployment instructions
- Added interactive seeding example session
- Documented prompt workflow
- Explained default value behavior
Developer Experience
- More secure initial setup (no default credentials exposure)
- Better UX with visual feedback and validation
- Prevents common mistakes with confirmation prompts
- Production-ready from first deployment
- No need to edit code for custom credentials
Security Improvements
- β No hardcoded credentials in source code
- β Password hidden during input (raw mode)
- β Confirmation prevents typos
- β Minimum length requirements enforced
- β Bcrypt hashing before storage
- β Duplicate username prevention