{"id":33409261,"url":"https://github.com/sambhandavale/judge-it","last_synced_at":"2026-04-07T23:31:58.710Z","repository":{"id":323823557,"uuid":"1094840286","full_name":"sambhandavale/judge-it","owner":"sambhandavale","description":"MyJudge is a secure, multi-language code execution engine that runs untrusted code in isolated Docker containers, supports C, C++, Java, Python, and JavaScript, and provides a REST API for asynchronous code execution and result retrieval.","archived":false,"fork":false,"pushed_at":"2025-11-26T11:01:56.000Z","size":19,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-29T09:44:00.714Z","etag":null,"topics":["celery","code-execution","code-execution-engine","competitive-programming","compiler","cplusplus","docker","flask","java","javascript","judge","judge0","microservices","python","redis","rest-api","sandbox","sandboxing"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sambhandavale.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-12T08:42:19.000Z","updated_at":"2025-11-26T11:01:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sambhandavale/judge-it","commit_stats":null,"previous_names":["sambhandavale/judge-it"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sambhandavale/judge-it","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambhandavale%2Fjudge-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambhandavale%2Fjudge-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambhandavale%2Fjudge-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambhandavale%2Fjudge-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sambhandavale","download_url":"https://codeload.github.com/sambhandavale/judge-it/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sambhandavale%2Fjudge-it/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31533823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"ssl_error","status_checked_at":"2026-04-07T16:28:06.951Z","response_time":105,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celery","code-execution","code-execution-engine","competitive-programming","compiler","cplusplus","docker","flask","java","javascript","judge","judge0","microservices","python","redis","rest-api","sandbox","sandboxing"],"created_at":"2025-11-23T18:13:39.102Z","updated_at":"2026-04-07T23:31:58.705Z","avatar_url":"https://github.com/sambhandavale.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JudgeIt: A Secure, Multi-Language Code Execution Engine\n\nJudgeIt is a high-performance backend service designed to securely compile and execute untrusted user-submitted code. It is built on a distributed microservice architecture using **Flask**, **Celery**, and **Docker**, ensuring that code execution is both isolated and scalable.  \n\nIt is perfect for powering **competitive programming platforms**, **online code editors**, or **e-learning websites**.\n\n---\n\n## Tech Stack\n\n![Flask](https://img.shields.io/badge/Flask-000000?style=flat\u0026logo=flask\u0026logoColor=white)\n![Celery](https://img.shields.io/badge/Celery-0caa41?style=flat\u0026logo=celery\u0026logoColor=white)\n![Redis](https://img.shields.io/badge/Redis-dc382d?style=flat\u0026logo=redis\u0026logoColor=white)\n![Docker](https://img.shields.io/badge/Docker-2496ed?style=flat\u0026logo=docker\u0026logoColor=white)\n![Python](https://img.shields.io/badge/Python-3776AB?style=flat\u0026logo=python\u0026logoColor=white)\n![Java](https://img.shields.io/badge/Java-007396?style=flat\u0026logo=java\u0026logoColor=white)\n![Node.js](https://img.shields.io/badge/Node.js-339933?style=flat\u0026logo=node.js\u0026logoColor=white)\n![C++](https://img.shields.io/badge/C++-00599C?style=flat\u0026logo=c%2B%2B\u0026logoColor=white)\n![C](https://img.shields.io/badge/C-00599C?style=flat\u0026logo=c\u0026logoColor=white)\n\n---\n\n## Features\n\n- **Secure Sandboxing:** All code is executed within isolated Docker containers with no network access, strict memory/CPU limits, and process restrictions.\n- **Asynchronous Processing:** Submissions are handled by a Celery task queue, allowing the API to respond instantly while jobs are processed in the background.\n- **Multi-Language Support:** Easily extendable to support any language that can run in a Docker container.\n- **Resource Limiting:** Enforces strict execution time (e.g., 2s) and memory (e.g., 256MB) limits for each job.\n- **Simple REST API:** Clean API endpoints to submit code and poll for results.\n\n---\n\n## Supported Languages\n\n- **C** (`gcc`)\n- **C++** (`g++`)\n- **Java** (`eclipse-temurin`)\n- **Python** (`python:3.11-slim`)\n- **JavaScript** (`node:20-slim`)\n\n---\n\n## Architecture\n\nThe system consists of four main services:\n\n1. **Flask API (`app.py`)**  \n   Public-facing server to receive submissions, enqueue jobs in Redis, and provide job status endpoints.\n\n2. **Redis**  \n   Message broker that holds the queue of pending jobs.\n\n3. **Celery Worker (`worker.py`)**  \n   Pulls jobs from Redis, prepares code files, and calls the Docker runner for execution.\n\n4. **Docker Daemon**  \n   Spawns isolated containers for each job and ensures resource and security constraints.\n\n### Job Execution Flow\n\n```\n\n[Client]\n|\n\n1. POST /run (code, lang, stdin)\n   |\n   v\n   [Flask API]\n   |\n2. Returns {\"task_id\": \"...\"}\n   |\n3. Enqueues job\n   |\n   v\n   [Redis Queue]\n   |\n4. Job picked up by Celery Worker\n   |\n5. Creates temp dir (/tmp/abc)\n   |   - code file\n   |   - input file\n   |\n6. Calls Docker daemon\n   |\n   v\n   [Docker]\n   |\n7. Spawns isolated container (e.g., code_runner_cpp)\n   |   - Mounts /tmp/abc as /app\n   |   - No network, 256MB RAM, 0.5 CPU\n   |   - Executes run.sh\n   |\n8. run.sh writes output.txt \u0026 error.txt\n   |\n9. Container exits\n   |\n   v\n   [Celery Worker]\n   |\n10. Reads output/error files\n    |\n11. Saves result to Redis backend\n    |\n    [Client]\n    |\n12. GET /status/\u003ctask_id\u003e\n    |\n13. Fetches result from Redis and returns\n\n````\n\n---\n\n## Getting Started\n\nRun the entire judge system locally using **Docker Compose**.\n\n### Prerequisites\n\n- Docker\n- Docker Compose\n\n### 1. Build Runner Images\n\n```bash\ndocker build -t code_runner_c ./images/c\ndocker build -t code_runner_cpp ./images/cpp\ndocker build -t code_runner_java ./images/java\ndocker build -t code_runner_node ./images/node\ndocker build -t code_runner_python ./images/python\n````\n\n### 2. Run the System\n\n```bash\ndocker compose up --build\n```\n\nThis builds the API and worker images and starts all services (`api`, `worker`, `redis`, Docker socket proxy).\n\n---\n\n## API Reference\n\nThe API runs at `http://localhost:5000`.\n\n### Submit Code\n\n**Endpoint:** `POST /run`\n**Body (JSON):**\n\n```json\n{\n  \"language\": \"python\",\n  \"source\": \"print(input())\",\n  \"stdin\": \"Hello World!\"\n}\n```\n\n**Success Response (202):**\n\n```json\n{\n  \"task_id\": \"a8f5c01a-6b3d-4c7e-8c0a-9d3f1b0a6e3d\",\n  \"status\": \"submitted\"\n}\n```\n\n---\n\n### Check Job Status\n\n**Endpoint:** `GET /status/\u003ctask_id\u003e`\n\n**Pending Response (200):**\n\n```json\n{\n  \"status\": \"pending\"\n}\n```\n\n**Success Response (200):**\n\n```json\n{\n  \"return_code\": 0,\n  \"stdout\": \"Hello World!\\n\",\n  \"stderr\": \"\",\n  \"time\": 0.05,\n  \"status\": \"SUCCESS\"\n}\n```\n\n**Error Response (200):**\n\n```json\n{\n  \"return_code\": 1,\n  \"stdout\": \"\",\n  \"stderr\": \"Runtime Error:\\nTraceback (most recent call last):\\n  File \\\"code.py\\\", line 1, in \u003cmodule\u003e\\n    print(1/0)\\nZeroDivisionError: division by zero\\n\",\n  \"time\": 0.04,\n  \"status\": \"SUCCESS\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambhandavale%2Fjudge-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsambhandavale%2Fjudge-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsambhandavale%2Fjudge-it/lists"}