JudgeLib

Microservice Setup

Deploy JudgeLib as a standalone microservice with REST API endpoints for maximum scalability and flexibility.

Live Demo

Try our hosted microservice instance

DEMOProduction Microservice
Test the JudgeLib microservice at:https://judge-microser.onrender.com/

Note: This demo service runs on a free tier and may experience occasional downtime or restarts. If you encounter a 502 error, please try again in a few minutes or consider pinging the workers

Service Response

{
  "message": "All workers completed",
  "jobId": "sum of number",
  "results": [
    {
      "input": "5 1 2 3 4 5",
      "expected_output": "15",
      "result": "15",
      "correct": true,
      "timeout": "2"
    }
  ]
}

Quick Request

curl -X POST https://judge-microser.onrender.com/api/c/run \
  -F "code=./code.cpp" \
  -F "ques_name=sum of number" \
  -F "timeout=2" \
  -F "sizeout=1" \
  -F "input=5 1 2 3 4 5 ### 3 1 2 3 ### 2 1 4..." \
  -F "output=15 ### 6 ### 5 .." \
  -F "language=cpp"

Why Choose Microservice?

Language Agnostic

Use JudgeLib from any programming language or framework via simple HTTP requests.

Horizontal Scaling

Scale your code execution capacity by deploying multiple instances behind a load balancer.

Isolated Environment

Run code execution in a completely isolated environment, separate from your main application.

API Documentation

POST/api/c/run
Execute code using the JudgeLib microservice

Base URL

https://judge-microser.onrender.com/

Request Body

{
  "ques_name":"dummy",      // required
  "language": "python",     // required: programming language
  "code": ./code.py,        // required: path of source code
  "output": "dummy_output"  // required: output for the program (cannot be empty) seperated by ###
  "input": "dummy_input",   // required: input for the program  (cannot be empty) seperated by ###
  "timeout": 5,             // optional: timeout in seconds
  "sizeout":2
}
Code Examples
Different ways to interact with the microservice

cURL Example

curl -X POST https://judge-microser.onrender.com/api/c/run \
  -F "code=@code.cpp" \
  -F "ques_name=sum of number" \
  -F "timeout=2" \
  -F "sizeout=1" \
  -F "input=5 1 2 3 4 5" \
  -F "output=15" \
  -F "language=cpp"

JavaScript/Node.js Example

const response = await fetch('https://judge-microser.onrender.com/api/c/run', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    ques_name:"dummy_name",
    language: 'py',
    code: './code.py', //file path and key should be code
    input: 'dummy_input',  // Required - cannot be empty (seperated bt ###) 
    output: '1 ### 2 ',  // Required - cannot be empty (seperated bt ###) 
    timeout: 5,
    sizeout: 2
  })
});

const result = await response.json();
console.log(result);