# How to Package the Brush Project for Deployment: Desktop, Web, and Android

> Learn to package the Brush project for deployment across desktop, web, and Android. Discover build commands for each platform and get your application ready.

- Repository: [Arthur Brussee/brush](https://github.com/ArthurBrussee/brush)
- Tags: how-to-guide
- Published: 2026-05-14

---

**To package the Brush project for deployment, build the desktop binary with `cargo build --release`, the web bundle with `npm run build` from `apps/brush-js/web`, or the Android APK with `cargo-ndk` followed by Gradle commands.**

The **Brush** repository by ArthurBrussee is a multi-crate Rust workspace that targets desktop, web, and Android platforms. Because each platform uses a different entry point and build toolchain, packaging the project for deployment requires platform-specific commands. This guide covers the exact steps to produce release binaries, WASM bundles, and Android APKs based on the current source code.

## Workspace Layout

The root [`Cargo.toml`](https://github.com/ArthurBrussee/brush/blob/main/Cargo.toml) defines a workspace containing executables in `apps/*` and libraries in `crates/*`. The three deployment targets correspond to distinct workspace members:

- `apps/brush-cli` → Desktop CLI binary
- `apps/brush-js/web` → Web front-end with WASM
- `crates/brush-app` → Android native library

## Packaging for Desktop

For macOS, Windows, and Linux, the `brush-cli` crate produces an optimized binary via standard Cargo commands. In [`apps/brush-cli/src/main.rs`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-cli/src/main.rs), the application entry point initializes the CLI interface that processes commands like `brush --help`.

Build the release binary with:

```bash
cargo build --release

```

The resulting binary appears at `./target/release/brush` (or `./target/release/brush.exe` on Windows). This artifact is self-contained and ready for distribution on the host platform.

## Packaging for Web (WASM)

The web deployment requires compiling Rust to WebAssembly using **wasm-pack**. The `apps/brush-js/web` directory contains a Vite-based front-end configured in [`vite.config.ts`](https://github.com/ArthurBrussee/brush/blob/main/vite.config.ts) to load the compiled WASM module.

First, install the required tooling:

```bash
cargo install wasm-pack

```

For development, start the hot-reload server:

```bash
npm run dev  # serves on http://localhost:3000

```

To create a production bundle for deployment:

```bash
npm run build

```

This generates a static `dist` directory containing the compiled WASM, JavaScript wrapper, and assets, suitable for any static web hosting provider.

## Packaging for Android

Android deployment requires the NDK toolchain and **cargo-ndk** to cross-compile the Rust code into a native shared library (`libbrush.so`). The `crates/brush-app` crate contains the Rust code, while the Gradle project in the same directory loads the library via `System.loadLibrary` as configured in `crates/brush-app/app/build.gradle.kts`.

First, set up the environment and tooling:

```bash
export ANDROID_NDK_HOME=$HOME/Android/Sdk/ndk/$(ndk-version)
export ANDROID_HOME=$HOME/Android/Sdk

rustup target add aarch64-linux-android
cargo install cargo-ndk

```

Build the native library for the `arm64-v8a` ABI:

```bash
cargo ndk -t arm64-v8a -o crates/brush-app/app/src/main/jniLibs/ build --release

```

Package and install the APK using Gradle:

```bash
cd crates/brush-app
./gradlew assembleDebug    # produces the APK

./gradlew installDebug     # installs on a connected device

```

## Summary

- **Desktop builds** use `cargo build --release` targeting `apps/brush-cli` to produce a binary in `target/release/`
- **Web builds** require `wasm-pack` and `npm run build` from `apps/brush-js/web` to generate a static `dist` folder
- **Android builds** need `cargo-ndk` to generate `libbrush.so` in `crates/brush-app/app/src/main/jniLibs/` before Gradle packages the APK
- Each platform uses distinct workspace members defined in the root [`Cargo.toml`](https://github.com/ArthurBrussee/brush/blob/main/Cargo.toml)

## Frequently Asked Questions

### What Rust version is required to package the Brush project?

The workspace requires Rust 1.88 or later to support the workspace dependencies and `burn` backend features used across the crates.

### Can I deploy the web build to a static hosting provider?

Yes, running `npm run build` in `apps/brush-js/web` generates a static `dist` directory containing the WASM module and JavaScript wrapper, compatible with any static web host or CDN.

### Why does the Android build require cargo-ndk instead of standard cargo?

Android requires architecture-specific native libraries (`.so` files) stored in `jniLibs`. The `cargo-ndk` tool automates the NDK toolchain invocation and places the compiled `libbrush.so` in the correct directory structure for Gradle to package into the APK, which standard Cargo cannot do alone.

### Where is the desktop binary located after building?

After running `cargo build --release`, the optimized binary is located at `target/release/brush` (or `target/release/brush.exe` on Windows), ready for distribution without additional runtime dependencies.