crossbind
GitHub

Examples

Run C++ inside a browser app, a Node.js service, a Cloudflare Worker, a React Native app or a command-line tool. Each example is created with the site's own command, installed from npm, built and run; the commands and the output they produced are recorded as they happened.

Web

A browser app that calls C++ through the plugin for your bundler. Pick the framework and bundler you use; the C++ and the result are the same.

CREATE
npm create crossbind@beta -- my-app Web React Vite

Needs Node.js 24+, Docker (the toolchain image is pulled on the first build) and Playwright browsers for the e2e step.

Source: examples/web-react-vite ↗

RUN
shell
cd my-app
npm install
npm run build
npm run preview
# open http://localhost:4173
EXPECTED RESULT
The page shows Matrix multiplier with c++ => J₃ * (2*J₃) = 6*J₃, computed in C++. npm run e2e:prod checks that string in chromium, firefox and webkit (3 passed).
LIVE · THIS BUILD, RUNNING HEREOPEN ↗

Node.js

A Node.js script that boots the generated module and calls a C++ class; no bundler, the CLI builds the wasm.

CREATE
npm create crossbind@beta -- my-node Backend Node.js WebAssembly

Needs Node.js 24+ and Docker.

Source: examples/backend-nodejs-wasm ↗

RUN
shell
cd my-node
npm install
npm run build
node src/index.mjs
EXPECTED RESULT
npm run build runs crossbind build -p wasm -a wasm32 -r st -e node -b release and writes dist/*.node.js + dist/*.node.wasm; the script prints Matrix multiplier with c++ => J₃ * (2*J₃) = 6*J₃.

Cloudflare Worker

A Worker that answers HTTP requests from C++; the same wasm, single-threaded, in-memory filesystem.

CREATE
npm create crossbind@beta -- my-worker Cloud "Cloudflare Worker"

Needs Node.js 24+, Docker, and wrangler for the local run.

Source: examples/cloud-cloudflare-worker ↗

RUN
shell
cd my-worker
npm install
npm run build
npx wrangler dev --port 8787
# in a second terminal
curl http://localhost:8787/
EXPECTED RESULT
npm run build writes dist/*.edge.js + dist/*.edge.wasm; wrangler dev reports Ready on http://localhost:8787 and the request returns Hello World, greetings from c++. with status 200.

React Native (Expo)

An Expo app calling the same C++ over JSI as native machine code; no wasm on the phone. One project, both platforms.

CREATE
npm create crossbind@beta -- my-app Mobile "React Native" Expo

Needs Node.js 24+, Xcode with an iOS simulator, and CocoaPods.

Source: examples/mobile-reactnative-expo ↗

RUN
shell
cd my-app
npm install
npm run run:ios
EXPECTED RESULT
run:ios runs expo run:ios --configuration Release: it generates the native project, installs the pods, builds the app and starts it on the simulator; the screen shows Matrix multiplier with c++ => J₃ * (2*J₃) = 6*J₃.

WASI tools

Upstream GDAL command-line tools as npm executables, run by wasmtime: no compiler, no toolchain image, nothing to build.

INSTALL
npm install --global @crossbind/port-gdal-bin-wasi@beta

Needs wasmtime 47+ on PATH; Node.js only for npm itself.

Source: ports/gdal ↗

RUN
shell
gdalinfo-wasi --version
ogrinfo-wasi --formats
EXPECTED RESULT
gdalinfo-wasi --version prints GDAL 3.13.3 "Iowa City", released 2026/08/13; ogrinfo-wasi --formats lists the drivers, starting with MEM, PCIDSK and PDF.

Verified 11 September 2026 against crossbind 2.0.0-beta.56, projects created with [email protected].

Type to search every guide page and section.
↑↓ navigate↵ openesc close