Skip to content
ayushoncodePublic

About

Chess.com meets LeetCode — Real-time 1v1 multiplayer competitive coding platform. Battle developers live on DSA challenges with sandboxed Docker execution, Monaco editor, Elo matchmaking, and live telemetry.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

⚔️ AlgoArena

Real-Time 1v1 Competitive Coding & Multiplayer DSA Duels

Chess.com meets LeetCode — Battle developers head-to-head on algorithmic challenges in real-time.


React 19 Node.js PostgreSQL Redis Docker Socket.io


Key Features • System Architecture • Tech Stack • Quick Start • Supported Languages


💡 What is AlgoArena?

Practicing DSA alone on LeetCode can feel slow and unengaging. AlgoArena turns algorithmic problem-solving into a fast-paced multiplayer competitive esport.

Match with opponents based on your Elo rating, receive the same problem simultaneously, write code in Monaco Editor, watch your opponent's live progress telemetry, and race to pass all secret test cases. Submissions are judged in isolated Docker containers with instant verdict streaming over WebSockets.


⚡ Features

⚔️ Real-Time 1v1 Battles

Instant skill-based matchmaking with expanding search bands. Experience live opponent telemetry, typing indicators, line-count tracking, and instant win/loss triggers.

🔒 Sandboxed Code Execution

Submissions run inside isolated, non-root Docker containers with strict RAM (256MB), CPU, PID, and --network none security constraints.

📊 Elo Rating & Dynamic Tiers

Chess-style rating system featuring dynamic K-factors, solve-speed bonuses, problem difficulty multipliers, placement calibration, and global leaderboards.

👥 Custom Match Rooms

Generate 6-character room codes or direct challenge links to battle friends, host study groups, or run mock interview sprints unrated.

💻 Monaco Editor & Smart Harnesses

VS Code-powered editor with syntax highlighting, custom themes, and automatic TreeNode & ListNode deserialization for complex structures.

📈 Detailed Analytics & Profile

Track your Elo progression charts, match history, win rates across problem topics, daily duel streaks, and customizable avatar styles.


🏛️ Architecture

flowchart LR
    A[React 19 + Monaco UI] <--->|WebSockets & REST| B[Express 5 + Socket.io Server]
    B <---> C[(PostgreSQL DB)]
    B --->|Enqueue Job| D[(Redis + BullMQ)]
    D ---> E[Judge Worker]
    E ---> F[Docker Sandbox]
    F --->|Node.js / Python / C++ / Java| E
    E --->|Publish Verdict| D
    D --->|aa:verdicts| B
Loading
  1. Client Layer: React 19 single-page app with Monaco Editor and persistent Socket.io connection.
  2. Gateway Layer: Express 5 REST API + Socket.io gateway managing authentication, room states, and matchmaking queues.
  3. Queue & Broker: Redis and BullMQ distributed queues decoupling heavy code execution from API traffic.
  4. Execution Sandbox: Dedicated worker pool executing untrusted user code inside hardened, zero-network Docker containers.

🛠️ Tech Stack

Domain Technologies
Frontend React 19, Vite, Monaco Editor (@monaco-editor/react), Tailwind CSS, Socket.io Client, Axios, React Router 7
Backend & Realtime Node.js, Express 5, Socket.io 4, PostgreSQL (pg pool, pgcrypto), JWT, Bcrypt, Nodemailer
Queue & Messaging Redis (Upstash), BullMQ 5 (Distributed job queue & pub/sub)
Judge & Sandbox Docker Engine, Alpine Linux (node:20-alpine), GCC / G++ 13, Python 3.11, OpenJDK 17
Authentication JWT (HS256), Email OTP (Nodemailer SMTP), Google OAuth (Firebase Admin)

💻 Supported Languages

AlgoArena supports multi-language execution with native data-structure builders:

Language Runtime / Compiler Version Features
JavaScript Node.js VM & Container v20.x Built-in Tree & Linked-List parser
Python Python 3 3.11+ Automatic AST parameter unpacking
C++ GCC (G++) C++17 High-speed execution with nlohmann-json
Java OpenJDK Java 17 Auto-compiled with memory-tuned flags

🏆 Problem Categories

Over 175+ curated algorithmic problems across key competitive programming topics:

Arrays • Strings • Linked Lists • Trees & BST • Dynamic Programming • Graphs & BFS/DFS • Binary Search • Sorting


🚀 Quick Start

1. Clone & Install Dependencies

git clone https://github.com/ayushoncode/AlgoArena.git
cd algoarena

# Install dependencies for all services
cd backend && npm install
cd ../frontend && npm install
cd ../workers && npm install
cd ..

2. Configure Environment Variables

Create .env files in backend/, workers/, and frontend/:

backend/.env

PORT=4000
NODE_ENV=development
CLIENT_URL=http://localhost:5173
DATABASE_URL=your_postgresql_connection_string
REDIS_URL=your_redis_connection_string
JWT_SECRET=your_super_secret_jwt_key

workers/.env

DATABASE_URL=your_postgresql_connection_string
REDIS_URL=your_redis_connection_string
SANDBOX_IMAGE=algoarena-sandbox
WORKER_CONCURRENCY=3

frontend/.env

VITE_API_URL=http://localhost:4000

3. Build Sandbox & Run Services

# Build the Docker sandbox image (one-time setup)
docker build -t algoarena-sandbox -f workers/Dockerfile.sandbox workers/

Start the services across three terminals:

# Terminal 1: Backend API & WebSocket Gateway
cd backend && npm start

# Terminal 2: Background Submission Worker
cd workers && npm start

# Terminal 3: Frontend Web App
cd frontend && npm run dev

Open http://localhost:5173 to enter the arena! ⚔️

Playing from two laptops on the same Wi-Fi

Run the backend and frontend on one laptop (the host). Find its local IPv4 address with:

ipconfig

Use the host laptop's IPv4 Address (for example, 10.20.24.254) in frontend/.env:

VITE_API_URL=http://10.20.24.254:4000

Restart Vite after changing .env, then on both laptops open:

http://10.20.24.254:5173

Create or log into separate accounts and use a custom room code to challenge each other. Both laptops must be on the same Wi-Fi, and Windows Firewall must allow Node.js on private networks. The backend, PostgreSQL, Redis, and worker stay on the host laptop; the second laptop only needs a browser.


🗺️ Roadmap

  • Real-time 1v1 matchmaking with dynamic Elo scaling
  • Multi-language Docker sandbox judge (JS, Python, C++, Java)
  • Custom private battle rooms with shareable codes
  • Global leaderboards & detailed rating progression analytics
  • Tournament Bracket Mode — Auto-generated knockout brackets for communities
  • 2v2 Team Battles — Co-op competitive problem-solving
  • Spectator Mode — Watch ongoing ranked matches live with dual code view

📄 License & Author

Distributed under the ISC License.

⭐ Star this repository if you find it helpful!

About

Chess.com meets LeetCode — Real-time 1v1 multiplayer competitive coding platform. Battle developers live on DSA challenges with sandboxed Docker execution, Monaco editor, Elo matchmaking, and live telemetry.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages