MCPcopy Index your code
hub / github.com/bytecodealliance/javy

github.com/bytecodealliance/javy @v9.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v9.0.0 ↗ · + Follow
578 symbols 1,634 edges 106 files 120 documented · 21% updated 2d agov9.0.0 · 2026-06-12★ 2,70220 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Javy

<strong>A <i>Jav</i>aScript to Webassembl<i>y</i> toolchain</strong>

A Bytecode Alliance project

<a href="https://github.com/bytecodealliance/javy/actions/workflows/ci.yml"><img alt="Build status" src="https://github.com/bytecodealliance/javy/actions/workflows/ci.yml/badge.svg?branch=main" /></a>
<a href="https://bytecodealliance.zulipchat.com/#narrow/stream/370816-javy"><img src="https://img.shields.io/badge/zulip-join_chat-brightgreen.svg" alt="zulip chat" /></a>

About this repo

Introduction: Run your JavaScript on WebAssembly. Javy takes your JavaScript code, and executes it in a WebAssembly embedded JavaScript runtime. Javy can create very small Wasm modules in the 1 to 16 KB range with use of dynamic linking. The default static linking produces modules that are at least 869 KB in size.

Installation

Pre-compiled binaries of the Javy CLI can be found on the releases page.

Example

Define your JavaScript like:

// Read input from stdin
const input = readInput();
// Call the function with the input
const result = foo(input);
// Write the result to stdout
writeOutput(result);

// The main function.
function foo(input) {
    return { foo: input.n + 1, newBar: input.bar + "!" };
}

// Read input from stdin
function readInput() {
    const chunkSize = 1024;
    const inputChunks = [];
    let totalBytes = 0;

    // Read all the available bytes
    while (1) {
        const buffer = new Uint8Array(chunkSize);
        // Stdin file descriptor
        const fd = 0;
        const bytesRead = Javy.IO.readSync(fd, buffer);

        totalBytes += bytesRead;
        if (bytesRead === 0) {
            break;
        }
        inputChunks.push(buffer.subarray(0, bytesRead));
    }

    // Assemble input into a single Uint8Array
    const { finalBuffer } = inputChunks.reduce((context, chunk) => {
        context.finalBuffer.set(chunk, context.bufferOffset);
        context.bufferOffset += chunk.length;
        return context;
    }, { bufferOffset: 0, finalBuffer: new Uint8Array(totalBytes) });

    return JSON.parse(new TextDecoder().decode(finalBuffer));
}

// Write output to stdout
function writeOutput(output) {
    const encodedOutput = new TextEncoder().encode(JSON.stringify(output));
    const buffer = new Uint8Array(encodedOutput);
    // Stdout file descriptor
    const fd = 1;
    Javy.IO.writeSync(fd, buffer);
}

Create a WebAssembly binary from your JavaScript by:

javy build index.js -o destination/index.wasm

For more information on the commands you can run javy --help

You can then execute your WebAssembly binary using a WebAssembly engine:

$ echo '{ "n": 2, "bar": "baz" }' | wasmtime index.wasm
{"foo":3,"newBar":"baz!"}%   

Documentation

Read the documentation here

Extension points exported contracts — how you extend this code

OptionValue (Interface)
Represents all values that can be parsed. [4 implementers]
crates/cli/src/option.rs
JavyBuiltins (Interface)
(no doc)
npm/javy/src/index.ts
GroupDescriptor (Interface)
(no doc)
crates/cli/src/option.rs
GroupOptionBuilder (Interface)
(no doc)
crates/cli/src/option.rs

Core symbols most depended-on inside this repo

join
called by 109
crates/profiler-lib/src/interpreter.rs
push
called by 89
crates/profiler-lib/src/interpreter.rs
build
called by 45
crates/runner/src/lib.rs
get
called by 38
crates/cli/src/js_config.rs
input
called by 35
crates/runner/src/lib.rs
path
called by 25
crates/runner/src/lib.rs
with
called by 21
crates/profiler-lib/src/interpreter.rs
parse
called by 21
crates/codegen/src/js.rs

Shape

Function 309
Method 196
Class 58
Enum 11
Interface 4

Languages

Rust87%
TypeScript13%

Modules by API surface

crates/profiler-lib/src/interpreter.rs46 symbols
crates/runner/src/lib.rs44 symbols
crates/profiler-lib/src/state.rs40 symbols
crates/cli/tests/integration_test.rs40 symbols
crates/codegen/src/js.rs27 symbols
crates/javy/src/config.rs26 symbols
crates/codegen/src/lib.rs18 symbols
crates/cli/src/commands.rs18 symbols
crates/profiler-lib/src/lib.rs16 symbols
crates/cli/src/plugin.rs14 symbols
release/src/lib.rs13 symbols
crates/codegen/src/plugin.rs13 symbols

For agents

$ claude mcp add javy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page