> For the complete documentation index, see [llms.txt](https://docs.k9.io/key9-identity/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.k9.io/key9-identity/jsonair/2-install/2.3-compiling-jsonair.md).

# 2.3 Compiling JSONAir

JSONAir uses a standard Go toolchain and a `Makefile` for convenience. The end result is four standalone static binaries — the server, the agent, the encryption utility, and the admin web interface.

***

## Before You Start

Make sure you have:

* Go 1.26.2 or later installed (`go version` to confirm)
* The repository cloned locally:

```bash
git clone https://github.com/k9io/jsonair.git
cd jsonair
```

***

## Building with Make (Recommended)

The simplest way to build everything is to run `make` from the repository root. This will tidy the Go module dependencies and compile both binaries in one step.

```bash
make
```

This is equivalent to running:

```bash
make tidy
make build
```

The compiled binaries are placed in the `bin/` directory:

```
bin/
  jsonair/jsonair                        ← the JSONAir server
  jsonair-agent/jsonair-agent            ← the JSONAir agent
  jsonair-encrypt/jsonair-encrypt        ← the config data encryption tool
  jsonair-admin/jsonair-admin            ← the admin web interface
```

***

## Building Individual Components

If you only need one of the binaries, you can build them separately.

**Server only:**

```bash
make jsonair
```

**Agent only:**

```bash
make jsonair-agent
```

**Encryption tool only:**

```bash
make jsonair-encrypt
```

**Admin web interface only:**

```bash
make jsonair-admin
```

***

## Building Directly with Go

You can also build without `make` using the Go toolchain directly.

**Server:**

```bash
go build -o bin/jsonair/jsonair ./cmd/jsonair
```

**Agent:**

```bash
go build -o bin/jsonair-agent/jsonair-agent ./cmd/jsonair-agent
```

**Encryption tool:**

```bash
go build -o bin/jsonair-encrypt/jsonair-encrypt ./cmd/jsonair-encrypt
```

**Admin web interface:**

```bash
go build -o bin/jsonair-admin/jsonair-admin ./cmd/jsonair-admin
```

***

## Running the Tests

```bash
go test ./...
```

***

## Cleaning Build Artifacts

To remove the `bin/` directory and start fresh:

```bash
make clean
```

***

## Cross-Compilation

Because JSONAir has no C dependencies, it cross-compiles cleanly using Go's built-in support. Set `GOOS` and `GOARCH` before the build command to target a different platform.

**Example — build the server for Linux (amd64) on a Mac:**

```bash
GOOS=linux GOARCH=amd64 go build -o bin/jsonair/jsonair ./cmd/jsonair
```

**Common targets:**

| Platform                        | GOOS     | GOARCH  |
| ------------------------------- | -------- | ------- |
| Linux 64-bit                    | `linux`  | `amd64` |
| Linux ARM64 (e.g. AWS Graviton) | `linux`  | `arm64` |
| macOS Intel                     | `darwin` | `amd64` |
| macOS Apple Silicon             | `darwin` | `arm64` |
