A modern, modular, and secure content moderation platform built with React, featuring intelligent AI detection combined with human moderator oversight.
- AI-Powered Detection: ML models detect violations across text, images, and user behavior
- Human-in-the-Loop: Moderators review AI decisions with full context and can override when needed
- Comprehensive Coverage: Handle hate speech, spam, harassment, dangerous content, CSAM detection
- Real-Time Monitoring: Live case queues and instant notifications
- Complete Audit Trail: Every decision logged with full context for compliance
- Role-Based Access Control: Admin, Moderator, Viewer roles with appropriate permissions
- Secure by Default: Input sanitization, CSRF protection, encrypted API client
- Enterprise Security: RBAC, audit logging, API-ready authentication
The application is built with a modern modular architecture:
src/
βββ components/ # Reusable UI components
βββ pages/ # Page-level components (Landing, Dashboard)
βββ contexts/ # React Context API for global state
βββ hooks/ # Custom React hooks
βββ utils/ # Security, validation, and utility functions
βββ services/ # API client and service layer
βββ constants/ # Navigation tree, roles, and constants
βββ mock/ # Mock data for development
- Node.js 18+
- npm or yarn
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run previewThe app will be available at http://localhost:3000
Any user can access the dashboard. The app is pre-configured with a test moderator account:
- Name: Anya K.
- Role: MODERATOR
- Permissions: All moderation actions except policy/threshold editing
- Landing (
src/pages/Landing.jsx) - Premium marketing landing page - Dashboard (
src/pages/Dashboard.jsx) - Main moderation interface
Icon- SVG icon system with 30+ iconsBadge- Status/category badges with variantsButton- CTA buttons with multiple stylesCard- Card wrapper componentToast- Toast notification systemSectionHeader- Section titles with countsConfidenceBar- Animated progress indicatorsStatCard- Metric display cards
- Queue components for text, media, and age-sensitive content
- Moderation management (flagged users, automated actions)
- Analytics (system metrics, moderator performance)
- Transparency (audit logs, decision comparison)
- Policy management and threshold configuration
Manages user authentication and role-based permissions:
{
user: { id, name, email, role, avatar },
isAuthenticated: boolean,
hasPermission: (permission) => boolean,
canPerformAction: (action) => boolean,
login: (credentials) => void,
logout: () => void
}Manages toast notifications:
{
addToast: (message, type, duration) => string,
removeToast: (id) => void,
}Manages dashboard UI state:
{
activePage: string,
expandedGroups: string[],
expandedSections: string[],
filters: object,
toggleGroup: (group) => void,
toggleSection: (section) => void,
}useAuth()- Access authentication contextuseToast()- Show notifications (success, error, warning, info)useDashboard()- Access dashboard stateuseLocalStorage(key, defaultValue)- Persistent component state
- DOMPurify integration for XSS prevention
- Input length limiting
- HTML content sanitization
- Case ID and username validation
// Check if user can perform action
canPerformAction(userRole, 'ban:user')
// Get all actions for a role
getActionsForRole('MODERATOR')
// Check role hierarchy
isAdmin(role)
outranks(userRole, targetRole)- Automatic token injection
- CSRF token support
- Request timeout handling
- 401 error handling for re-authentication
- Built-in error messages
Defines sidebar navigation hierarchy with icons and page IDs
Development data for:
- Text queue cases
- Media queue items
- Age-sensitive content
- Flagged users
- Automated actions
- Dismissed reports
- Audit logs
- Performance metrics
β Input Validation
- Validate case IDs, usernames, emails
- Reject special characters
- Length limiting and trimming
β Content Sanitization
- DOMPurify integration
- HTML escaping
- Safe DOM rendering
β Authentication & Authorization
- Role-based access control (3 roles)
- Conditional component rendering
- Protected routes
β API Security
- JWT token injection ready
- CSRF token support
- Secure fetch wrapper
- Automatic error handling
β Audit Logging
- Complete action audit trail
- Moderator tracking
- Timestamp logging
Built with Tailwind CSS for utility-first styling:
- Dark theme with custom color palette
- Responsive design (mobile-first)
- Smooth animations with Framer Motion
- Premium, professional appearance
Core dependencies:
- React 18.3.0 - UI library
- React Router 6.20.0 - Client-side routing
- Framer Motion 10.16.0 - Animation library
- Tailwind CSS 3.3.0 - Utility-first CSS
- DOMPurify 3.0.0 - XSS prevention
- Prop Types 15.8.1 - Runtime type checking
Dev dependencies:
- Vite 5.0.0 - Build tool
- @vitejs/plugin-react - React support for Vite
/ β Landing page (public)
/dashboard β Main moderation dashboard (protected)
/dashboard/... β Various moderation pages
To connect to a real backend:
-
Update API Client (
src/utils/api.js)- Change
API_BASEto your backend URL - Implement token refresh logic
- Change
-
Replace Mock Data
- Update data fetching in components
- Call API endpoints instead of mock data
-
Implement Authentication
- Connect login endpoint
- Store JWT in secure cookie
- Handle token refresh
-
Enable WebSockets
- Real-time case updates
- Live notifications
- Chat/comment feeds
- Review flagged text content
- See AI confidence scores and severity ratings
- Expand rows to view full content and moderator actions
- Lock rows to prevent accidental clicks
- Review flagged images
- See CSAM risk assessments
- Quick approve/remove/escalate actions
- Review flagged user accounts
- See report counts and violation patterns
- Quick ban actions
- Complete history of all moderation actions
- Filter by action type, moderator, date
- Compliance and review purposes
- System metrics and violation distribution
- Moderator performance tracking
- Trend analysis
- Define and manage moderation policies
- Set confidence/severity thresholds
- Escalation rules
- Fast Development: Vite's instant HMR
- Optimized Production Build: Tree-shaking, minification
- Code Splitting: Lazy-loaded routes
- Animation Performance: GPU-accelerated with Framer Motion
- Responsive: Mobile-first, optimized for all devices
- Create component in appropriate folder
- Add to
navTree.jsif it's a navigation item - Map to page in Dashboard
pageMap - Use hooks for state management
- Update
src/utils/permissions.jswith new action - Add permission check to
actionPermissionsobject - Use
canPerformAction()in components
- Create in
src/components/common/ - Add PropTypes for type checking
- Use as building blocks in page components
Proprietary - GuardLayer Platform
For issues, feature requests, or questions, contact: support@guardlayer.com