Code Arena is a real-time, high-fidelity competitive debugging platform. Designed to gamify the process of learning and practicing code, players face off in head-to-head matches or against dynamic AI bots. Your objective: read, understand, and fix broken code faster than your opponent to pass the test cases.
- Real-Time Multiplayer: Built on WebSockets for instant state synchronization, live racing, and presence detection.
- Dynamic AI Opponents: Challenge the AI bot with multiple difficulty tiers (Beginner to Godlike). The AI features Dynamic Topic Scaling, meaning it intelligently slows down its typing speed when you select syntax-heavy frameworks (like React, Docker, or SQL) to ensure a fair race!
- Extensive Tech Topics: Supports multiple languages and frameworks.
- Core: JavaScript, Python, HTML, CSS.
- Frameworks & Tools: React, Vue, Node.js, Java, SQL, Docker, Git.
- Execution Engine: Uses native execution for JS, and an advanced AST/Regex emulation engine for other frameworks.
- Gamification & XP Economy:
- Earn XP for winning matches, complete with streak bonuses and difficulty multipliers.
- Spend XP to buy hints during a match.
- Level up and claim a spot on the Global Leaderboard.
- Quick Chat & Emotes: Send live reactions (🔥, 😅, 👀, 💀, GG) to your opponent during the match.
- High-Fidelity UI/UX:
- IDE-Themed Dashboards: The lobby is designed entirely as an interactive code block (
match_config.tsandplayerStatsobjects), providing maximum immersion. - Responsive Theming: Full support for both a Cyberpunk Dark Mode and a crisp Light Mode, utilizing glassmorphism, Framer Motion transitions, and tactical HUD elements.
- IDE-Themed Dashboards: The lobby is designed entirely as an interactive code block (
- React.js (via Vite)
- Tailwind CSS (Custom themes, semantic design tokens, grid systems)
- Framer Motion (For smooth layout animations, AnimatePresence pop-ins, and toast notifications)
- Monaco Editor (VS Code's embedded editor for syntax highlighting)
- Node.js & Express
- ws (Native WebSocket library for fast, lightweight bidirectional communication)
- JSON Persistence for global leaderboards (
leaderboard.json).
-
Clone the repository:
git clone <repository-url> cd gamify
-
Run the Backend (WebSocket Server):
cd backend npm install npm startThe backend will run on port 1999 by default.
-
Run the Frontend (React App): Open a new terminal window:
cd frontend npm install npm run devThe frontend will run on port 5173 by default.
-
Play: Open your browser and navigate to
http://localhost:5173.
gamify/
├── backend/
│ ├── leaderboard.json # Persistent global top 10 records
│ └── server.js # WebSocket signaling server (rooms, state sync)
└── frontend/
├── src/
│ ├── challenges.js # The content database (bugs, test cases, AI speeds)
│ ├── index.css # Global design system & theme variables (Light/Dark)
│ ├── components/
│ │ ├── Landing.jsx # Interactive IDE-themed lobby & matchmaking
│ │ ├── Game.jsx # Core arena, Monaco editor, progress HUD
│ │ └── ToastContainer.jsx
│ └── utils/
│ ├── GameContext.jsx # Global state manager & code evaluation engine
│ └── helpers.js # Formatting utilities
- The Evaluation Engine (
GameContext.jsx):- Instead of spinning up heavy Docker containers for every language, Code Arena uses a lightweight evaluation strategy. JavaScript is executed securely in the browser environment, while non-JS languages utilize an advanced Regex/String-matching validation system defined in
challenges.js.
- Instead of spinning up heavy Docker containers for every language, Code Arena uses a lightweight evaluation strategy. JavaScript is executed securely in the browser environment, while non-JS languages utilize an advanced Regex/String-matching validation system defined in
- Viewport Optimization (
Landing.jsx):- The landing page is engineered as a strict single-viewport application (no scrolling). Dynamic elements like leaderboards and extra topics use
framer-motion<AnimatePresence>to slide in and gracefully reflow the layout without breaking the bounds of the screen.
- The landing page is engineered as a strict single-viewport application (no scrolling). Dynamic elements like leaderboards and extra topics use
- Adding Challenges: To add a new challenge, update
frontend/src/challenges.js. Ensure you tag it with the correcttopicso the AI speed scaling applies correctly. For non-JS languages, ensureevalMethod: "regex"is set. - Styling: Avoid hardcoded hex colors. Always use the semantic CSS variables (
bg-surface,bg-card,text-muted) defined inindex.cssto ensure full compatibility with the Light/Dark theme toggle.
Happy Debugging! 👾


