A real-time two-player typing game inspired by Monkeytype, built with React, Tailwind CSS, and Node.js with WebSocket support.
- Real-time two-player typing competition - Challenge your friend to a typing duel
- 30-second timed sessions - Fast-paced, intense typing challenges
- WPM (Words Per Minute) calculation - Accurate speed measurement
- Real-time progress tracking - See your opponent's progress as you type
- Character-by-character validation - Visual feedback for correct/incorrect typing
- Room-based matchmaking - Create or join rooms with unique codes
- WebSocket real-time communication - Instant updates between players
- Player ready system - Both players must be ready to start
- 3-second countdown - Synchronized game start
- Automatic game completion - Results calculated when time expires
- Clean, minimal design - Distraction-free typing experience
- Responsive layout - Works on desktop and mobile devices
- Real-time progress bars - Visual representation of typing progress
- Color-coded feedback - Green for correct, red for errors, blue for current position
- Elegant results screen - Winner announcement with detailed statistics
- React 19 - Modern React with hooks and functional components
- Tailwind CSS 4 - Utility-first CSS framework for styling
- Vite - Fast build tool and development server
- Node.js - JavaScript runtime
- Express.js - Web framework
- ws - WebSocket library for real-time communication
- UUID - Unique identifier generation for rooms and players
monkey/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ │ ├── Lobby.jsx # Room creation/joining interface
│ │ │ ├── GameRoom.jsx # Main game interface
│ │ │ ├── TypingArea.jsx # Typing input and validation
│ │ │ └── Results.jsx # Game results display
│ │ ├── App.jsx # Main application component
│ │ └── main.jsx # Application entry point
│ └── package.json
├── backend/ # Node.js backend server
│ ├── server.js # Main server with WebSocket handling
│ └── package.json
└── README.md
- Node.js (v16 or higher)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd monkey
-
Install backend dependencies
cd backend npm install -
Install frontend dependencies
cd ../frontend npm install
-
Start the backend server
cd backend npm run devThe server will start on
http://localhost:3001 -
Start the frontend development server
cd frontend npm run devThe frontend will start on
http://localhost:5173 -
Open your browser Navigate to
http://localhost:5173to start playing
- Open the application in your browser
- Click "Create New Room"
- Share the room code with your friend
- Click "I'm Ready" when you're prepared to start
- Open the application in your browser
- Click "Join Existing Room"
- Enter the room code provided by your friend
- Click "Join Room"
- Click "I'm Ready" when you're prepared to start
- Both players must click "Ready" to start the countdown
- After the 3-second countdown, the 30-second timer begins
- Type the displayed text as quickly and accurately as possible
- Watch your opponent's progress in real-time
- When the timer ends, results are displayed with WPM scores
- Timer: 30 seconds per game
- Scoring: WPM (Words Per Minute) based on correctly typed words
- Progress: Calculated as percentage of text completed
- Validation: Character-by-character checking with visual feedback
- Winner: Player with the highest WPM score
GET /health- Health check endpoint- WebSocket connection for real-time game communication
create_room- Create a new game roomjoin_room- Join an existing roomplayer_ready- Mark player as readytyping_progress- Send typing progress updatesgame_complete- Send final game results
- Lobby: Room creation and joining interface
- GameRoom: Main game interface with timer and progress
- TypingArea: Text input with real-time validation
- Results: Game results display with statistics
- 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 MIT License - see the LICENSE file for details.
- Inspired by Monkeytype
- Built with modern web technologies for optimal performance
- Designed for a smooth, distraction-free typing experience