A real-time multiplayer UNO card game built with React, Node.js, Express, Socket.IO, and MongoDB.
- Real-time multiplayer gameplay
- Socket.IO for instant communication
- Complete UNO card game logic with authentic rules
- NEW: UNO Call Feature - Must call UNO within 2 seconds when you have 1 card left!
- Automatic penalty system (draw 2 cards if you fail to call UNO)
- Room-based game sessions
- Responsive design with Tailwind CSS
- Visual countdown timer and alerts
uno/
├── uno-backend/ # Node.js/Express backend
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── utils/ # Game logic utilities
│ ├── server.js # Main server file
│ └── package.json
├── uno-frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ └── socket.js # Socket.IO client
│ ├── package.json
│ └── vite.config.js
└── api/ # Vercel serverless functions (legacy)
- Backend: Web Service on Render
- Frontend: Static Site on Render
- Database: MongoDB Atlas
See RENDER_DEPLOYMENT_GUIDE.md for detailed instructions.
- Backend: Vercel Serverless Functions
- Frontend: Vercel Static Site
- Database: MongoDB Atlas
- Node.js 18+
- MongoDB (local or Atlas)
- npm or yarn
-
Clone the repository
git clone <your-repo-url> cd uno
-
Run setup script
# On Linux/Mac ./setup-render.sh # On Windows setup-render.bat
-
Start MongoDB (if using local)
mongod
-
Start backend
cd uno-backend npm run dev -
Start frontend (in new terminal)
cd uno-frontend npm run dev -
Open browser to
http://localhost:5173
If you prefer manual setup:
-
Backend setup
cd uno-backend npm install cp .env.example .env # Edit with your MongoDB URI npm run dev
-
Frontend setup
cd uno-frontend npm install npm run dev
- Create or Join Room: Enter your name and create a new room or join with a room code
- Wait for Players: At least 2 players needed to start
- Start Game: Host can start the game when ready
- Play Cards: Click cards to play them, draw cards when needed
- Call UNO: When you have 1 card left, you MUST click "CALL UNO!" within 2 seconds or draw 2 penalty cards
- Win: First player to empty their hand wins!
MONGO_URI=mongodb://localhost:27017/uno
PORT=5000
FRONTEND_URL=http://localhost:5173
NODE_ENV=development
VITE_BACKEND_URL=http://localhost:5000
VITE_BACKEND_URL=https://your-backend-url.onrender.com
- Node.js - Runtime environment
- Express - Web framework
- Socket.IO - Real-time communication
- MongoDB - Database
- Mongoose - MongoDB ODM
- CORS - Cross-origin resource sharing
- React - UI framework
- Vite - Build tool
- Tailwind CSS - Styling
- Socket.IO Client - Real-time communication
-
CORS Errors
- Ensure
FRONTEND_URLis set correctly in backend - Check that both services use HTTPS in production
- Ensure
-
Socket.IO Connection Issues
- Verify backend URL in frontend environment variables
- Check firewall settings for WebSocket connections
-
Database Connection
- Verify MongoDB URI format
- Ensure IP whitelist includes your deployment IPs
-
Build Failures
- Check Node.js version compatibility
- Verify all dependencies are installed
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions:
- Check the troubleshooting section
- Review deployment guides
- Open an issue on GitHub