nifty_fifty_bank_nifty_NodeJS/scripts/createAdminUser.ts
Purpose
Creates a single admin user in MongoDB if one does not already exist with the configured email.Default credentials
Read from environment:
User document fields:
role: 'admin'isActive: trueisMfaEnabled: false
Run
Fromnifty_fifty_bank_nifty_NodeJS:
package.json.
Prerequisites
- MongoDB running at
MONGO_URI .envloaded withMONGO_URI,ADMIN_EMAIL,ADMIN_PASSWORD
Behavior
- Connect to MongoDB
- If email exists → abort with error
- Else
UserModel.create(adminUser) - Log email and remind to change password
- Disconnect and exit
After creation
- Set
VITE_APP_EMAIL/ password for dev login (optional) - Log in at
/login - Change password via profile or admin edit
- Enable MFA for production admins