Build and ship JS apps. Add C++ and Rust as needed.
Guide · Tutorial · Playground · Libraries · Examples
Import a C++ header or a Rust file from JavaScript and call what it declares. crossbind compiles the code for the platform your app runs on and generates the bindings, so there is no glue code to write.
// src/main.js
import { initNative, greet } from './native/greet.h';
import { fibonacci } from './native/math.rs';
await initNative();
console.log(await greet('crossbind')); // Hello, crossbind!
console.log(await fibonacci(90)); // 2880067194370816120n// src/native/greet.h
#pragma once
#include <string>
inline std::string greet(std::string name) {
return "Hello, " + name + "!";
}// src/native/math.rs
pub fn fibonacci(n: i32) -> u64 {
let (mut a, mut b) = (0, 1);
for _ in 0..n {
(a, b) = (b, a + b);
}
a
}Run it in the playground, or take the tutorial. Both run in your browser, with nothing to install.
The same import works everywhere; crossbind builds what each platform loads.
- Browser: WebAssembly, run in a Web Worker by default.
- Node.js and Electron: WebAssembly, or a native Node-API addon.
- Edge: WebAssembly on Cloudflare Workers and other edge runtimes.
- React Native: native iOS and Android libraries, called over JSI.
- Apps: your web page as a macOS, Linux, Windows, iOS or Android app, with the native code inside the app.
- Executables: command-line programs for macOS, Linux and Windows, and WASI commands.
crossbind 2.0 is in beta, so install it with @beta. You need Node.js 26 or
later and Docker, which runs the compilers; without Docker,
remote builds run them on another
machine. Mobile builds also need CMake 3.28 or later, and iOS builds a Mac with
Xcode and CocoaPods.
Create a project and answer the prompts (Web, React and Vite if you are unsure):
npm create crossbind@beta
cd my-app
npm install
npm run devThe first build downloads the toolchain image, so it takes a few minutes. Later builds only rebuild what changed.
Install the plugin for your bundler. For Vite:
npm install -D @crossbind/plugin-vite@beta// vite.config.js
import { defineConfig } from 'vite';
import viteCrossbindPlugin from '@crossbind/plugin-vite';
export default defineConfig({
plugins: [viteCrossbindPlugin()],
});// crossbind.config.js
export default {
paths: {
config: import.meta.url,
},
};Webpack, Rspack, Rollup and Metro have plugins too: see
Bundler plugins. Node.js, edge
and library projects build with the crossbind CLI.
Paste this line into your coding agent. It installs the crossbind skill, adds crossbind to the project and checks one call from JavaScript:
Fetch and follow the instructions at https://crossbind.dev/agent/prompt.md to add crossbind to this project.
Sixteen C and C++ libraries come prebuilt for every platform: GDAL, GEOS, PROJ,
GeoTIFF, SpatiaLite, SQLite, OpenSSL, cURL, zlib, Zstandard, libjpeg-turbo,
libTIFF, WebP, LERC, Expat and iconv. Install the package for your platform,
list it in crossbind.config.js and import its headers:
npm install @crossbind/port-gdal-wasm@beta// crossbind.config.js
import gdalWasm from '@crossbind/port-gdal-wasm/crossbind.config.js';
export default {
dependencies: [gdalWasm],
paths: { config: import.meta.url },
};// src/main.js
import { initNative, GDALOpenEx } from '@crossbind/port-gdal/gdal.h';
await initNative();Libraries lists the package of each library for
every platform. You can also import a crates.io crate with
cargo: and a ConanCenter package
with conan:.
- Guide: setup, platforms, apps, bindings and troubleshooting.
- API reference: every build and run-time option.
- Examples: apps to open and read.
- Changelog.
crossbind is a pnpm monorepo:
git clone https://github.com/crossbind/crossbind.git
cd crossbind
pnpm install
pnpm run doctor
pnpm testCONTRIBUTING.md explains the layout and the checks each change needs. Ask questions in Discussions and report bugs in Issues.
MIT. Copyright © 2026 Buğra Sarı and crossbind contributors.