A secure, AI-powered mock test platform with comprehensive anti-cheat features built with Next.js 16, React 19, TypeScript, and LangChain.
- Dynamic question generation using Groq LLM (Llama 3.1 8B)
- Career-specific questions tailored to selected path
- 10 questions total: 4 Beginner → 3 Intermediate → 3 Advanced
- Dynamic timer: 30s (Beginner), 45s (Intermediate), 60s (Advanced)
- Unique questions every time - Session-based generation with seed variation
- Web-enhanced context via Tavily API
- Fullscreen Enforcement - Auto-enters fullscreen, 2 exit attempts = auto-submit
- Tab Switching Prevention - Detects tab changes, immediate auto-submit
- Back Navigation Blocking - Prevents browser back button during quiz
- Career Path Watermark - Multi-layer background watermark
- Cursor Confinement - Restricts cursor to test area
- Screenshot Detection - Detects PrintScreen, Snipping Tool, etc.
- Clipboard Monitoring - Blocks copy/paste, periodic clearing
- Browser Lockdown - Disables DevTools, right-click, shortcuts, F5 refresh
- Safe Exam Browser - Optional SEB requirement
- Mouse Tracking - Monitors inactivity and edge camping
- Multiple Tab Prevention - BroadcastChannel detection
- Beautiful gradient backgrounds
- Smooth animations with Framer Motion
- Responsive design (mobile-friendly)
- Real-time timer and progress tracking
- Detailed results page with question review
- Node.js 18+ or Bun
- pnpm (recommended)
# Install dependencies
pnpm install
# Set up environment variables
# Create .env.local file and add:
GROQ_API_KEY=your_groq_api_key
TAVILY_API_KEY=your_tavily_api_key # Optional
# Run development server
pnpm dev- Visit console.groq.com
- Sign up (free)
- Create API key
- Add to
.env.local:GROQ_API_KEY=gsk_your_key_here
- Visit tavily.com
- Get API key
- Add to
.env.local:TAVILY_API_KEY=tvly_your_key_here
├── app/
│ ├── api/
│ │ ├── generate-questions/ # Question generation endpoint
│ │ └── proctor/events/ # Proctoring event logging
│ ├── quiz/ # Quiz page
│ └── results/ # Results page
├── components/
│ ├── Watermark.tsx # Background watermark
│ └── SEBBlockScreen.tsx # SEB requirement screen
├── hooks/
│ └── useProctoring.ts # Proctoring integration hook
├── lib/
│ ├── store.ts # Zustand state management
│ ├── proctoring.ts # Proctoring utilities
│ ├── questionPipeline.ts # LLM question generation
│ └── searchService.ts # Web search integration
└── .env.local # Environment variables (create this)
- Select Career Path - Choose from available career options
- Start Quiz - Enters fullscreen automatically
- Answer Questions - 10 questions with progressive difficulty
- View Results - Detailed score and question review
- Fullscreen required throughout
- Timed questions (30s/45s/60s based on difficulty)
- No tab switching allowed (immediate auto-submit)
- No back navigation allowed during quiz
- Copy/paste disabled
- Browser refresh blocked
- 2 violation attempts before auto-submit (for most violations)
- Framework: Next.js 16 (App Router)
- UI: React 19, Tailwind CSS 4, Framer Motion
- State: Zustand
- AI: LangChain, Groq (Llama 3.1 8B)
- Search: Tavily API
- Icons: Lucide React
- Language: TypeScript
// lib/store.ts - Default config
proctorConfig: {
requireSEB: false,
enableWatermark: true,
enableScreenshotDetection: true,
enableClipboardMonitoring: true,
enableMouseTracking: true,
enableMultiTabPrevention: true,
}Customize via setProctorConfig() in your code.
# Build for production
pnpm build
# Run production server
pnpm start
# Lint code
pnpm lintAll anti-cheat measures acknowledge browser security restrictions:
- Cannot fully prevent screenshots (browser limitation)
- Cannot guarantee clipboard clearing (requires permissions)
- Cannot force SEB usage (user can modify user agent)
- Cannot prevent all DevTools access (browser menus remain)
- Visual deterrents (watermark)
- Audit trail (event logging)
- Behavior monitoring (pattern detection)
- Automatic enforcement (auto-submit on violations)
| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
✅ Yes | Groq LLM API key for question generation |
TAVILY_API_KEY |
Web search API for enhanced context |
- Check
GROQ_API_KEYis set in.env.local - Restart dev server after adding keys
- Check browser console for errors
- Browser must support Fullscreen API
- User must interact with page first (security requirement)
- Check
proctorConfig.enableWatermarkistrue - Verify career path is selected
MIT License - Use at your own risk. Best-effort security only.
Contributions welcome! Please ensure:
- TypeScript types are correct
- Code follows existing patterns
- Security features maintain best-effort approach
For issues or questions, please check:
- This README
- Browser console for errors
- Terminal for API errors
- Environment variables are set correctly
Built with ❤️ using Next.js 16 + React 19 + TypeScript