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

# CLI Reference

> Command-line interface for Crosslink

Crosslink has no single installed CLI binary. The canonical entrypoints are the workspace scripts in the monorepo, with a few root aliases for convenience.

## Services

### Start signaling and relay

```bash theme={null}
npm run stack
```

Starts both services on localhost.

## Development

### Build all packages

```bash theme={null}
npm run build
```

### Run tests

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

## Examples

### Run the echo host

```bash theme={null}
cd examples/echo-host
npm run dev
```

### Run the notes host

```bash theme={null}
cd examples/notes-host
npm run dev
```

### Run the todo host

```bash theme={null}
cd examples/todo-host
npm run dev
```

### Run the Electron chat example

```bash theme={null}
npm run dev -w @crosslink/example-electron-chat
```

### Run a workspace in remote mode

The same workspaces can be started with remote access already enabled — see [Remote Access](/guides/remote-access):

```bash theme={null}
node examples/echo-host/src/cli.ts --remote
node examples/todo-host/src/cli.ts --remote
CROSSLINK_NETWORK_MODE=remote npm run dev -w @crosslink/demo-chat
```

### Check remote-access readiness

```bash theme={null}
npm run check:remote
```

## Environment variables

| Variable                  | Description                                                                                                              | Default             |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------- |
| `PORT`                    | Signaling/relay service port                                                                                             | `8081` / `8082`     |
| `HOST`                    | Signaling/relay bind address                                                                                             | `0.0.0.0`           |
| `CROSSLINK_SIGNALING_URL` | Signaling URL (host SDK)                                                                                                 | *(auto-discovered)* |
| `CROSSLINK_RELAY_URL`     | Relay URL (host SDK)                                                                                                     | *(auto-discovered)* |
| `CROSSLINK_REDIS_URL`     | Shared signaling backplane                                                                                               | *(in-memory)*       |
| `CROSSLINK_REGION`        | Signaling/relay region label                                                                                             | *(none)*            |
| `CROSSLINK_SECRET_KEY`    | Passphrase for encrypted storage                                                                                         | *(none)*            |
| `CROSSLINK_DATA_DIR`      | Where the dev-token/stack config lives (`@crosslink/dev-tokens`). A host's own `storageDir` is a config field, not this. | `.crosslink-data`   |

## Troubleshooting

### Port already in use

```bash theme={null}
# Find what's using the port
lsof -i :8081

# Kill the process
kill <PID>
```

### Connection refused

```bash theme={null}
# Check if services are running
curl http://127.0.0.1:8081/health
curl http://127.0.0.1:8082/health
```

### Module not found

```bash theme={null}
# Ensure dependencies are installed
npm install

# Ensure you're using ESM
# package.json should have: "type": "module"
```
