@onlinecompiler/node-red-onlinecompiler 0.1.0

Node-RED node for OnlineCompiler.io: run code in 46 languages in a fresh sandbox with no network, and judge it against test cases.

npm install @onlinecompiler/node-red-onlinecompiler

@onlinecompiler/node-red-onlinecompiler

A Node-RED node for OnlineCompiler.io: run code in 46 languages and judge it against test cases. Every run starts in a fresh sandbox (gVisor) with no network, so it is safe for code you didn't write: student submissions, code from a form, or code an AI model wrote.

Node-RED's own Function node runs JavaScript inside Node-RED. Use this node when you need another language (Python, C, C++, Java, Go, Rust, SQL, R and 38 more), an isolated sandbox for untrusted code, or a verdict for each test case.

Install

In Node-RED, open Manage palette, search for @onlinecompiler/node-red-onlinecompiler and install it. Or, in your Node-RED user directory (usually ~/.node-red):

npm install @onlinecompiler/node-red-onlinecompiler

Needs Node-RED 3.0 or later on Node.js 18 or later.

Get an API key

  1. Sign in at onlinecompiler.io with Google or an email link.
  2. Create a REST API key on the API Keys page of your dashboard.
  3. In the node, add an Account and paste the key. Node-RED stores it with its other credentials, not in the flow.

The free plan includes 100,000 runs a month, commercial use allowed, no credit card. Each test in a judged run counts as one run. See pricing.

Operations

  • Run code: runs a program with optional standard input. msg.payload becomes { output, error, status, exit_code, time, memory }.
  • Run code against test cases: runs the program once per test and returns { verdict, score, passed, total, tests }. Choose how output is compared (trim, exact, tokens, float, rows, table, table ordered) and how the score is worked out (percent, or all or nothing).
  • List languages: returns every language with the compiler ID to use, such as python-3.14, g++-15 or openjdk-25 (the full list is at onlinecompiler.io/languages).

Each setting (language, code, input, tests) can come from the message, a fixed value, flow or global context, or an environment variable. By default the code is msg.payload and the tests are msg.tests:

[
  { "input": "2 3", "expected_output": "5" },
  { "input": "10 -4", "expected_output": "6" }
]

When the API answers with an error (a bad key, too many runs a minute, an unknown language), the node sets msg.statusCode and reports the error, so a Catch node can handle it.

Limits per run: 30 seconds, 512 MB of memory (up to 2 GB on Pro and above) and no network.

Examples

Import them from Import > Examples > @onlinecompiler/node-red-onlinecompiler:

  • run-python: an Inject node sends a Python program, the node runs it with an input, and a Debug node shows the output.
  • grade-with-tests: sends a submission and two test cases and shows the verdict and score.

Other ideas: grade submissions that arrive by HTTP In or email and write the score to a database; run a nightly check of code snippets from your docs; let an LLM node write code and run it here before the answer is sent.

Resources

License

MIT

Node Info

Version: 0.1.0
Updated 16 hours ago
License: MIT
Rating: not yet rated

Categories

Actions

Rate:

Downloads

0 in the last week

Nodes

  • onlinecompiler-config
  • onlinecompiler

Keywords

  • node-red
  • onlinecompiler
  • code-execution
  • sandbox
  • compiler
  • judge
  • autograder

Maintainers