A real-time multiplayer typing battle game inspired by MonkeyType, featuring low-latency WebSocket synchronization, a live leaderboard, and anti-cheat mechanisms. The system uses Redis for caching & pub/sub events, PostgreSQL for persistent data, and React + WebSockets for a smooth frontend experience.
β
Real-Time Multiplayer Battles β Instant input tracking using WebSockets
β
Live Leaderboard β Updates every second via Redis
β
Dynamic Prompt Generation β AI-generated or pre-stored texts
β
Fair Gameplay & Anti-Cheat β Detects unnatural typing speeds
β
Reconnect Support β Players can resume mid-game
β
Global Deployment β Low-latency performance using Redis & WebSockets
- React (Vite) + Tailwind CSS β Responsive UI
- Native WebSockets (WebSocket API) β Real-time updates
- Web Workers β Offload intensive WPM calculations
- Service Workers β Background sync & offline support
- Node.js (Express + ws) β WebSocket & API server
- Redis (Pub/Sub & Leaderboards) β Ultra-fast real-time updates
- PostgreSQL (pg module) β Persistent storage for game history
- Kafka β Event-driven architecture for analytics
- Docker + Kubernetes β Containerized deployment
- Cloudflare (WebSocket Proxying) β Reduce latency globally
- AWS (EC2) β Scalable backend hosting
- Redis Cluster + Sentinel β High-availability caching
/TypeBrawl
βββ backend/ # Node.js WebSocket & API Server
β βββ src/
β β βββ controllers/ # Game logic & matchmaking
β β βββ services/ # Prompt generation, leaderboard handling
β β βββ utils/ # Rate limiting, anti-cheat checks
β β βββ database.js # Raw PostgreSQL (pg module) connection
β β βββ redis.js # Redis connection
β β βββ index.js # WebSocket server
β β βββ api.js # Express API routes
β βββ Dockerfile
βββ frontend/ # React Client
β βββ src/
β β βββ components/ # UI components
β β βββ hooks/ # WebSocket & state management
β β βββ pages/ # Game UI, leaderboard
β βββ package.json
β βββ Dockerfile
βββ docker-compose.yml # Redis + PostgreSQL setup
βββ README.md
git clone https://github.com/yourusername/TypeBrawl.git
cd TypeBrawlcd backend
npm install
npm startcd frontend
npm install
npm run devdocker-compose up -d- Implement WebRTC for lower-latency communication
- Add AI-generated typing prompts
- Introduce ranking & competitive matchmaking
MIT