Skip to content
Jatin Sharma
All projects

2025Distributed Systems & Cloud

Distributed Coding Judge

Sandboxed Online Judge Monorepo

Overview

A distributed online judge: an Express API pushes submissions onto Redis queues, workers execute C++17, Python and Node.js code in locked-down Docker containers, and per-test verdicts are stored in PostgreSQL. Users write code in a React + Monaco editor backed by a JWT-secured REST API.

How it works

  1. 01

    Express API and Redis queues decouple request handling from compute-heavy code execution, so workers scale independently.

  2. 02

    JWT-secured REST API; React frontend with the Monaco editor.

  3. 03

    Interactive Code Run: Client transmits code with custom test cases. API server enqueues into run_requests and awaits ephemeral result on run_results:<runId> using Redis BRPOP with a timeout.

  4. 04

    Problem Submission: API stores pending submission in PostgreSQL and pushes onto the problems queue. Background worker runs all test cases, evaluates final verdict, and writes per-test verdicts to PostgreSQL.

  5. 05

    Language workers for C++17, Python 3, and JavaScript (Node.js), each run in an isolated Docker container.

  6. 06

    Production deployment hosted on AWS.

Sandboxing & security

User-submitted code is untrusted, so every run happens inside a locked-down Docker container with layered isolation.

ControlConfigWhy
Network Isolation--network=noneDisables outbound network access, preventing SSRF and reverse shells
Memory Limit--memory 128mPrevents memory exhaustion attacks (OOM denial-of-service)
CPU Quota--cpus 0.5Limits CPU usage to prevent CPU starvation
Process Cap--pids-limit 64Mitigates fork bombs and process table exhaustion
Filesystem Safety--read-onlyEnforces an immutable container filesystem
Temporary Scratch Space--tmpfs /tmp:size=64m,execProvides an ephemeral 64MB ramdisk for source compilation
Privilege Escalation--security-opt=no-new-privilegesBlocks setuid binaries and privilege escalation exploits
Execution Timeout5000ms (TLE)Forcefully terminates hanging processes via SIGKILL