- Introduction
- Features
- Technologies Used
- Prerequisites
- Installation
- Usage
- Project Structure
- API Endpoints
- Multiplayer Functionality
- Contributing
- License
- Contact
The Quiz Application is a web-based platform designed to facilitate both individual and multiplayer quiz sessions. Users can sign up, log in, and choose topics and subtopics to start a quiz. The application is built using React for the frontend and Node.js with Express for the backend, with data stored in MongoDB.
- User Authentication: Sign up, log in, and log out functionality.
- Topic and Subtopic Management: View and select topics and subtopics for quizzes.
- Quiz Modes: Choose between individual and multiplayer modes.
- Timed Questions: Each question has a timer, moving to the next question automatically.
- Synchronized Multiplayer: Play with multiple players in real-time with synchronized timers.
- Scoring System: Tracks and displays scores based on correct answers.
- Leaderboard: View top scores for quizzes.
- Frontend: React, React Router, Redux, Axios, CSS Modules
- Backend: Node.js, Express
- Database: MongoDB
- State Management: Redux
- HTTP Client: Axios
- WebSockets: Socket.io (for real-time multiplayer synchronization)
- Node.js and npm installed on your machine
- MongoDB instance (local or cloud)
-
Clone the repository:
git clone https://github.com/Rohank1442/PineTree.git cd PineTree
-
Install dependencies for both frontend and backend:
cd client npm install cd ../server npm install
-
Start the backend server:
cd server npm run dev
-
Start the frontend server:
cd client npm start
-
Access the application: Open your browser and navigate to
http://localhost:3000
. -
Sign up or log in: Create a new account or log in with existing credentials.
-
Select a topic and subtopic: Browse through the available topics and subtopics.
-
Start a quiz: Choose between individual or multiplayer mode and begin the quiz.
-
Answer questions: Each question will be displayed with a timer. Answer the questions within the given time.
-
View results: After completing the quiz, view your score and performance.
├── server/
│ ├── controllers/
│ ├── models/
│ ├── routes/
│ ├── middlewares/
| ├── uploads/
| ├── utils/
│ ├── .env
│ ├── app.js
│ └── package.json
├── client/
| ├── fonts/
| ├── public/
│ ├── src/
| | ├── Api/
│ │ ├── components/
| | ├── helper/
| | ├── hooks/
| | ├── Loader/
│ │ ├── App.js
│ │ ├── index.js
│ ├── .env
| ├── .gitignore
| ├── package-lock.json
| ├── tailwind.config.js
│ └── package.json
└── README.md
I have shown some example API Endpoints here. Other Endpoints can be seen in the server side code.
- POST
/auth/signup
: User registration - POST
/auth/login
: User login - POST
/quiz
: Create quiz - POST
/quiz/storeResponse
: Stores Response
- GET
/topics
: Fetch all topics - GET
/topics/:id
: Fetch a specific topic by ID
- GET
/topics/:id/subtopics
: Fetch all subtopics for a specific topic - GET
/subtopics/:id
: Fetch a specific subtopic by ID
- GET
/quiz/getQuizData/:subTopicId
: Get Quiz Data - GET
/quiz/getQuizJoinId/:joiningId
: Join Quiz from Homepage
The multiplayer mode allows multiple players to join a quiz session and answer questions in real-time. All players see the same questions simultaneously, with a global timer ensuring synchronization across all clients.
- Real-time Synchronization: Using Socket.io, all players' sessions are synchronized, ensuring that everyone receives the questions at the same time.
- Global Timer: A timer runs globally for the entire quiz, ensuring that all players move to the next question simultaneously.
- Individual Question Timer: Each question has a countdown timer, ensuring players answer within the allotted time.
- Socket.io: Used for real-time communication between the server and clients.
- Global Timer Logic: Managed on the server-side to ensure all clients are in sync.
- Player Management: Handles player joining, leaving, and tracking scores in real-time.
- Data Structures: Implemented Queue and map data structures in pagination and Quiz.
- Select Multiplayer Mode: Choose a topic and subtopic, then select the multiplayer option.
- Join or Create a Room: Players can join an existing room or create a new one.
- Start Quiz: Once enough players have joined, the host can start the quiz.
- Answer Questions: Each question will be displayed with a timer. All players will see the same question and timer.
- View Results: After completing the quiz, view individual and overall scores.
Contributions are welcome! Please fork the repository and create a pull request with your changes. Ensure your code follows the project's coding standards and includes appropriate tests.
This project is licensed under the MIT License. See the LICENSE file for more information.
For any inquiries or issues, please contact rohankumar1442@gmail.com or Linkdin(https://www.linkedin.com/in/rohan-kumar-1656b923b/).