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

# FastEdge CLI

During FastEdge application development, deploying to the edge on every change is slow. `fastedge-run` eliminates that step: it runs the compiled Wasm binary locally and serves it over HTTP, so the application can be tested from the terminal without a new deployment.

<Info>
  The CLI is also bundled with the [FastEdge VS Code extension](https://github.com/G-Core/FastEdge-vscode). If you use VS Code, no separate installation is needed.
</Info>

## Install

### Download a pre-built binary

Pre-built binaries are available for all major platforms on the [FastEdge-lib releases page](https://github.com/G-Core/FastEdge-lib/releases).

| Platform              | File                                                     |
| --------------------- | -------------------------------------------------------- |
| macOS (Apple Silicon) | `fastedge-run-{version}-aarch64-apple-darwin.tar.gz`     |
| Linux (x86\_64)       | `fastedge-run-{version}-x86_64-unknown-linux-gnu.tar.gz` |
| Windows (x86\_64)     | `fastedge-run-{version}-x86_64-pc-windows-msvc.zip`      |

Download and extract the archive, then move the `fastedge-run` binary to a directory on your `PATH`.

### Build from source

If no pre-built binary is available for your platform, build from source:

1. Install Rust:

```bash theme={null}
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
```

2. Clone the repository and initialize submodules:

```bash theme={null}
git clone https://github.com/G-Core/FastEdge-lib
cd FastEdge-lib
git submodule update --init --recursive -f
```

3. Build the CLI:

```bash theme={null}
cargo build --release
```

The binary is at `./target/release/fastedge-run`.

## Run a Wasm application

Start a local HTTP server that executes your compiled Wasm binary:

```bash theme={null}
fastedge-run http -w ./app.wasm --port 8080
```

Then send requests to test the application:

```bash theme={null}
curl http://localhost:8080
```

## Pass environment variables

Set environment variables the same way they would be configured in the Customer Portal:

```bash theme={null}
fastedge-run http -w ./app.wasm --env BASE=https://example.com --port 8080
```

Multiple variables can be passed by repeating `--env`:

```bash theme={null}
fastedge-run http -w ./app.wasm --env KEY1=value1 --env KEY2=value2 --port 8080
```

## Simulate geo headers

### Inject sample geo data

Use `--geo` to add a fixed set of sample geo headers to every incoming request:

```bash theme={null}
fastedge-run http -w ./app.wasm --geo --port 8080
```

The following headers are added to the request:

```
pop-continent: eu
pop-country-code: au
pop-country-name: luxembourg
pop-city: luxembourg
pop-reg: lu
pop-lat: 49.6113
pop-long: 6.1294
server_name: test.localhost
```

### Inject specific headers

Use `--headers` to set individual headers with exact values. This is useful when testing logic that depends on a specific country code or region:

```bash theme={null}
fastedge-run http -w ./app.wasm --headers pop-country-code=DE --headers pop-country-name=Germany --port 8080
```

Use `fastedge-run http --help` to see all available options.
