WordBattle is a multiplayer word-guessing game inspired by Wordle, where players can compete against each other in real-time.
- Classic 5x6 Mode: Compete against other players in the traditional Wordle format
- Real-time Matchmaking: Find and challenge other players instantly
- Friends System: Add friends and challenge them to private matches
- Game History: Track your wins and previous games
- Next.js
- Socket.IO Client
- TypeScript
- Tailwind CSS
- Node.js (v18+)
- Express
- Socket.IO
- Prisma (Database ORM)
- TypeScript
- Node.js v18 or higher
- SSL Certificate (for HTTPS)
- PostgreSQL database
NEXT_PUBLIC_BACKEND_URL=https://your-backend-url:5000
PORT=5000
FRONTEND_URL=https://your-frontend-url:3000
DATABASE_URL=your-postgresql-connection-string
The application uses three different types of socket connections:
-
Game Socket (
useGameSocket)- Handles the core game mechanics
- Manages game state and player moves
-
Matchmaking Socket (
useMatchmakingSocket)- Manages player queuing and matching
- Handles reconnection with 5 attempts
- Uses WebSocket transport
-
Challenge Socket (
useChallengeSocket)- Manages friend challenges and private games
- Supports both WebSocket and polling
- Includes automatic reconnection
- Clone the repository
- Install dependencies:
# Frontend cd frontend npm install # Backend cd backend npm install
- Set up your environment variables
- Run database migrations:
cd backend npx prisma migrate dev - Start the development servers:
# Backend cd backend npm run dev # Frontend cd frontend npm run dev
- SSL certificate is required for secure WebSocket connections
- The application uses CORS with specific origin restrictions
- Environment variables should be properly configured for production
Common issues and solutions:
-
Matchmaking Issues
- Ensure you're using Node.js v18 or higher
- Check WebSocket connection in browser dev tools
- Verify backend URL configuration
-
Friends Page
- If modal doesn't appear, check z-index configurations
- Ensure Command component is properly mounted
-
SSL Certificate
- Verify SSL certificate installation
- Check certificate chain is complete
- Ensure proper HTTPS configuration
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request