A modern React-based frontend for the AI-powered assessment platform Exam Genius (CADNA). Built with React, Vite, and Tailwind CSS with comprehensive authentication, exam management, and real-time features.
- Registration Flow: 3-step process (Role Selection β Account Details β Personal Info β Security)
- Login System: Email/password with 2FA support
- Role-based Access: Student and Admin dashboards with protected routes
- JWT Authentication: Token-based auth with refresh mechanism
- Session Management: Persistent login with localStorage
- Exam Flow: Overview β Webcam Check β Taking β Review β Results
- Real-time Answer Syncing: Automatic save every 30 seconds + immediate sync
- Session Recovery: Resume interrupted exams automatically
- Timer Management: Countdown with auto-submit on timeout
- Question Navigation: Previous/Next with progress tracking
- Answer Flagging: Mark questions for review
- Dark Mode: Global theme with localStorage persistence
- Responsive Design: Mobile-first approach (320px+)
- Loading States: Comprehensive loading indicators
- Error Boundaries: Graceful error handling
- Progress Indicators: Visual feedback for multi-step processes
- Input Validation: XSS prevention and sanitization
- CSRF Protection: X-Requested-With headers
- SSRF Prevention: Endpoint whitelist validation
- Secure Storage: Encrypted token management
- Error Handling: Secure error messages without data exposure
- Frontend: React 19, Vite
- Styling: Tailwind CSS
- Routing: React Router DOM v6
- Icons: React Icons
- HTTP Client: Custom fetch wrapper with retry logic
- State Management: React Context API
src/
βββ components/ # Reusable UI components
β βββ Layout/ # Header, Sidebar, Navigation
β βββ UI/ # Buttons, Loading, Forms
βββ context/ # Global state management
β βββ AuthContext.jsx # Authentication state
β βββ ThemeContext.jsx # Dark mode state
βββ pages/ # Route components
β βββ auth/ # Login, Register, 2FA
β βββ dashboards/ # Student/Admin dashboards
β βββ exam/ # Exam flow components
β βββ registration/ # Multi-step registration
βββ services/ # API service layer
βββ config/ # Configuration files
βββ utils/ # Helper functions
- Authentication System - Fully functional with 2FA
- Registration Flow - 3-step process with validation
- Dashboard System - Role-based with real data
- Exam Taking Flow - Complete exam experience
- Dark Mode - Global theme system
- Responsive Design - Mobile/tablet/desktop support
- Real-time Syncing - Answer persistence and recovery
- Security Measures - XSS, CSRF, SSRF protection
- Result System - Backend integration pending
- Exam Analytics - Performance metrics
- Notification System - Real-time updates
Issue: Backend route /api/results/:examId returns "Route not found"
Current Workaround: localStorage fallback with mock data
Location: src/pages/exam/ExamResult.jsx
Fix Needed: Backend route implementation
Issue: Session recovery fails when sessions.data is not an array
Current Fix: Added array validation and error handling
Location: src/pages/exam/ExamTaking.jsx:26-43
Status: Resolved with fallback logic
Issue: Input field icons misaligned on different screen sizes
Current Fix: Responsive positioning classes (top-8 sm:top-9 lg:top-11)
Location: Registration forms
Status: Resolved but needs testing on more devices
Issue: Timer doesn't sync across browser tabs Current State: Single-tab timer with localStorage start time Enhancement Needed: Cross-tab synchronization
Issue: Some components lack error boundary protection Current State: Basic error handling in place Enhancement Needed: Comprehensive error boundary wrapper
-
API Route Missing:
/api/results/:examIdendpoint not implemented- Impact: Result page shows fallback data
- Workaround: localStorage mock data
- Priority: High
-
Session ID Validation: Occasional missing sessionId during submission
- Impact: Exam submission creates mock results
- Workaround: Session recovery + mock result generation
- Priority: Medium
- Console Logs: Extensive logging for session management
- Error Tracking: All API failures logged with context
- Fallback Systems: Multiple layers of graceful degradation
POST /api/auth/login- User authenticationPOST /api/auth/register- User registrationGET /api/auth/me- User profileGET /api/exams- Exam listingGET /api/exams/:id- Exam detailsPOST /api/exams/:id/start- Start exam sessionPOST /api/exam-sessions/:id/answer- Submit answersPOST /api/exam-sessions/:id/submit- Submit exam
GET /api/results/:examId- Get exam resultsGET /api/exam-sessions/user/:examId- User sessionsPOST /api/exam-sessions/:id/sync- Bulk answer sync
- Node.js (v16+)
- npm or yarn
# Clone repository
git clone <repository-url>
cd Exam-Genius-CADNA
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Start development server
npm run devVITE_API_URL=https://cadna-backend.onrender.com
VITE_TEST_STUDENT_EMAIL=[email protected]
VITE_TEST_STUDENT_PASSWORD=password123- Registration flow (all 3 steps)
- Login with/without 2FA
- Dashboard navigation
- Exam taking flow
- Dark mode toggle
- Mobile responsiveness
- Session recovery
- Answer persistence
- β Chrome 90+
- β Firefox 88+
- β Safari 14+
- β Edge 90+
- Mobile: 320px - 640px
- Tablet: 641px - 1024px
- Desktop: 1025px+
- Touch-friendly buttons (44px minimum)
- Swipe navigation for exam questions
- Collapsible sidebar navigation
- Optimized form layouts
- Email regex with ReDoS protection
- Password strength requirements
- Token format validation
- XSS prevention in all inputs
- CSRF protection headers
- Endpoint whitelist validation
- Secure error handling
- Token expiration management
npm run build # Production build
npm run preview # Preview build locally- Development: Local API server
- Staging: Staging backend URL
- Production: Production backend URL
- Code splitting by route
- Lazy loading for heavy components
- Image optimization
- Bundle size optimization
- Efficient re-renders with React.memo
- First Contentful Paint: < 1.5s
- Largest Contentful Paint: < 2.5s
- Bundle Size: < 500KB gzipped
- ESLint configuration enforced
- Prettier for code formatting
- Conventional commit messages
- Component documentation required
- Create feature branch
- Implement changes with tests
- Update documentation
- Submit PR with detailed description
- β Core authentication
- β Exam taking system
- β Basic dashboard
- Advanced analytics
- Real-time notifications
- Offline support
- Performance monitoring
- Mobile app
- Advanced proctoring
- AI-powered insights
- Multi-language support
When reporting bugs, please include:
- Browser and version
- Steps to reproduce
- Expected vs actual behavior
- Console errors (if any)
- Screenshots (if applicable)
For technical support or questions:
- Create an issue in the repository
- Include relevant error logs
- Provide reproduction steps
- Tag with appropriate labels
Last Updated: January 2024 Version: 1.0.0 Status: Active Development