crossbind
GitHub

Import C++ and Rust
like JavaScript modules.

No bindings, no glue, no second build system. One import runs in the browser, on iOS and Android, in Node, on Workers, and as a WASI command.

Get started

Free and open source under the MIT license.

src/main.js
import { initNative, Matrix } from './native/Matrix.h';
import { GDALVersionInfo } from '@crossbind/port-gdal/gdal.h';
 
await initNative();
 
const a = new Matrix(1210000, 1);
const b = new Matrix(1210000, 2);
const result = a.multiple(b);
 
console.log(result.get(0), GDALVersionInfo('RELEASE_NAME'));
src/main.js
import { initNative, Uuid } from 'cargo:uuid';
import { Version, VersionReq } from 'cargo:semver';
 
await initNative();
 
const id = Uuid.newV4().toString();
const ok = new VersionReq('^1.2').matches(new Version('1.4.0'));
 
console.log(id, ok);
✓SAME CODE · FIVE RUNTIMES
Browser
Chrome · Firefox · Safari
Node.js
CJS or ESM
React Native
iOS + Android · JSI
CF Workers
Edge · single-threaded
WASI
wasmtime 47+ · wasip3

Set up with an AI agent

1

Install the skill

RECOMMENDED

Your agent gets the project inspector, the current port catalog and the per-framework playbooks. Then you ask for crossbind in plain words; there is nothing to paste.

npx skills add https://github.com/crossbind/crossbind/tree/main/agents/skills --global --yes

Drop --global to install it into this project only.


2

Or paste this prompt

No skill installed? Paste this one-off prompt into Claude Code, Cursor, Copilot or any other agent; it points them at the Markdown docs and walks through the setup.

Add crossbind to this project so I can call C++ or Rust from JavaScript/TypeScript. Inspect the repository, implement the integration, and verify it.

Start with the crossbind documentation index at https://crossbind.dev/llms.txt and follow the links relevant to this project. If the crossbind skill is already available, use it.

1. Identify the package manager, framework or bundler, target runtimes, existing native sources, and any crossbind configuration.
2. Choose the integration, compatible package versions, release channel, and platform variants from the documentation. Prefer supported prebuilt ports and generated bindings. Install every crossbind package, ports included, from the npm `beta` tag; the default tag is older.
3. Reuse existing native code. If none exists, add a minimal C++ example and call it from the application.
4. Configure the build and runtime initialization for the detected targets. Reuse existing configuration and dependency entries, preserve unrelated behavior, and apply platform requirements where relevant.
5. Run the relevant build and verify at least one JavaScript-to-native call. Report the changes, commands run, results, and anything you could not verify. Include the Wasm artifact size when one is produced.

Follow the repository's conventions and make the smallest complete integration. Ask for clarification only when missing information prevents a correct implementation.
LIVE · SQLITE, COMPILED BY CROSSBIND

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.

SQL
first run downloads 1.5 MB of WebAssembly
src/native/database.h
#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);

The database lives in this tab and nothing is uploaded. The wrapper is forty lines; the rest is upstream SQLite, precompiled. Libraries has the install flow.

Start fresh in under a minute.

The scaffolder asks five questions and prints a working repo — framework, bundler, target, and a sample C++ binding already wired. npm run dev works on the spot.

RUN
npm create crossbind@beta
FRAMEWORKS
ReactVueSvelteVanilla
BUNDLERS
ViteRspackWebpackRollupMetro
TARGETS
Web (WASM)React NativeNode.jsCloudflare Workers
terminal · ~/projects
> npm create crossbind@beta

FULL CAPABILITY MATRIX

26 capabilities · 9 platform details

Also in the box: Expo config plugin, memory64 targets, JSPI async (experimental), SWIG escape hatch, Android arm64 + x86_64, monorepo paths, write your own bundler plugin, CommonJS + ESM modules, clean dependency cache command.

PREBUILT LIBRARIES

Drop in real C++ libraries.

View all 16 →
GDAL
The geospatial stack — 200+ raster and vector formats
geo · 3.13.3install →
OpenSSL
TLS and crypto, real https from a WASI command
crypto · 4.0.3install →
SQLite
The database, in the browser and on device
database · 3.53.4install →
PROJ
Coordinate transforms with the EPSG database
geo · 9.9.0install →
GEOS
Planar geometry — buffers, overlays, predicates
geo · 3.15.0install →
libTIFF
TIFF read/write with JPEG, ZSTD and LERC codecs
image · 4.7.2install →
WebP
WebP encode and decode anywhere
image · 1.6.0install →
SpatiaLite
Spatial SQL on top of SQLite
database · 5.1.0install →
Type to search every guide page and section.
↑↓ navigate↵ openesc close