A complete Multiple Choice Question testing system designed for TECH BOARD 2025 Selection Test, optimized for deployment on Render.com.
- Student Registration & Authentication - Secure student registration with roll number validation
- Grade-based Quiz System - Supports grades 6, 7, 8, 9, and 11
- Timed Quizzes - 30-minute timer with automatic submission
- Real-time Scoring - Instant results after quiz completion
- Admin Panel - Question management and student monitoring
- Responsive Design - Works on desktop and mobile devices
- Modern UI - Built with React, TypeScript, and Tailwind CSS
This application is specifically configured for Render.com deployment.
-
Fork this repository to your GitHub account
-
Create a new Web Service on Render.com:
- Connect your GitHub repository
- Build Command:
npm run build
- Start Command:
npm start
- Environment: Node
-
Set Environment Variables in Render dashboard:
NODE_ENV=production PORT=10000 JWT_SECRET=your-secure-jwt-secret ADMIN_USERNAME=admin ADMIN_PASSWORD=admin123 CORS_ORIGINS=https://your-app-name.onrender.com
-
Add Persistent Disk for database:
- Mount Path:
/opt/render/project/src/database
- Size: 1GB
- Mount Path:
-
Deploy - Your app will be available at
https://your-app-name.onrender.com
For detailed deployment instructions, see RENDER_DEPLOYMENT.md
# 1. Clone the repository
git clone https://github.com/Heoster/tech-board-2025-selection-test.git
cd tech-board-2025-selection-test
# 2. Install dependencies
npm install
cd server && npm install
cd ../client && npm install
# 3. Seed the database with 250+ questions per grade
cd ../server && npm run seed:250
# 4. Start the development servers
cd .. && start-dev.bat # Windows
# OR manually:
# Terminal 1: cd server && npm start
# Terminal 2: cd client && npm run dev
# 5. Access the application
# Frontend: http://localhost:5173
# Backend: http://localhost:8000
- Admin: username:
admin
, password:admin123
- Test Student: Roll:
1
, Grade:8
, Section:A
, Password:student123
This system implements a 7-layer duplicate prevention system that absolutely guarantees no question repetition in any test:
- π No question repeats within any single quiz (25 unique questions always)
- π No question repeats across multiple quizzes for the same student
- π Database-level protection even if application logic fails
- π Real-time monitoring of any potential violations
- Total Questions: 1,250+ questions across all grades
- Per Grade: 250+ questions each (Grades 6, 7, 8, 9, 11)
- Distribution: ~60% Basic, ~30% Medium, ~10% Advanced
- Quiz Variety: Each grade can generate 10+ completely unique quizzes
- Capacity: Supports hundreds of students without question exhaustion
# Seed all grades with 250+ questions each (RECOMMENDED)
cd server && npm run seed:250
# Verify all grades have sufficient questions
node verify-250-questions.js
# Test the ultra-strict no-duplicates system
node test-no-duplicates.js
# Verify complete system integrity
node verify-ultra-strict-system.js
- Database Constraints: Unique indexes prevent duplicates at database level
- Database Triggers: Block duplicate questions during insertion
- Application-Level Checking: 5 different duplicate checks per question
- Cross-Quiz Tracking: Maintains history of all used questions per student
- Multi-Phase Validation: Pre, during, and post-selection validation
- Integrity Monitoring: Real-time views monitor system health
- Comprehensive Testing: Automated test suite validates no duplicates
- Grade 6: 250 questions β ~10 unique quizzes per student
- Grade 7: 250 questions β ~10 unique quizzes per student
- Grade 8: 250 questions β ~10 unique quizzes per student
- Grade 9: 250 questions β ~10 unique quizzes per student
- Grade 11: 250 questions β ~10 unique quizzes per student
- Ultra-strict question selection algorithm with multiple validation layers
- Database triggers for automatic duplicate prevention
- Integrity monitoring views for real-time system health
- Comprehensive error handling and logging
- Production-ready localhost-only security configuration
- Node.js (version 18 or higher)
- npm (comes with Node.js)
# Clone and install
git clone <your-repo-url>
cd mcq-testing-system
npm run install:all
# Start development servers
npm run dev
Access locally:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
mcq-testing-system/
βββ client/ # React TypeScript Frontend
β βββ src/
β β βββ components/ # React components
β β β βββ auth/ # Authentication components
β β β βββ admin/ # Admin panel components
β β β βββ student/ # Student dashboard components
β β βββ contexts/ # React contexts
β β βββ App.tsx # Main app component
β βββ public/ # Static assets
β βββ package.json # Client dependencies
β βββ vite.config.ts # Vite configuration
βββ server/ # Node.js Backend
β βββ routes/ # API routes
β β βββ auth.js # Authentication routes
β β βββ quiz.js # Quiz management routes
β β βββ admin.js # Admin routes
β β βββ students.js # Student routes
β βββ middleware/ # Express middleware
β βββ config/ # Database configuration
β βββ utils/ # Utility functions
β βββ scripts/ # Database seeding scripts
β βββ index.js # Main server file
βββ database/ # SQLite database files
βββ package.json # Root package.json
βββ README.md # This file
# Install all dependencies (root, client, server)
npm run install:all
# Start both client and server in development mode
npm run dev
# Start only the client development server
npm run client:dev
# Start only the server development server
npm run server:dev
cd client
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Run linting
npm run lint
cd server
# Start development server with auto-reload
npm run dev
# Start production server
npm start
# Run database seeding
npm run seed
-
Registration
- Navigate to http://localhost:5173
- Click "Register"
- Fill in: Name, Roll Number (1-80), Grade, Section (A/B), Password
- Submit registration
-
Login
- Use your registered credentials to login
- Access your student dashboard
-
Taking a Quiz
- Click "Start Quiz" from your dashboard
- Answer 25 questions based on your grade level
- Submit before the 30-minute timer expires
- View your results immediately
-
Admin Access
- Navigate to http://localhost:5173/admin
- Login Credentials (consistent across all servers):
- Username:
admin
- Password:
admin123
- Username:
-
Managing Questions
- Add new questions for different grades
- Edit existing questions
- Set difficulty levels and subjects
-
Monitoring Students
- View registered students
- Check quiz results and scores
- Export data for analysis
For Render Deployment (set in Render dashboard):
NODE_ENV=production
PORT=10000
JWT_SECRET=your-secure-jwt-secret
DB_PATH=./database/mcq_system.db
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin123
CORS_ORIGINS=https://your-app-name.onrender.com
For Local Development (server/.env
):
PORT=8000
NODE_ENV=development
JWT_SECRET=mcq-testing-system-jwt-secret-2025
DB_PATH=./database/mcq_system.db
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin123
CORS_ORIGINS=http://localhost:5173,http://localhost:3000
π Standardized Admin Credentials:
- Username:
admin
- Password:
admin123
- These credentials are consistent across all server deployments
The SQLite database is automatically created and seeded with consistent data:
Option 1: Automatic Setup
setup-complete.bat # Complete setup including database
Option 2: Database Only
init-database.bat # Initialize database with default data
Option 3: Manual Setup
cd server
npm run seed # Seed database with sample questions
ποΈ Consistent Database Content:
- Default admin account (admin/admin123)
- Sample student account (Roll: 2, Grade: 8, Section: A, Password: student123)
- Sample questions for all supported grades
- Identical database structure across all deployments
- Grade 6: Elementary computer science concepts
- Grade 7: Intermediate programming and logic
- Grade 8: Advanced programming concepts
- Grade 9: Data structures and algorithms
- Grade 11: Advanced computer science topics
GUARANTEED: No question with the same ID will ever repeat in any test.
- Algorithm Level: Question selection logic prevents duplicates
- Database Level: Unique constraints prevent duplicate responses
- Validation Level: Multiple validation checks before quiz generation
- Submission Level: Validates no duplicate questions in answers
test-no-duplicates.bat # Verify no duplicates are generated
- β Set-based Selection: Uses Set data structure to prevent duplicates
- β Database Constraints: Unique index on (quiz_id, question_id)
- β Validation Triggers: Database triggers prevent duplicate insertions
- β Application Validation: Multiple validation layers in code
- β Submission Checks: Validates uniqueness before processing answers
- JWT Authentication - Secure token-based authentication
- Password Hashing - Bcrypt encryption for passwords
- Input Validation - Server-side validation for all inputs
- Rate Limiting - API rate limiting to prevent abuse
- CORS Protection - Cross-origin request security
- SQL Injection Prevention - Parameterized database queries
After running setup-complete.bat
, test that login and signup work:
test-auth.bat # Starts servers and opens browser for testing
verify-api.bat # Tests API endpoints directly
-
Test Registration:
- Go to http://localhost:5173
- Click "Register"
- Fill form: Name, Roll (1-80), Grade, Section, Password
- Submit and verify success
-
Test Login:
- Use registered credentials or sample student:
- Roll: 2, Grade: 8, Section: A, Password: student123
-
Test Admin Login:
- Go to http://localhost:5173/admin
- Username: admin, Password: admin123
-
Registration/Login not working
# Check if API is accessible curl http://localhost:8000/health # Verify database exists dir database # Check client environment type client\.env
-
API connection errors
# Ensure client points to correct API echo VITE_API_URL=http://localhost:8000/api > client\.env # Restart client cd client && npm run dev
-
Port already in use
# Kill processes on ports 5173 or 8000 npx kill-port 5173 8000
-
Dependencies not installing
# Clear npm cache and reinstall npm cache clean --force npm run install:all
-
Database connection issues
# Reinitialize database init-database.bat
-
Build errors
# Clear build cache cd client rm -rf dist node_modules npm install npm run build
If you encounter issues:
- Check the console logs in both client and server
- Ensure all dependencies are installed correctly
- Verify environment variables are set properly
- Check that ports 5173 and 8000 are available
POST /api/auth/register
- Student registrationPOST /api/auth/login
- Student loginPOST /api/auth/admin/login
- Admin loginGET /api/auth/verify
- Token verification
POST /api/quiz/generate
- Generate quiz for studentPOST /api/quiz/submit
- Submit quiz answersGET /api/quiz/results/:id
- Get quiz results
GET /api/admin/students
- Get all studentsGET /api/admin/results
- Get all quiz resultsPOST /api/admin/questions
- Add new questions
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for TECH BOARD 2025 Selection Test
- Designed for educational assessment purposes
- Thanks to all contributors and testers
PORT=8000 JWT_SECRET=your-super-secret-jwt-key-change-in-production DB_PATH=./database/mcq_system.db NODE_ENV=development
VITE_API_URL=your-api-url
This document is written by harsh only for the purpose of MCQ testing system and helps you to solve any arror if you are facing.
- It may be considered a serious breach of trust and professionalism.
- Such actions are unforgivable and may lead to permanent consequences, including revocation of access or legal implications.
Happy Testing! π