A comprehensive quiz platform built with the MERN stack (MongoDB, Express.js, React.js, Node.js) that allows users to create, take quizzes, and track their performance.
- User Authentication: Register, login, and profile management
- Quiz Taking: Take quizzes with multiple choice questions
- Score Tracking: View detailed scores and performance analytics
- Personal Dashboard: Track progress and view statistics
- Quiz History: View all attempted quizzes and scores
- Quiz Creation: Create custom quizzes with multiple questions
- Quiz Management: Edit and delete your created quizzes
- Performance Analytics: View how your quizzes perform
- User Management: View and manage all users
- Quiz Oversight: Monitor all quizzes and their performance
- System Statistics: View platform-wide analytics
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM for MongoDB
- JWT - Authentication
- bcryptjs - Password hashing
- express-validator - Input validation
- React.js - UI library
- React Router - Client-side routing
- Axios - HTTP client
- Tailwind CSS - Styling
- React Hook Form - Form management
- Node.js (v14 or higher)
- MongoDB (local or cloud)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd quiz_app
-
Install dependencies
npm install
-
Environment Configuration Create a
.envfile in the root directory:NODE_ENV=development PORT=5000 MONGODB_URI=mongodb://localhost:27017/quiz-platform JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
-
Start the server
npm run server
-
Navigate to client directory
cd client -
Install dependencies
npm install
-
Start the development server
npm start
From the root directory:
npm run devPOST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/user- Get current userPUT /api/auth/profile- Update profile
GET /api/quiz- Get all public quizzesGET /api/quiz/:id- Get specific quizPOST /api/quiz- Create new quizPUT /api/quiz/:id- Update quizDELETE /api/quiz/:id- Delete quizPOST /api/quiz/:id/submit- Submit quiz answersGET /api/quiz/:id/leaderboard- Get quiz leaderboard
GET /api/score/history- Get user's quiz historyGET /api/score/:quizId- Get specific quiz scoreGET /api/score/stats/overview- Get user statisticsGET /api/score/stats/category/:category- Get category statistics
GET /api/user/profile- Get user profilePUT /api/user/profile- Update user profileGET /api/user/quizzes- Get user's created quizzesGET /api/user/dashboard- Get user dashboard data
GET /api/user/admin/users- Get all usersPUT /api/user/admin/users/:id/role- Update user roleGET /api/user/admin/stats- Get admin statistics
- Basic info (username, email, password)
- Profile data (firstName, lastName, bio, avatar)
- Statistics (quizzes taken, scores, etc.)
- Role-based access control
- Quiz metadata (title, description, category)
- Questions with multiple choice options
- Scoring and timing configuration
- Creator and visibility settings
- User performance tracking
- Detailed answer analysis
- Time tracking and statistics
quiz_app/
├── models/ # Database models
├── routes/ # API routes
├── middleware/ # Custom middleware
├── client/ # React frontend
├── server.js # Express server
├── package.json # Dependencies
└── README.md # Documentation
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue in the repository.