User Management
Creating a User
Use the existing script to create a new user:
bash
npx tsx scripts/create-user.ts <email> <password>
Example:
bash
npx tsx scripts/create-user.ts hello@user.com password
The script will:
- •Check if a user with that email already exists
- •Hash the password with bcrypt
- •Generate a UUID for the user
- •Insert the user into the
userstable in SQLite
File: scripts/create-user.ts
Key Files
- •
scripts/create-user.ts- User creation script - •
src/lib/db/db-users.ts- Database operations (createUser,getUserById,getUserByEmail) - •
src/lib/auth.ts- Auth utilities (hashPassword,verifyPassword,createSession,getSession)
Database Schema
Users are stored in the users table with columns:
- •
id- UUID primary key - •
email- Unique email address - •
password- Bcrypt-hashed password