Available Commands
Create User
Create new user accounts with custom settings
Invite User
Send invitation emails to new users
List Users
View all registered users
Ban User
Ban or unban user accounts
Delete User
Permanently delete user accounts
Reset Password
Reset user passwords
Create User
Create a new user account with email, name, and username.Usage
Interactive Mode
If you don’t provide arguments, you’ll be prompted for each value:- Email: User’s email address (required)
- Name: Display name (defaults to email prefix)
- Username: Username (defaults to email prefix)
- Password: Leave blank to auto-generate
- Email Verified: Whether the email is pre-verified (Y/n)
Examples
Email Verification Behavior
Email Verified = True (default)
Email Verified = True (default)
The user can log in immediately without needing to verify their email.
Email Verified = False
Email Verified = False
- If email service is configured: User receives a verification email
- If email service is NOT configured: Set
ALLOW_UNVERIFIED_EMAIL_LOGIN=truein your.envfile, or the user must attempt login to receive a verification link
Invite User
Send an invitation email to a new user. Requires email service to be configured.Usage
Example
The invitation email includes a registration link with a secure token that expires after a set period.
List Users
Display all registered users in the system.Usage
Output
The command displays:- Email address
- Username
- Name
- Account status (active/banned)
- Email verification status
- Registration date
Ban User
Ban or unban a user account. Banned users cannot log in.Usage
Interactive Mode
- Email: User’s email address
- Ban: Whether to ban (true) or unban (false)
Examples
Banned users retain all their data (conversations, files, etc.) but cannot access the system.
Delete User
Permanently delete a user account and all associated data.Usage
Interactive Mode
Confirmation
The script will:- Display the user’s information
- Ask for confirmation before proceeding
- Show a summary of deleted data
Reset Password
Reset a user’s password to a new value or auto-generate one.Usage
Interactive Mode
- Email: User’s email address
- New Password: Leave blank to auto-generate
Examples
User Statistics
View statistics about a specific user’s usage.Usage
Displayed Information
- Total conversations
- Total messages sent
- Total tokens used
- Files uploaded
- Agents created
- Prompts created
- Account creation date
- Last login
Best Practices
Use Interactive Mode for Sensitive Data
Avoid passing passwords or sensitive information as command-line arguments. Use interactive mode instead for better security.
Verify Before Deleting
Always verify user information before deletion. Consider banning instead of deleting to preserve data.
Document Admin Actions
Keep a log of administrative actions, especially user deletions and bans, for audit purposes.
Troubleshooting
Error: No user with that email was found
Error: No user with that email was found
- Verify the email address spelling
- Check if the user was previously deleted
- Use
npm run list-usersto see all registered users
Error: Invalid email address
Error: Invalid email address
The email must contain an
@ symbol and be in a valid format.Script hangs or doesn't respond
Script hangs or doesn't respond
- Ensure MongoDB is running and accessible
- Check your
MONGO_URIin.env - Verify network connectivity to the database
Cannot send invitation emails
Cannot send invitation emails
- Verify email service is configured in
.env - Check
EMAIL_SERVICE,EMAIL_USERNAME,EMAIL_PASSWORD - Test SMTP connection settings
Related Commands
See also:- Token Management - Manage user token balances
- Roles & Permissions - Configure user roles and access control
- Monitoring - Monitor user activity and system health