crossbind
GitHub

CLI

The crossbind command builds native code, builds and opens apps, and manages extensions, licenses, build containers and settings. Bundler plugins and React Native run crossbind build for you.

Commands at a glance

CommandDoes
buildcompiles the project
appbuilds an app, opens it on the dev server, or makes the key pair for its updates
addinstalls an extension and adds it to crossbind.config.js
licenseslists the licenses of the native dependencies
clean-depsdeletes the dependencies built from source
dockermanages the toolchain containers
runnerstarts, removes or scaffolds build runners
login, logout, usage, account deleteyour crossbind cloud account
configthe machine settings in ~/.crossbind/config.json

Run it from a package script or with npx crossbind. login, logout, usage, account, config and --version (-V) work anywhere; the other commands need a project in the current folder. --help after a command lists its options. Set DEBUG=1 to see the whole error of a failure.

build

shell
crossbind build -p wasm -a wasm32 -r st -e browser -b release
-p, --platform
wasm, wasi, android, ios, darwin, linux, linuxmusl, win32, or host for this machine's desktop platform.
Defaultwasm, wasi, android and ios; desktop platforms build only when named
-a, --arch
wasm32, wasm64, arm64-v8a, x86_64, iphoneos, iphonesimulator, arm64 or x64.
Defaultevery arch but wasm64
-r, --runtime
st (single-threaded) or mt (multithreaded).
Defaultboth
-b, --build-type
release or debug.
Defaultrelease
-e, --runtime-env
The binaries to make: browser, edge, node, native, wasi, http or app. See below.
Defaulttarget.runtimeEnv from crossbind.config.js; without it, only the archives
--rebuild-deps [list]
Builds all dependencies, or the ones named (comma-separated), from source into .crossbind/deps/. CROSSBIND_REBUILD_DEPS does the same.
Defaultthe prebuilt dependencies
--bind-imports
Also binds what the app's JavaScript imports into a browser module and writes browser/imports.json, for a page that resolves its imports itself, as the playground does. With a bundler, the plugin does this. Rust without a bundler needs @crossbind/core-embind-rust in the app's dependencies.
Defaulta browser module binds only the headers in paths.native

A list option takes commas or repeats: -p darwin,linux or -p darwin -p linux. Not every combination exists: android, ios and the desktop platforms build mt only, wasi and edge are single-threaded, and ios and darwin build only on a Mac (elsewhere they are skipped).

What -e makes on each platform:

  • On wasm: browser, edge and node each make a module and its loader.
  • On a desktop platform: node makes a Node-API addon, native an executable.
  • On wasi: wasi makes a command, http a wasi:http component.
  • On any app platform: app makes the app without its page, which app build adds. That is the app itself on darwin, linux and win32, and an Xcode or Gradle project on ios and android.
  • Android and iOS take no other value: React Native links their archives.

More in Browser, Node.js and Executables.

What it touches:

  • Each step runs in a container of the pinned toolchain image, or where Remote builds sends it. ios and darwin compile with Xcode on the Mac.
  • It writes the cache in .crossbind/, the output folder (paths.output, by default .crossbind/build) and shared caches in ~/.crossbind/cache/, which can be deleted whenever no build runs; a DOCKER_EXEC container is made again after.
  • A project with Conan packages or crates gets conan.lock and crossbind.cargo.lock next to its config.
  • It downloads the crates, Conan packages and sources a build needs.

app

shell
crossbind app dev
crossbind app build -p android
app dev [-p platform]
Opens the app on the dev server. Editing the page reloads it; editing native code rebuilds the host and opens the app again.
app dev -p ios --device [name]
Opens an iOS app on the connected iPhone or iPad, or the one named, instead of the Simulator.
app build [-p platform]
Builds the page and the host and writes the app to dist/.
app key [upload|updater]
Says which keys sign the app and where each is kept. app key upload makes this machine's upload key for Google Play; app key updater prints a new key pair for a desktop app's updates: the public key for app.updater.publicKey, the private key for CROSSBIND_UPDATER_PRIVATE_KEY where the app is built.

The project needs Vite and @crossbind/plugin-vite. -p is macos, linux, windows, ios or android; without it, crossbind takes CROSSBIND_APP_PLATFORM, else this machine's desktop platform. Vite's own options, such as --port or --mode, pass through to Vite.

What each platform's build writes is listed in Apps. app build -p android signs with this machine's debug key, or with the upload key CROSSBIND_ANDROID_KEYSTORE, CROSSBIND_ANDROID_KEY_ALIAS and CROSSBIND_ANDROID_KEYSTORE_PASSWORD name, and then also writes dist/<name>-android.aab, the bundle Google Play takes.

What it touches: Linux, Windows and Android apps build in the pinned Docker images, so they need RUNNER=DOCKER_RUN or DOCKER_EXEC. Android's Gradle caches stay in ~/.crossbind/cache/android/ and its debug key in ~/.crossbind/android/. An Android app opens through this machine's adb, which crossbind does not install. With --device, Xcode signs the app for its team with an account Xcode is signed in to, and registers the device with that team.

add

shell
crossbind add @crossbind/extension-clipboard
crossbind add ./crossbind-extension-greeter-0.1.0.tgz

Installs an extension package (a name, name@version or a path) with your project's package manager and adds it to extensions in crossbind.config.js. Running it again for the same package changes nothing. On Windows, the name or path cannot hold spaces, quotes or other characters the shell reads.

licenses

shell
crossbind licenses
crossbind licenses --check
crossbind licenses --notices --sbom

Prints each bundled native dependency with its SPDX license, native version and source URL, and marks the copyleft ones with !. It writes a file only when an option asks for one.

--notices [file]
Writes a third-party notices file in Markdown.
DefaultTHIRD-PARTY-NOTICES.md
--sbom [file]
Writes a CycloneDX SBOM.
Defaultsbom.cdx.json, or the path in the package's crossbind.provenance.sbom
--json [file]
Writes the list with each license text.
Defaultlicenses.json
--check
Exits non-zero when a license field is missing or not valid SPDX. With -e, also when the binary lacks a notice that a bundled runtime's license asks for.
--platform <platform>
Adds what that platform's binary links statically beyond the package graph: vendored copies and the toolchain runtime.
-e, --runtime-env node
Adds the crossbind runtime that an addon for --platform compiles in; without --platform, the one its loader bundles.
-e, --runtime-env app
Adds what an app carries beside its packages: crossbind's runtime, Hermes, JSI's jsi.cpp and webview/webview, for the app --platform names.
-e, --runtime-env native
Adds musl's libc, which a static musl executable links.
--package
With -e node: writes a Node-API package's LICENSE, sbom.cdx.json and the license field of its package.json.

clean-deps

crossbind clean-deps [names...] deletes the dependencies --rebuild-deps built from source (.crossbind/deps/), or only the ones named. The next build uses their prebuilt archives again.

docker

One container per toolchain image and project. [image] is web (the default), android, android-app, linux or windows.

CommandDoes
docker create [image]creates the long-lived container that RUNNER=DOCKER_EXEC runs steps in
docker start [image]starts it
docker stop [image]stops it
docker delete [image]removes it
docker run <program> [params...]runs one program in the web image as a build step would, in .crossbind/build
shell
crossbind docker create
crossbind config set RUNNER DOCKER_EXEC
crossbind build -p wasm

The default, RUNNER=DOCKER_RUN, needs none of these: it starts a fresh container of the pinned image for every step.

runner

runner start
Starts crossbind-local-runner-<role> in the local Docker and prints the commands that point builds at it.
runner delete
Stops and removes that container.
runner init <platform>
Writes a deploy folder for fly, cloudflare, cloudrun or azure and prints its steps with a new token. It starts nothing.

Their options:

--role
The toolchain the runner has: web, android, linux or windows. Every runner command takes it.
Defaultweb
--port
start: the port it listens on.
Default8787 to 8790, by role
--host
start: the address it listens on.
Default127.0.0.1
--token
start: the token builds send to it.
Default$CROSSBIND_RUNNER_TOKEN, else a new one
--dir
init: the folder to write.
Defaultcrossbind-runner-<platform>-<role>
--vcpu
init for cloudflare only: 1 to 4 vCPUs.

How builds use a runner: Remote builds.

login, logout, usage, account

login
Signs in to crossbind cloud: enter the printed code on crossbind.dev/device, signed in there with GitHub or Apple, then type the number the page shows, so it needs a terminal. The token is kept in ~/.crossbind/credentials.json.
logout [--all]
Forgets and revokes this machine's token. --all revokes the tokens of every machine signed in to the account.
usage
This month's cloud build time by image and what is left, and today's playground compiles left.
account delete --yes
Deletes the account and signs out every machine. Without --yes it deletes nothing.

They talk to CLOUD_URL: https://api.crossbind.dev unless ~/.crossbind/config.json or CROSSBIND_CLOUD_URL names another. Limits, and what the cloud keeps: Remote builds.

config

config get <key>
Prints the value and default of <key> and of every key whose name contains it.
config set <key> <value>
Sets a key in ~/.crossbind/config.json. An unknown key is refused.
config delete <key>
Removes a key, so its default applies again.
config list [-t all|system|project]
Prints the machine settings (system, the default). all adds the project's resolved configuration and project prints only that, so both need a project.
config keys
Lists every key with its description and default.

The keys:

RUNNER
Where toolchain steps run: DOCKER_RUN, DOCKER_EXEC, LOCAL or REMOTE. Environment: CROSSBIND_RUNNER.
DefaultDOCKER_RUN
REMOTE_URL, REMOTE_URL_WEB, REMOTE_URL_ANDROID, REMOTE_URL_LINUX, REMOTE_URL_WINDOWS
Runner addresses for RUNNER=REMOTE. Environment: the same names with a CROSSBIND_ prefix.
CLOUD_URL
The crossbind cloud of the account commands and cloud builds. Environment: CROSSBIND_CLOUD_URL.
Defaulthttps://api.crossbind.dev
XCODE_DEVELOPMENT_TEAM
The Xcode development team iOS builds sign with.
WASI_SDK_PATH
A local wasi-sdk, 34 or later, for WASI builds under RUNNER=LOCAL. Environment: CROSSBIND_WASI_SDK_PATH.
DOCKER_REGISTRY_MIRROR
A registry prefix to pull the pinned images from; the release digest stays. Environment: CROSSBIND_REGISTRY_MIRROR.
DOCKER_IMAGE_WEB, DOCKER_IMAGE_ANDROID, DOCKER_IMAGE_ANDROID_APP, DOCKER_IMAGE_LINUX, DOCKER_IMAGE_WINDOWS
An image to use instead of the pinned one. Without the release digest, builds are no longer reproducible. Environment: CROSSBIND_IMAGE_WEB and the like.

Runner tokens are not keys: CROSSBIND_TOKEN and CROSSBIND_TOKEN_<IMAGE> come only from the environment.

npm create crossbind

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

A separate package, create-crossbind, scaffolds a project from a template. It asks for a name, a folder and a template, and arguments answer in order: <dir> <group> <framework|variant> [<variant>]. The groups are Web, Mobile, Desktop, Backend, Cloud, Native, Library and Extension; -- --help lists every template. It writes the folder and prints the next steps; it installs nothing.

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