A real-time quiz game built with Node.js, MongoDB, and WebSockets. This application allows users to register, log in, and participate in quiz sessions where questions are delivered in real-time. The application will automatically calulate the score for each session and announce the winner.
- User authentication (registration and login)
- Real-time game session management
- Dynamic question delivery
- Score calculation and winner determination
- Node.js
- Express.js
- MongoDB
- Mongoose
- WebSocket
- render
Deployed my code on Render. Used mongoDb cloud for ease and high availability.
Base Url:https://multiplayerquizgame.onrender.com
This will help to fetch the live preview of user login and play game.
A collection of apis shared in the same repository with file name Real_Time_Multiplayer_game.postman_collection.json
-
Clone the repository:
git clone https://github.com/lavish2801/multiplayerQuizGame.git -
Navigate to the project directory:
cd multiplayerQuizGame -
Install dependencies:
npm install -
Create a
.envfile in the root directory and add your environment variables:MONGODB_URI=<your_mongodb_connection_string> JWT_SECRET=<your_jwt_secret> PORT:<your_port> JWT_KEY=<your_jwt_key> NODE_ENV=development -
Start the server:
npm start
- POST /api/auth/register: Register a new user
- POST /api/auth/login: Log in an existing user
- POST /api/game/start: Start a new game session
- GET /api/questions: Retrieve a list of questions
----1-----
- Username: test
- Password: password
----2----
- Username: test2
- Password: password