Hii-Coder
A distributed competitive coding platform engineered with dedicated microservices, event-driven orchestration via Kafka, secure sandboxed Docker code execution, and real-time WebSocket feedback.
The problem
Running untrusted user code alongside core web APIs creates severe security risks, resource contention, and execution bottlenecks. During live coding contests and traffic bursts, querying central databases for problem definitions, hidden test cases, and user verification creates heavy read pressure. Furthermore, executing multi-case test suites without real-time feedback leaves users waiting blindly for verdicts while cold container startups degrade evaluation throughput.
The engineering approach
Architected a distributed microservices ecosystem decoupling core domain services from a high-performance judge and execution engine using Apache Kafka and shared domain contracts. To eliminate cross-service database contention during burst traffic, the execution service maintains synchronized local read snapshots populated by domain event streams. Untrusted code runs inside isolated Docker sandboxes configured with strict resource quotas, disabled networking, read-only filesystems, and bounded timeouts. Real-time WebSockets handle both live user presence tracking across coding problems and streaming incremental test-case progress directly to a multi-panel React IDE.
What’s inside
- Microservices architecture decoupling core user and problem management from high-throughput code execution workloads
- Asynchronous event-driven inter-service messaging with Apache Kafka for submission queuing and result propagation
- Synchronized local read-only database snapshots in the judge service to withstand high-concurrency traffic bursts without central database contention
- Secure, isolated Docker execution sandbox with disabled networking, strict CPU and memory bounds, read-only root filesystems, and execution timeouts
- Instant, non-blocking submission ingestion providing immediate acknowledgment while background workers process execution queues
- Real-time test-case streaming over WebSockets providing live incremental pass/fail progress updates as code runs
- Live presence tracking over WebSockets displaying real-time active user avatars on coding problems
- Shared domain and security library standardizing JWT authentication, unified data contracts, and cross-service event schemas
- Modern multi-panel web IDE with syntax-highlighted code editing, custom test case runners, timer widgets, and user streak analytics
- Automated CI/CD deployments and cloud infrastructure provisioned with Terraform on AWS
Challenges & trade-offs
- Maintaining event-synchronized local database snapshots eliminates cross-service read bottlenecks during traffic spikes, but requires eventual consistency handling across domain event streams.
- Decoupling code compilation and evaluation into dedicated sandboxed workers introduces message queue overhead, but guarantees that untrusted scripts cannot degrade core API availability or compromise the host environment.
- Streaming incremental test-case results over WebSockets provides immediate visual feedback, requiring persistent connection state management and lifecycle cleanup across concurrent submissions.
- Enforcing strict sandbox constraints (no network access, tight memory/CPU quotas, and limited temporary storage) ensures host security and fairness, requiring precise language test harnesses to capture standard I/O.
Performance figures are project-reported results, not independently benchmarked measurements.