This implementation provides a secure, role-based management dashboard for the LNMB project at /manage. The old /admin route now redirects to /manage.
npx convex devThis deploys the authentication system and database schema to Convex.
npx convex run auth:createUser \
--name "Your Name" \
--email "admin@lnmb.org" \
--password "YourSecurePassword123!" \
--role "admin"Important:
- Use a strong password
- Remember your credentials
- Change password after first login
- Navigate to:
http://localhost:3000/manage/login(or your domain) - Enter your email and password
- Click "Login"
- You'll be redirected to the dashboard at
/manage
- ✅ Full access to all features
- ✅ View Dashboard, Orders, Payments
- ✅ Manage Team, Highlights, Products
- ✅ Create new users
- ✅ View Dashboard, Orders, Payments
- ❌ Cannot manage Team, Highlights, or Products
- ❌ Cannot create users
npx convex run auth:createUser \
--name "Director Name" \
--email "director@lnmb.org" \
--password "SecurePassword123!" \
--role "director"npx convex run auth:createUser \
--name "Admin Name" \
--email "admin2@lnmb.org" \
--password "SecurePassword123!" \
--role "admin"- View key metrics (orders, payments, revenue)
- Recent activity feed
- Statistics overview
- View all orders in real-time
- Filter and search orders
- See payment status
- Customer details
- Track all payments
- Payment status (paid, pending, failed)
- Transaction IDs
- Amount and currency
- Admin sees all tabs
- Director sees limited tabs
- Automatic UI adaptation
- ✅ Password hashing
- ✅ Session tokens (7-day expiration)
- ✅ Role-based access control
- ✅ Protected API endpoints
- ✅ Auto-logout on expired sessions
Detailed documentation available:
- docs/MANAGE_SETUP.md - Complete setup guide with troubleshooting
- docs/AUTH.md - Technical authentication documentation
- IMPLEMENTATION_SUMMARY.md - Full implementation details
- Check Convex deployment is running:
npx convex dev - Verify user exists in Convex dashboard
- Check console for error messages
- Ensure
NEXT_PUBLIC_CONVEX_URLis set
- Sessions expire after 7 days
- Simply log in again with your credentials
Currently, contact an admin to create a new user or reset password manually in Convex dashboard.
Run the test suite:
pnpm run testAll 20 authentication tests should pass:
- ✅ User creation
- ✅ Login/logout
- ✅ Session management
- ✅ Role-based access
/manage- Management dashboard (requires login)/manage/login- Login page/admin- Redirects to/manage
users- User accounts with rolessessions- Active login sessions
These now require authentication:
api.orders.getAllOrdersapi.orders.getAllPaymentsapi.orders.getOrderStats
Before deploying to production:
- Change all default passwords
- Set strong password requirements
- Enable HTTPS (automatic on Vercel)
- Review security recommendations in
docs/AUTH.md - Consider upgrading to bcrypt for password hashing
- Set up monitoring and alerts
- Test all roles thoroughly
- Create backup admin account
- Use Strong Passwords: Minimum 12 characters, mix of letters, numbers, symbols
- Regular Backups: Export user list from Convex dashboard
- Monitor Activity: Check login patterns regularly
- Update Regularly: Keep dependencies up to date
- Test Before Production: Thoroughly test in development
- Check the troubleshooting section above
- Review documentation in
docs/folder - Check Convex logs in dashboard
- Look at browser console for errors
- Review test files for usage examples
Your management dashboard is now set up and secured with role-based authentication. Users can access it at /manage after logging in.
Next Steps:
- Create user accounts for your team
- Test different roles (admin vs director)
- Customize the dashboard as needed
- Review security recommendations
# Deploy backend
npx convex dev
# Create admin user
npx convex run auth:createUser --name "Name" --email "email@domain.com" --password "pass" --role "admin"
# Create director user
npx convex run auth:createUser --name "Name" --email "email@domain.com" --password "pass" --role "director"
# Run tests
pnpm run test
# Check types
npx tsc --noEmit
# Lint code
pnpm run lintNote: This implementation follows the Convex Labs documentation for authentication and provides a solid foundation for secure admin access. For production use, review the security recommendations in docs/AUTH.md.