Admin Feature
Location: /dashboard/admin/settings
Access: Admin role required
The Platform Settings page allows administrators to configure core system settings across four categories:
- General - Site information and global settings
- Email - SMTP and email notification configuration
- Payment - Payment processor and transaction settings
- Enrollment - Course enrollment rules and policies
All settings are stored in the system_settings database table and can be updated in real-time.
- Log in as an admin user
- Navigate to Admin Dashboard (
/dashboard/admin) - Click "Settings" in the Quick Actions section
- Or visit directly:
/dashboard/admin/settings
Setting Key: site_name
Type: Text
Default: "LMS V2"
The name of your platform displayed across the site (header, emails, etc.)
Example: "Acme Learning Academy"
Setting Key: site_description
Type: Text
Default: "A modern learning management system"
Brief description used for SEO meta tags and about pages.
Example: "Professional development courses for tech leaders"
Setting Key: contact_email
Type: Email
Default: "contact@example.com"
Main contact email displayed in footer and contact pages.
Setting Key: support_email
Type: Email
Default: "support@example.com"
Email address for user support inquiries.
Setting Key: timezone
Type: Text (IANA timezone)
Default: "America/New_York"
Default timezone for the platform. Uses IANA timezone identifiers.
Examples:
America/New_YorkEurope/LondonAsia/TokyoAustralia/Sydney
Find your timezone: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
Setting Key: maintenance_mode
Type: Object { enabled: boolean, message: string }
Default: { enabled: false, message: "" }
Enable to show a maintenance page to users. Admins can still access the site.
Maintenance Message: Custom message displayed to users during maintenance.
Setting Key: email_notifications
Type: Object { enabled: boolean }
Default: { enabled: true }
Master switch for all email notifications. When disabled, no emails are sent.
Setting Key: smtp_host
Type: Text
Default: "" (empty)
Your email provider's SMTP server address.
Examples:
- Gmail:
smtp.gmail.com - Outlook:
smtp.office365.com - SendGrid:
smtp.sendgrid.net - Mailgun:
smtp.mailgun.org
Setting Key: smtp_port
Type: Number
Default: 587
SMTP server port number.
Common Ports:
587- TLS (recommended)465- SSL25- Unencrypted (not recommended)
Setting Key: smtp_username
Type: Text
Default: "" (empty)
SMTP authentication username, usually your email address or account username.
Setting Key: smtp_password
Type: Text (sensitive)
Default: "" (empty)
SMTP authentication password or app-specific password.
Note: For Gmail, use an App Password, not your regular password.
Setting Key: smtp_from_email
Type: Email
Default: "noreply@example.com"
Email address used as the sender for outgoing emails.
Setting Key: smtp_from_name
Type: Text
Default: "LMS V2"
Display name shown as the sender in email clients.
Example: "Acme Learning Academy"
Setting Key: stripe_enabled
Type: Object { enabled: boolean }
Default: { enabled: true }
Enable Stripe payment processing. Requires Stripe API keys in environment variables.
Setting Key: paypal_enabled
Type: Object { enabled: boolean }
Default: { enabled: false }
Enable PayPal payment processing. (Feature not yet implemented)
Setting Key: currency
Type: Text (ISO 4217)
Default: "USD"
Default currency for all transactions.
Available Currencies:
- USD - US Dollar
- EUR - Euro
- GBP - British Pound
- CAD - Canadian Dollar
- AUD - Australian Dollar
- JPY - Japanese Yen
- INR - Indian Rupee
- MXN - Mexican Peso
Setting Key: tax_rate
Type: Number (percentage)
Default: 0
Default tax rate percentage applied to transactions.
Example: Enter 8.5 for 8.5% tax rate. Enter 0 for no tax.
Setting Key: invoice_prefix
Type: Text
Default: "INV"
Prefix for invoice numbers.
Example: "INV" generates invoices like INV-001, INV-002, etc.
Setting Key: require_payment_approval
Type: Object { enabled: boolean }
Default: { enabled: false }
When enabled, payments require admin approval before processing.
Setting Key: auto_enrollment
Type: Object { enabled: boolean }
Default: { enabled: false }
Automatically enroll new users in designated courses upon registration.
Note: Configure which courses in the course settings.
Setting Key: allow_self_enrollment
Type: Object { enabled: boolean }
Default: { enabled: true }
Allow students to enroll themselves in courses without admin intervention.
When disabled, all enrollments require manual admin approval.
Setting Key: require_enrollment_approval
Type: Object { enabled: boolean }
Default: { enabled: false }
Require admin approval before students can access enrolled courses.
Setting Key: max_enrollments_per_user
Type: Number
Default: 0
Maximum number of courses a user can enroll in.
Example: Set to 5 to limit users to 5 courses. Set to 0 for unlimited.
Setting Key: enrollment_expiration_days
Type: Number
Default: 365
Number of days until enrollment expires and user loses access.
Example: 365 = 1 year, 180 = 6 months. Set to 0 for never expires.
Setting Key: course_capacity_enabled
Type: Object { enabled: boolean }
Default: { enabled: false }
Allow setting maximum student limits for individual courses.
When enabled, courses can specify a capacity limit in course settings.
import { getSettings } from '@/app/actions/admin/settings'
// Get all settings in a category
const result = await getSettings('general')
if (result.success && result.data) {
const siteName = result.data.site_name.value
console.log(siteName) // "LMS V2"
}
// Get all settings grouped by category
const result = await getAllSettingsByCategory()
if (result.success && result.data) {
const emailSettings = result.data.email
const smtpHost = emailSettings.smtp_host.value.value
}import { getSetting } from '@/app/actions/admin/settings'
const result = await getSetting('site_name')
if (result.success && result.data) {
const siteName = result.data.value
}import { updateSetting } from '@/app/actions/admin/settings'
const result = await updateSetting('site_name', { value: 'New Name' })
if (result.success) {
console.log('Setting updated!')
}import { updateSettings } from '@/app/actions/admin/settings'
const result = await updateSettings({
site_name: { value: 'New Name' },
contact_email: { value: 'new@example.com' }
})import { resetSetting } from '@/app/actions/admin/settings'
const result = await resetSetting('site_name')
// Resets to "LMS V2"- Use a dedicated email service like SendGrid, Mailgun, or AWS SES for reliability
- Enable email notifications only after testing SMTP configuration
- Use app-specific passwords for Gmail/Outlook instead of account passwords
- Test email delivery after configuration changes
- Start with test mode in Stripe before going live
- Set appropriate tax rates for your jurisdiction
- Configure webhook endpoints in Stripe dashboard
- Monitor payment approval queue if enabled
- Consider your business model when setting enrollment policies
- Test approval workflows before enabling them
- Set reasonable capacity limits to avoid overbooking
- Communicate policies clearly to students
- Announce maintenance ahead of time via notifications
- Set a clear message with expected duration
- Disable during business hours if possible
- Test the message before enabling
- Check admin role: Only admins can modify settings
- Check database connection: Ensure Supabase is accessible
- Check browser console: Look for JavaScript errors
- Check RLS policies: Ensure admin policies are in place
- Verify SMTP credentials: Incorrect username/password
- Check SMTP port: Use 587 for TLS, 465 for SSL
- Check firewall: Ensure outbound SMTP traffic is allowed
- Enable email notifications: Master switch must be on
- Test with telnet:
telnet smtp.example.com 587
- Check database migration: Ensure
system_settingstable exists - Check default data: Default settings should be seeded
- Check server logs: Look for errors in Next.js console
- Clear browser cache: Force reload with Cmd+Shift+R
- SMTP passwords are stored in JSONB as plain text
- For production: Consider implementing encryption at rest
- Alternative: Store SMTP credentials in environment variables
- Only users with 'admin' role can access settings
- All settings operations require admin verification
- RLS policies enforce database-level security
- SMTP password field has visibility toggle
- Consider masking sensitive values in logs
- Audit all settings changes
Q: Can teachers access settings?
A: No, only users with the 'admin' role can view and modify settings.
Q: Are settings cached?
A: Settings are fetched from the database on each page load. Consider implementing caching for production.
Q: How do I backup settings?
A: Settings are stored in the system_settings table. Include this table in your database backups.
Q: Can I add custom settings?
A: Yes, insert new rows into system_settings with a unique setting_key and appropriate category.
Q: What happens if I break something?
A: Use the reset functionality to restore default values, or restore from database backup.
Q: How do I test email settings?
A: Implement a "Send Test Email" button (feature not yet implemented).
Last Updated: February 14, 2026
Version: 1.0