Quick start
Two paths lead to the same place: scaffold a fresh project, or add crossbind to an app you already have. Either way you end up with a bundler plugin, a crossbind.config.js, and a header you can import from JavaScript.
Prerequisites
The web, WASI and Android toolchains ship as Docker images, so crossbind needs very little installed on your machine:
- Docker - runs the
webimage for WebAssembly and WASI and theandroidimage for Android. Both are pulled automatically on the first build. - Node.js 24+.
- CMake 3.28+ - mobile only.
- Xcode and CocoaPods - iOS only, macOS only.
- A Rust toolchain (
cargoplus the platform targets) - only when you bind Rust. See Rust. - wasmtime - only to run
platform: 'wasi'output and the prebuilt-bin-wasitools.
ln -s $(which node) /usr/local/bin/node.Set it up with a coding agent
Using Claude Code, Cursor, Copilot or similar? Install the skill once - your agent then carries the project inspector, the current port catalog and the per-framework playbooks, and you can ask it to add crossbind without pasting anything.
Drop --global to install it into this project only. Without the skill, hand over this prompt instead - it sends the agent to the Markdown docs, inspects the repo, installs the right packages, writes the config and wires your bundler or build script:
Prefer to do it yourself? Keep going.
A new project
The scaffolder wires the bundler, its plugin and a starter crossbind.config.js for you. Answer the prompts - if you are unsure, pick Web, React and Vite.
Every prompt can be preselected positionally, which is how CI and scripted setups create a project:
Then install and start the dev server - and skip to your first call.
An existing project
Already have an app? Install the plugin for your bundler and register it. Vite is shown here; Webpack, Rspack, Rollup and Metro follow the same shape with their own plugin - see Bundlers.
beta tag. When this page was built it resolved to [email protected] (changelog), @crossbind/[email protected] (which requires crossbind ^2.0.0-beta.62) and [email protected]. Each package keeps its own version; for a setup you can reproduce later, pin those exact ones:The plugin reads a crossbind.config.js from your project root. The minimal one is two lines - paths.config anchors every other path to this file, so it is never optional:
Everything else this file can carry is in Configuration.
Your first call
C++ lives under src/native. Declare the class in a header - the public surface has to be in the header, because that is what the binder reads.
Now import that header from your app code and call it. initNative() is exported by the header module itself; one call boots every native module you imported.
npm run dev compiles the wasm inside Docker and can take a while. After that the cache makes rebuilds incremental, and editing the header hot-reloads the page.Build for production
Nothing special: your bundler build triggers the release compile through the plugin.
Targeting Node, Cloudflare Workers, React Native or WASI instead? Each one is a crossbind build flag combination - see Runtimes.
Where to next
- C++ bindings - what the auto-binder accepts, and the C++ ↔ JS type table.
- Libraries - use a prebuilt library instead of compiling one.
- Filesystem - where files live in the browser, Node and on edge.
- Troubleshooting - when the first build does not go to plan.