> ## Documentation Index
> Fetch the complete documentation index at: https://docs.runanywhere.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Packages, the three-process model, and packaging

## Packages

```bash theme={null}
npm ci
```

```json package.json theme={null}
{
  "dependencies": {
    "@runanywhere/electron": "^0.20.24",
    "@runanywhere/electron-llamacpp": "^0.20.24",
    "@runanywhere/electron-neurt": "^0.20.24",
    "@runanywhere/electron-onnx": "^0.20.24",
    "@runanywhere/electron-qhexrt": "^0.20.24",
    "@runanywhere/electron-sherpa": "^0.20.24",
    "@runanywhere/proto-ts": "^0.20.24"
  }
}
```

Every package carries its own prebuilt native binaries under
`node_modules/@runanywhere/<pkg>/prebuilds/<platform>-<arch>/`. Nothing compiles from source,
so `npm ci` is the whole staging step. Use `npm ci` rather than `npm install` so the committed
lock file decides the tree.

Node 20 or newer, per the package's own `engines` field.

## The three processes

This is the part with no equivalent in the other SDKs. Electron splits the SDK across process
roles, and each role imports a different subpath.

| Process      | Import                          | Role                                                      |
| ------------ | ------------------------------- | --------------------------------------------------------- |
| Main         | `@runanywhere/electron/main`    | Forks the utility host, resolves natives, owns the window |
| Preload      | `@runanywhere/electron/preload` | Exposes `window.runanywhere` across the context bridge    |
| Utility host | `@runanywhere/electron/host`    | Owns the native addon and runs inference                  |
| Anywhere     | `@runanywhere/electron`         | `createRunAnywhere`, types, input constructors            |
| Registration | `@runanywhere/electron/backend` | Backend registration                                      |
| Audio        | `@runanywhere/electron/audio`   | Audio helpers                                             |

A renderer cannot `require` a native addon, so renderer code never imports the package
directly. It uses `window.runanywhere`, which the preload puts there.

## Two backends

```ts theme={null}
import { createRunAnywhere, NativeBackend, RpcBackend } from '@runanywhere/electron'

// In-process: the addon is loaded here
const RunAnywhere = createRunAnywhere(new NativeBackend())

// Over RPC: talks to the utility host
const RunAnywhere = createRunAnywhere(new RpcBackend(send))
```

`NativeBackend` loads the addon in the current process. `RpcBackend` forwards to the utility
host, which is what keeps a heavy model load off the main process.

## Control-plane credentials

Optional. Copy `.env.example` to `.env` and fill in `RUNANYWHERE_BASE_URL` and
`RUNANYWHERE_API_KEY` to initialize in the production environment, which sends org-scoped
telemetry. With both blank the SDK initializes keyless, in development. Either way inference
stays on the machine. Real environment variables win over the file.

## Packaging

Native artifacts cannot load from inside `app.asar`, so everything under
`node_modules/@runanywhere/*/prebuilds/` has to be `asarUnpack`ed. Unpack both by extension
(`.node`, `.dylib`, `.dll`, `.so`) and by the whole `prebuilds/**` tree. The tree rule is what
covers QHexRT's `libqnnhtpv81.cat`, which is not a loadable image but whose absence makes the
Hexagon skel fail signature verification. That failure reads as a corrupt model rather than a
packaging fault, which is why it is worth getting right the first time.

Unpacking is only half of it. The paths `register()` computes point inside `app.asar`, where
Electron's fs shim makes them look real to JavaScript while the OS loader sees nothing. The
addon path and each plugin path have to be rewritten to `app.asar.unpacked` before use.

## Compute device

CPU. A `--gpu` flag asks for a CUDA build of the addon first and falls back to the CPU prebuild
when it is absent. The published packages ship no CUDA prebuild, so that fallback is what
happens today unless you supply a CUDA addon yourself.

## Windows installers

The published installers carry no Authenticode certificate, so SmartScreen warns on first run.
Local packages are unsigned for the same reason.
