Skip to main content

Overview

The Admin Dashboard provides comprehensive control over the Studley AI platform, including user management, content moderation, notifications, and system monitoring.

Accessing the Admin Dashboard

Admin access is restricted to authorized accounts only. Regular users cannot access admin features.

Admin Account Setup

Admin accounts are created directly in the database. To create an admin user:
-- First, create the user in Supabase Auth dashboard or via CLI
-- Then grant admin privileges:
UPDATE user_profiles
SET is_admin = true
WHERE id IN (
  SELECT id FROM auth.users WHERE email = '[email protected]'
);

Admin Authentication

Admin users authenticate through the same login system as regular users, but gain access to additional admin-only routes and features. Default Admin Credentials (from migration 012_create_admin_user.sql):
Change the default admin credentials immediately after initial setup for security.

Dashboard Sections

The admin dashboard is organized into several key sections:

Notifications Tab

Create and manage platform-wide announcements that appear to all users.
  • Create new notifications with title and message
  • Set optional expiration dates
  • Toggle notifications on/off
  • Monitor active notifications
See Admin Notifications for detailed documentation.

Content Moderation

Monitor and manage inappropriate content attempts.
  • View flagged quiz topics
  • Track user violations
  • Review moderation history
See Content Moderation for detailed documentation.

User Management

Access user accounts and activity data.
  • View all registered users
  • Monitor user activity
  • Manage user credits
  • Track generation history
See User Management for detailed documentation.

Error Code Reference

Access a comprehensive list of all system error codes.
  • Browse errors by category (Generation, Content, Network, Database)
  • Test error displays
  • Help diagnose user-reported issues

Access Control

Row Level Security (RLS)

Admin operations are protected by RLS policies that check admin status:
-- Example admin policy from admin_config table
CREATE POLICY "Admins can manage admin config" 
ON public.admin_config 
FOR ALL 
USING (true) 
WITH CHECK (true);
RLS policies ensure that only authenticated admin users can modify platform configuration and access sensitive data.

Admin-Only Tables

The following tables are restricted to admin access:
  • admin_config - Site configuration settings
  • admin_notifications - Platform announcements
  • bug_reports - User-submitted bug reports
  • user_feedback - User feedback submissions

Configuration Management

Admins can modify site-wide configuration stored in the admin_config table:
interface AdminConfig {
  id: string
  config_key: string
  config_value: object // JSONB data
  updated_by: string
  updated_at: timestamp
  created_at: timestamp
}
Common Configuration Keys:
  • Site settings (announcements, banners, FAQ)
  • Feature flags
  • Rate limiting rules
  • Maintenance mode status

Monitoring Features

Rate Limiting

Track generation rate limits via the generation_rate_limits table:
  • Monitor request frequency by identifier
  • Identify potential abuse
  • Adjust rate limiting rules

Credit Usage

Monitor platform-wide credit usage:
  • Total credits consumed
  • Per-user credit history
  • Credit transaction logs

Generation Analytics

Track all AI generations across the platform:
  • Quiz generations
  • Flashcard generations
  • Study guide generations
  • Writing prompt generations
  • AI workspace sessions

Security Best Practices

Critical Security Considerations:
  • Never share admin credentials
  • Use strong, unique passwords
  • Enable 2FA if available
  • Regularly audit admin activity logs
  • Review RLS policies periodically
  • Limit admin account creation

Environment Variables

Ensure these environment variables are properly secured:
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key  # Most sensitive!
BLOB_READ_WRITE_TOKEN=your-blob-token
Never commit the SUPABASE_SERVICE_ROLE_KEY to version control. This key bypasses all RLS policies.

Admin Components

The following React components power the admin dashboard:
  • admin-notifications.tsx - Notification management UI
  • admin-inappropriate-monitor.tsx - Content moderation interface
  • admin-error-codes.tsx - Error code reference viewer
  • admin-quiz-monitor.tsx - Quiz activity monitoring
  • admin-team-manager.tsx - Team member management

Next Steps

Admin Notifications

Learn how to create and manage platform-wide announcements

User Management

Manage user accounts and monitor activity

Content Moderation

Review and moderate inappropriate content

Database Schema

Explore the complete database structure

Build docs developers (and LLMs) love