npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@judge0/judge0-js

v0.1.1

Published

Official JavaScript SDK for Judge0. Mirrors the design and API of the official judge0-python package.

Readme

@judge0/judge0-js

License: MIT

The JavaScript SDK for Judge0 (@judge0/judge0-js) — a faithful port of the official judge0-python design and API.

import { run, PYTHON } from '@judge0/judge0-js';

const result = await run({
  source_code: 'print("hello, world")',
  language: PYTHON,
});

console.log(result.stdout);

Installation

npm install @judge0/judge0-js

Quick Start

Getting the API Key

Get your API key from RapidAPI or ATD.

Judge0 has two flavors: Judge0 CE and Judge0 Extra CE. When using Rapid or ATD you may need to subscribe to both if you want access to all languages.

Using Your API Key

Option 1: Explicit Client

import { RapidJudge0CE, run } from '@judge0/judge0-js';

const client = new RapidJudge0CE('your-rapid-api-key');

const result = await run({
  client,
  source_code: 'print("hello, world")',
  language: 'PYTHON',
});

console.log(result.stdout);

Available clients:

  • RapidJudge0CE
  • ATDJudge0CE
  • RapidJudge0ExtraCE
  • ATDJudge0ExtraCE
  • Judge0CloudCE (preview endpoint)

Option 2: Implicit Client (Recommended for most cases)

Set one of the following environment variables:

  • JUDGE0_RAPID_API_KEY
  • JUDGE0_ATD_API_KEY

The SDK will automatically create the appropriate client.

import { run, PYTHON } from '@judge0/judge0-js';

const result = await run({
  source_code: 'print("hello, world")',
  language: PYTHON,
});

console.log(result.stdout);

Examples

Hello, world

import { run, PYTHON } from '@judge0/judge0-js';

const result = await run({
  source_code: 'print("hello, world")',
  language: PYTHON,
});

console.log(result.stdout);

Running C

import { run, C } from '@judge0/judge0-js';

const sourceCode = `
#include <stdio.h>

int main() {
    printf("hello, world\\n");
    return 0;
}
`;

const result = await run({
  source_code: sourceCode,
  language: C,
});

console.log(result.stdout);

Running Java

import { run, JAVA } from '@judge0/judge0-js';

const sourceCode = `
public class Main {
    public static void main(String[] args) {
        System.out.println("hello, world");
    }
}
`;

const result = await run({
  source_code: sourceCode,
  language: JAVA,
});

console.log(result.stdout);

Reading From Standard Input

import { run, C } from '@judge0/judge0-js';

const sourceCode = `
#include <stdio.h>

int main() {
    int a, b;
    scanf("%d %d", &a, &b);
    printf("%d\\n", a + b);

    char name[10];
    scanf("%s", name);
    printf("Hello, %s!\\n", name);

    return 0;
}
`;

const stdin = `
3 5
Bob
`;

const result = await run({
  source_code: sourceCode,
  stdin,
  language: C,
});

console.log(result.stdout);

Test Cases

import { run, PYTHON } from '@judge0/judge0-js';

const results = await run({
  source_code: "print(f'Hello, {input()}!')",
  language: PYTHON,
  test_cases: [
    ["Bob", "Hello, Bob!"],                    // tuple-style (array)
    { input: "Alice", expected_output: "Hello, Alice!" },
    ["Charlie", "Hello, Charlie!"],
  ],
});

for (const [i, result] of results.entries()) {
  console.log(`--- Test Case #${i + 1} ---`);
  console.log(result.stdout);
  console.log(result.status);
}

Test Cases With Multiple Submissions

import { run, Submission, PYTHON, C } from '@judge0/judge0-js';

const submissions = [
  new Submission({
    source_code: "print(f'Hello, {input()}!')",
    language: PYTHON,
  }),
  new Submission({
    source_code: `
#include <stdio.h>

int main() {
    char name[10];
    scanf("%s", name);
    printf("Hello, %s!\\n", name);
    return 0;
}
    `,
    language: C,
  }),
];

const testCases = [
  ["Bob", "Hello, Bob!"],
  ["Alice", "Hello, Alice!"],
  ["Charlie", "Hello, Charlie!"],
];

const results = await run({
  submissions,
  test_cases: testCases,
});

for (let i = 0; i < submissions.length; i++) {
  console.log(`--- Submission #${i + 1} ---`);
  for (let j = 0; j < testCases.length; j++) {
    const result = results[i * testCases.length + j];
    console.log(`--- Test Case #${j + 1} ---`);
    console.log(result.stdout);
    console.log(result.status);
  }
}

Asynchronous Execution

import { asyncRun, wait, PYTHON } from '@judge0/judge0-js';

const submission = await asyncRun({
  source_code: 'print("hello, world")',
  language: PYTHON,
});

console.log(submission.stdout); // undefined / null (not finished yet)

await wait({ submissions: submission });

console.log(submission.stdout); // "hello, world\n"

Get Languages

import { getClient } from '@judge0/judge0-js';

const client = getClient();
const languages = await client.getLanguages();
console.log(languages);

Language Aliases

The SDK exports the same convenient aliases as the Python SDK:

PYTHON, PYTHON3, PYTHON_FOR_ML, C, CPP, JAVA, JAVASCRIPT,
BASH, GO, RUST, RUBY, PHP, CSHARP, KOTLIN, SWIFT, ...

You can use either the constants or language IDs / names.

Multi-file / Additional Files

import { File, run, PYTHON } from '@judge0/judge0-js';

const main = new File('main.py', 'print("from additional file")');

const result = await run({
  source_code: 'import main',
  additional_files: [main],
  language: PYTHON,
});

Browser / Vanilla Usage

A complete standalone example (no bundler required) is available in the repository:

# Start a local server (from repo root)
python3 -m http.server 8080

# Then open:
# http://localhost:8080/examples/vanilla.html

The example at examples/vanilla.html demonstrates real usage of the built SDK in the browser (with the necessary shims).

Environment Variables

| Variable | Client | |-------------------------|-------------------------| | JUDGE0_RAPID_API_KEY | RapidJudge0CE / Extra | | JUDGE0_ATD_API_KEY | ATDJudge0CE / Extra |

If no keys are provided, the SDK falls back to Judge0's public preview endpoints (suitable for testing and development).

Development

npm install
npm run build
npm test

License

MIT — same license as the original Judge0 Python SDK.