crossbind
GitHub

Build and ship JS apps.
Add C++ and Rust as needed.

npm create crossbind@beta
Get started

Free and open source under the MIT license.

Try in Playground
import { initNative, greet } from './native/greet.h';
import { fibonacci } from './native/math.rs';
 
await initNative();
 
console.log(await greet('crossbind'));
console.log(await fibonacci(90));
#pragma once
#include <string>
 
inline std::string greet(std::string name) {
return "Hello, " + name + "!";
}
pub fn fibonacci(n: i32) -> u64 {
let (mut a, mut b) = (0, 1);
for _ in 0..n {
(a, b) = (b, a + b);
}
a
}
# For library projects
npx crossbind build
# For app projects
npx crossbind app publish app-store
  • BrowsersChrome, Firefox, Safari
  • MobileiOS, Android
    crossbind apps · React Native
  • Server & EdgeNode.js, Cloudflare Workers
  • DesktopmacOS, Linux, Windows
    crossbind apps · Electron
  • WASIwasmtime 47+

Agent setup

Paste this into Claude Code, Codex, Cursor, Copilot or any coding agent:

Fetch and follow the instructions at https://crossbind.dev/agent/prompt.md to add crossbind to this project.

It installs the crossbind skill, adds crossbind to the project and checks one call from JavaScript. Read the instructions

From native source to every runtime.

crossbind takes C++ and Rust from wherever they live, builds them for every target and hands each platform what it loads, packaged for npm.

Use SQLite from JavaScript.

Run SQL queries against crossbind's library catalog. SQLite runs as WebAssembly in your browser.

#pragma once
 
#include <sqlite3.h>
 
#include <stdexcept>
#include <string>
 
class Database {
public:
Database() {
if (sqlite3_open(":memory:", &handle) != SQLITE_OK) throw std::runtime_error("cannot open the database");
}
 
~Database() { sqlite3_close(handle); }
 
std::string version() { return sqlite3_libversion(); }
 
void exec(const std::string& sql) { run(sql); }
 
std::string query(const std::string& sql) {
rows = "[";
run(sql);
rows += "]";
return rows;
}
 
private:
void run(const std::string& sql) {
char* message = nullptr;
if (sqlite3_exec(handle, sql.c_str(), collect, this, &message) == SQLITE_OK) return;
const std::string reason = message ? message : "unknown error";
sqlite3_free(message);
throw std::runtime_error(reason);
}
 
static int collect(void* owner, int count, char** values, char** names) {
Database* self = static_cast<Database*>(owner);
if (self->rows.size() > 1) self->rows += ",";
self->rows += "{";
for (int column = 0; column < count; column += 1) {
if (column) self->rows += ",";
self->rows += quote(names[column]) + ":" + (values[column] ? quote(values[column]) : "null");
}
self->rows += "}";
return 0;
}
 
static std::string quote(const char* text) {
std::string out = "\"";
for (const char* character = text; *character; character += 1) {
if (*character == '"' || *character == '\\') out += '\\';
out += *character;
}
return out + "\"";
}
 
sqlite3* handle = nullptr;
std::string rows;
};
import { initNative, Database } from './native/database.h';
import { catalogAsSql } from './catalog.js';
 
await initNative();
const db = await new Database();
await db.exec(catalogAsSql);
 
const rows = await db.query(`
`);
The first run downloads 1.5 MB of WebAssembly.Try in Playground →

Drop in prebuilt C and C++ libraries.

All 16 libraries →
Type to search every guide page and section.
↑↓ navigate↵ openesc close