A real-time multiplayer guessing game built with React, Node.js, and Socket.IO. Players can join game rooms, take turns creating questions, and guess answers in real-time.
- Real-time multiplayer gameplay using Socket.IO
- Create and join game rooms with unique room codes
- Turn-based question and answer gameplay
- Player lobby and game session management
- Responsive design for desktop and mobile devices
- Live player status updates
- React 18
- React Router for navigation
- Socket.IO Client for real-time communication
- Vite for development and building
- CSS for styling
- Node.js
- Express.js
- Socket.IO for real-time communication
- UUID for generating unique room codes
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository:
git clone https://github.com/OgoNelson/multiplayer-guessing-game.git cd multiplayer-guessing-game -
Install dependencies for both client and server:
npm install cd client && npm install cd ..
To start both the server and client simultaneously in development mode:
npm run dev:allThis will:
- Start the server with nodemon (auto-restart on changes)
- Start the client with Vite dev server (hot reload)
- Open the application at http://localhost:5173 (client) and http://localhost:3000 (server API)
To start only the server:
npm run server:devTo start only the client:
npm run client:devTo build the client and start the server in production mode:
npm run build_startmultiplayer-guessing-game/
├── client/ # React frontend application
│ ├── dist/ # Built client files (generated)
│ ├── public/ # Static assets
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── context/ # React context providers
│ │ ├── hooks/ # Custom React hooks
│ │ ├── pages/ # Page components
│ │ ├── utils/ # Utility functions
│ │ ├── App.jsx # Main App component
│ │ └── main.jsx # Application entry point
│ ├── package.json # Client dependencies
│ └── vite.config.js # Vite configuration
├── server/ # Node.js backend
│ ├── app.js # Express server setup
│ ├── gameSession.js # Game session logic
│ └── socketHandlers.js # Socket.IO event handlers
├── package.json # Root dependencies and scripts
└── railway.json # Railway deployment configuration
- Home Page: Players can create a new game room or join an existing one
- Game Lobby: Players wait in the lobby until the game starts
- Game Session: Players take turns creating questions and guessing answers
- Real-time Updates: All game actions are synchronized across all players
GET /health- Health check endpoint for monitoring
createRoom- Create a new game roomjoinRoom- Join an existing roomstartGame- Start the game (host only)submitQuestion- Submit a question for the current roundsubmitGuess- Submit a guess for the current questionnextRound- Move to the next round (host only)
roomCreated- Room creation confirmationroomJoined- Room join confirmationplayerJoined- New player joined notificationplayerLeft- Player left notificationgameStarted- Game started notificationnewRound- New round startedquestionSubmitted- Question submitted notificationguessSubmitted- Guess submitted notificationgameEnded- Game ended notificationerror- Error notification
The application is configured for Railway deployment:
- Connect your repository to Railway
- Railway will automatically detect the Node.js application
- The application will be built and deployed with the following settings:
- Build command:
npm run build - Start command:
npm start - Health check path:
/health
- Build command:
The following environment variables can be configured:
NODE_ENV- Set to 'production' for production deploymentPORT- Server port (defaults to 3000)
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License - see the package.json file for details.
Ogo Nelson
- Socket.IO for real-time communication
- React team for the excellent frontend framework
- Vite for the fast development experience