DEV Community

Umang Sisodia
Umang Sisodia

Posted on

I Built CodeComplex: A Real-Time Competitive Coding Platform with AI Rivals and Bug-Fix Arenas

image showing the landing page of codecomplex.site

Over the past few months, I've been working on a project called CodeComplex (live at codecomplex.site).

It started with a simple observation: while platforms like LeetCode and HackerRank are great for learning algorithms, practicing solo in a static editor often lacks the urgency and pressure of real engineering scenarios like debugging broken legacy code or pairing under a deadline.

I wanted to build a platform that makes competitive coding feel dynamic, interactive, and closer to real-world development.

Here is a breakdown of what CodeComplex is, the engineering challenges I faced building it, and how it works under the hood.


What is CodeComplex?

CodeComplex is a real-time competitive coding platform where developers can challenge each other or practice solo across multiple battle arenas:

  • Data Structures & Algorithms (DSA): Classic algorithmic problem-solving with instant test case feedback.
  • Bug-Fix Arena: Instead of writing code from scratch, you are given a buggy codebase with broken logic or edge cases and must debug it under pressure.
  • Prompt Wars: Test your prompt engineering and code architecture skills against structured rubrics.
  • Solo Practice & DevBot V1: If you prefer practicing alone or if no human opponent is currently in the queue, you can match against an AI rival (DevBot V1) to keep sharp.

image showing different mods to compete

The Architecture & Engineering Challenges

Building a real-time execution platform requires juggling low-latency sockets, secure sandboxing, and resilient state management. Here are a few key architectural decisions:

1. Containerized Code Execution (The Judge)

Running untrusted user code safely is the biggest challenge for any online judge.

  • Submissions in C++, Java, Python, and JavaScript are dispatched to isolated containerized runners.
  • The judge evaluates submissions against hidden test suites, measuring execution time, memory usage, and output correctness down to stdout/stderr traces.
  • To prevent judge downtime from stalling user matches, the backend implements fallback strategies—including local execution fallbacks and mock evaluation for edge-case failures.

2. Real-Time State & WebSockets

Matches run on a strict countdown timer with instant score broadcasts:

  • Socket.IO coordinates state sync between team members, opponents, and room hosts.
  • To prevent race conditions when multiple team members submit solutions simultaneously, score updates use atomic monotonic operations in MongoDB ($max-style updates) so lower scoring attempts never overwrite higher team achievements.

image showing battle happening in codecomplex

3. AI Agent Readiness & Protocols

We also built CodeComplex to be discoverable and usable by AI coding agents:

  • Model Context Protocol (MCP): Implemented an MCP server card under /.well-known/mcp/server-card.json.
  • RFC 8288 Link Headers & Discovery: Endpoint catalogs (/.well-known/api-catalog), OAuth metadata (/.well-known/oauth-protected-resource), and Markdown content negotiation (Accept: text/markdown) are standard across the site.

Key Takeaways

Building CodeComplex taught me that developer experience in competitive tools comes down to speed and clarity:

  1. Clear Error Feedback: When a compilation or runtime error occurs, showing explicit tracebacks without masking system logs saves huge debugging time for the player.
  2. Resilient Matchmaking: If a user searches for a specific topic (like Linked Lists), the backend should aggressively preserve the selected topic across subcategories, tags, and fallback modes so the player is never left staring at an empty room.

Try It Out

CodeComplex is live at codecomplex.site.

Whether you want to test your speed in 1v1 DSA battles, fix bugs under a timer, or try a solo practice round, I'd love for you to check it out and share your feedback!

What feature do you find most useful when practicing coding online? Let me know in the comments below.

Top comments (0)