crossbind
GitHub

CLI

The crossbind package installs one command. Bundler plugins and React Native builds run the build for you; the other commands build and open apps, add their extensions, list licenses, manage the build containers and runners, sign in to crossbind cloud and edit the machine settings.

Commands at a glance

CommandDoesTouches
buildcompiles the projectDocker or a runner, the network, .crossbind/, paths.output
appbuilds the project as an app with its Vite, opens it on the dev server, or makes the key pair for its updateswhat build touches, dist/, ~/.crossbind/android/, the attached Android device, the iOS Simulator or the iPhone --device names
addinstalls an app extension's package and lists it in crossbind.config.jsthe project's package manager and the network, package.json, its lockfile, node_modules/, crossbind.config.js
licenseslists the licenses of the native dependenciesreads the project; writes only the files you ask for
clean-depsdeletes dependencies rebuilt from source.crossbind/deps/
dockermanages the toolchain containersDocker
runnerstarts, removes or scaffolds build runnersDocker (start, delete), a new folder (init)
login, logout, usage, account deleteyour crossbind cloud accountcrossbind cloud, ~/.crossbind/credentials.json
configthe machine settings~/.crossbind.json

Run it from a package script or with npx crossbind. login, logout, usage, account, config and --version (-V) work anywhere; the other commands load the project in the current folder before they read the command line, and fail outside one. --help after a command lists its options. A failure prints a short message; set DEBUG=1 to see the whole error.

build

shell
crossbind build -p wasm -a wasm32 -r st -e browser -b release
OptionValuesWithout it
-p, --platformwasm, wasi, android, ios, darwin, linux, linuxmusl, win32, or host for this machine's desktop platformwasm, wasi, android and ios; the desktop platforms build only when named
-a, --archwasm32, wasm64, arm64-v8a, x86_64, iphoneos, iphonesimulator, arm64, x64every arch but wasm64
-r, --runtimest, mtboth
-b, --build-typerelease, debugrelease
-e, --runtime-envbrowser, edge, node, native, wasi, http, apptarget.runtimeEnv from crossbind.config.js; with neither, only the archives
--rebuild-deps [list]all, or dependency names separated by commasprebuilt dependencies
--bind-importsnonea browser module binds only the headers in paths.native

A list option takes commas or repeats (-p darwin,linux or -p darwin -p linux), and a value outside its list stops with the allowed ones. The target matrix decides which combinations exist: android, ios and the desktop platforms build mt only, wasi and edge builds are single-threaded, and ios and darwin build on a Mac and are skipped elsewhere.

-e names the binaries to make: on wasm, browser, edge and node each give a module and its loader; on a desktop platform, node gives a Node-API addon and native an executable; on wasi, wasi gives a command and http a wasi:http component. app gives an app without its page, which app build adds, for each platform -p names: the app itself on darwin, linux and win32, its Xcode or Gradle project on ios and android. Otherwise Android and iOS take none, since React Native links the archives. See Browser, Node.js and Executables.

--rebuild-deps builds the named dependencies from source into .crossbind/deps/ instead of using their prebuilt archives; CROSSBIND_REBUILD_DEPS does the same from the environment. In a port with a crossbind.build.js recipe, build downloads the pinned upstream source, checks it against the SHA-256 the recipe pins and builds the archives.

--bind-imports also binds what the app's JavaScript imports (own headers and .rs files, port headers, cargo: and conan:) into a browser module, as a node module always does, and writes browser/imports.json beside it: each bound file, the bare specifiers that name it and its names. It is for a page that resolves those imports itself, as the playground does; with a bundler the plugin binds what it transforms. Rust without a bundler needs @crossbind/core-embind-rust among the app's dependencies.

Touches: under the default RUNNER, it pulls the pinned toolchain images and runs a container for each step (Remote builds moves the steps elsewhere); ios and darwin compile with Xcode on the Mac. It writes the cache in .crossbind/, the output folder (paths.output, .crossbind/build unless the config names another), conan.lock and crossbind.cargo.lock next to the config for a project with Conan packages or crates, and shared caches under ~/.crossbind/, and downloads crates, Conan packages and sources a build needs.

app

shell
crossbind app dev
crossbind app build -p android
CommandDoes
app dev [-p platform]opens the app on the dev server: an edit to the page reloads it, an edit to native code rebuilds the host and opens the app again
app dev -p ios --device [name]opens an iOS app on the iPhone or iPad connected, or on the one named, rather than in the Simulator
app build [-p platform]builds the page and the host and writes the app to dist/
app updater-keyprints a new key pair for a desktop app's updates: the public key for app.updater.publicKey, the private one for CROSSBIND_UPDATER_PRIVATE_KEY where the app is built

-p is macos, linux, windows, ios or android; without it the platform CROSSBIND_APP_PLATFORM names, else this machine's desktop app. Vite's own options, such as --port or --mode, pass through to Vite. app build -p linux and app build -p windows write the Linux and Windows apps for x64 and arm64, on a Mac as well. app build -p android writes dist/<name>-android.apk, signed 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 dist/<name>-android.aab, the bundle Google Play takes. The project needs target: { runtimeEnv: 'app' }, Vite and @crossbind/plugin-vite.

Touches: Linux, Windows and Android apps build in the pinned linux, windows and android-app images, so only under RUNNER=DOCKER_RUN or DOCKER_EXEC, and Gradle packages an Android app there with no network, keeping its caches and the debug key in ~/.crossbind/android/. An Android app opens on the attached device through this machine's adb, which crossbind does not install; an iOS app opens in the Simulator, or with --device on an iPhone or iPad, which Xcode signs for the app's team through the accounts it is signed in to and registers with that team.

add

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

Installs an app extension's package, by its name, name@version or a path to it, with the package manager the project's nearest lockfile names, else the one that runs crossbind, else npm. Then it lists the extension in crossbind.config.js: an import of its crossbind.extension.js and a call in extensions. A package package.json has already, given by its name alone, is listed without installing it again, and one the config lists already stays as it is. It stops before installing in a project that is no app, and lists nothing when the install fails, when the package is no extension, which stays installed, or when it lies outside paths.base, as a workspace's packages can, which is all a build sees: the message names the paths.base that takes it. On Windows, where the package manager runs in a shell, the name or path holds no spaces, quotes or characters the shell reads.

licenses

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

Prints one line per bundled native dependency - name, SPDX license, native version and source URL - and marks the copyleft ones with !. It reads the project and writes only the files you ask for.

OptionDoes
--notices [file]writes a third-party notices Markdown file, THIRD-PARTY-NOTICES.md by default
--sbom [file]writes a CycloneDX SBOM: sbom.cdx.json by default, or the path the package declares in crossbind.provenance.sbom
--json [file]writes the rows with their license texts, licenses.json by default
--checkexits non-zero when a license field is missing or not valid SPDX
--platform <platform>adds what that platform's artifact links statically beyond the package graph: vendored copies and the toolchain runtime
-e, --runtime-env nodeadds the crossbind runtime an addon of --platform compiles in, or without --platform the one its loader bundles
-e, --runtime-env appadds what an app carries beside its packages: crossbind's runtime, Hermes, JSI's jsi.cpp and webview/webview, adjusted to the app --platform names
--packagewith -e node: writes a Node-API package's LICENSE, sbom.cdx.json and package.json license field

clean-deps

crossbind clean-deps [names...] deletes .crossbind/deps/, the dependencies --rebuild-deps built from source, or only the ones named (by name, package name or alias). The next build goes back to their prebuilt archives unless it rebuilds them 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 RUNNER=DOCKER_EXEC runs steps in, with the project's base folder and crossbind's cargo and Conan caches mounted
docker start [image], docker stop [image]starts or stops it
docker delete [image]removes it
docker run <program> [params...]runs one program the way a build step runs, in the web image under the current RUNNER, with .crossbind/build as the working folder
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

CommandOptionsDoes
runner start--role (web, android, linux or windows; default web), --port (8787 to 8790 by role), --host (default 127.0.0.1), --token (default $CROSSBIND_RUNNER_TOKEN, else a new one)starts crossbind-local-runner-<role> in the local Docker and prints the commands that point builds at it
runner delete--rolestops and removes that container
runner init <platform>fly, cloudflare, cloudrun or azure; --role; --dir (default crossbind-runner-<platform>-<role>); --vcpu 1 to 4, for cloudflare onlywrites a deploy folder and prints its steps with a new token; starts nothing

How builds use a runner: Remote builds.

login, logout, usage, account

CommandDoes
loginsigns in to crossbind cloud with GitHub: prints a code to enter on github.com, then keeps the token in ~/.crossbind/credentials.json
logout [--all]forgets this machine's token and revokes it; --all revokes the tokens of every machine signed in to the account
usagethis month's cloud build time by image and what is left, and the playground compiles left today
account delete --yesdeletes the account and signs out every machine; without --yes it deletes nothing

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

config

CommandDoes
config get <key>prints the value and default of <key> and of every key whose name contains it
config set <key> <value>sets one key in ~/.crossbind.json, which is rewritten with every key, unset ones at their defaults; an unknown key, or a RUNNER value outside its four, 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 resolved project configuration and project prints it alone, so both need a project
config keyslists every key with its description and default
KeyDefaultSetsEnvironment
RUNNERDOCKER_RUNwhere toolchain steps run: DOCKER_RUN, DOCKER_EXEC, LOCAL or REMOTECROSSBIND_RUNNER
REMOTE_URL, REMOTE_URL_WEB, REMOTE_URL_ANDROID, REMOTE_URL_LINUX, REMOTE_URL_WINDOWS-runner addresses under RUNNER=REMOTEthe same name with a CROSSBIND_ prefix
CLOUD_URLhttps://api.crossbind.devthe crossbind cloud of the account commands and cloud buildsCROSSBIND_CLOUD_URL
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=LOCALCROSSBIND_WASI_SDK_PATH
DOCKER_REGISTRY_MIRROR-a registry prefix to pull the pinned images from; the release digest staysCROSSBIND_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 lose their reproducibility guaranteeCROSSBIND_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; arguments preselect them in order - <dir> <group> <framework|variant> [<variant>] - and -- --help lists the templates. The groups are Web, Mobile, Desktop, Backend, Cloud, Native and Library. It writes the new folder and prints the next steps; it installs nothing.

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