crossbind
GitHub

Import C++ and Rust
like JavaScript modules.

npm create crossbind@beta
Get started

Free and open source under the MIT license.

Run
import { initNative, greet } from './native/greet.h';
import { fibonacci } from './native/math.rs';
import {
sqlite3_libversion,
} from '@crossbind/port-sqlite3/sqlite3.h';
import { Uuid } from 'cargo:uuid';
import { zlibVersion } from 'conan:zlib/zlib.h';
 
await initNative();
 
const id = await Uuid.newV4();
 
console.log(await greet('crossbind'), await fibonacci(90));
console.log(await sqlite3_libversion());
console.log(await id.toString(), await zlibVersion());
#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
}
import db from '@crossbind/port-sqlite3-wasm/crossbind.config.js';
 
export default {
dependencies: [db],
cargoDependencies: {
uuid: '{ version = "1", features = ["v4"] }',
},
conanDependencies: {
zlib: '1.3.2',
},
paths: { config: import.meta.url },
};
  • 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.

Query a real C library, here.

This page boots the published SQLite port, seeds an in-memory database with its own library catalog and runs whatever you type. No server answers these queries.

src/native/database.hFull source ↗
#include <sqlite3.h>
 
class Database {
public:
Database() { sqlite3_open(":memory:", &handle); }
~Database() { sqlite3_close(handle); }
 
void exec(const std::string& sql);
std::string query(const std::string& sql);
 
private:
sqlite3* handle = nullptr;
};
src/main.js
import { initNative, Database } from './native/database.h';
 
await initNative();
const db = await new Database();
 
await db.exec(catalogAsSql);
const rows = await db.query(yourQuery);
SQL
The first run downloads 1.5 MB of WebAssembly.

Drop in prebuilt C and C++ libraries.

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