# Prerequisites

Before building quicproquo you need a Rust toolchain and the Cap'n Proto schema compiler. Docker is optional but useful for reproducible builds and deployment.

---

## Rust toolchain

**Minimum supported Rust version: 1.77+ (stable)**

quicproquo uses the 2021 edition and workspace resolver v2. Any stable Rust release from 1.77 onward should work. Install or update via [rustup](https://rustup.rs/):

```bash
# Install rustup (if not already present)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Ensure you are on a recent stable release
rustup update stable
rustup default stable

# Verify
rustc --version   # should print 1.77.0 or later
cargo --version
```

The workspace depends on several crates that use procedural macros (`serde_derive`, `clap_derive`, `tls_codec_derive`, `thiserror`). These compile during the build step and require no additional system libraries beyond what `rustc` ships.

---

## Cap'n Proto compiler (`capnp`)

The `quicproquo-proto` crate runs a `build.rs` script that invokes the `capnp` binary at compile time to generate Rust types from the `.capnp` schema files in `schemas/`. The `capnp` binary must be on your `PATH`.

### Debian / Ubuntu

```bash
sudo apt-get update
sudo apt-get install -y capnproto
```

### macOS (Homebrew)

```bash
brew install capnp
```

### Verify installation

```bash
capnp --version
# Expected output: Cap'n Proto version X.Y.Z
```

If `capnp` is not found, the build will fail with an error from `capnpc::CompilerCommand`:

```
Cap'n Proto schema compilation failed. Is `capnp` installed?
(apt-get install capnproto / brew install capnp)
```

See [Building from Source -- Troubleshooting](building.md#troubleshooting) for more details.

### Other platforms

| Platform | Install command |
|---|---|
| Fedora / RHEL | `dnf install capnproto` |
| Arch Linux | `pacman -S capnproto` |
| Nix | `nix-env -iA nixpkgs.capnproto` |
| Windows (vcpkg) | `vcpkg install capnproto` |
| From source | [capnproto.org/install.html](https://capnproto.org/install.html) |

---

## Optional: Docker and Docker Compose

If you prefer to build and run quicproquo in containers, you will need:

- **Docker Engine** 20.10+ (or Docker Desktop)
- **Docker Compose** v2+ (the `docker compose` plugin, not the legacy `docker-compose` binary)

```bash
docker --version          # 20.10+
docker compose version    # v2+
```

The provided `docker/Dockerfile` is a multi-stage build that installs `capnproto` in the builder stage, so you do **not** need the `capnp` binary on your host when building via Docker.

See [Docker Deployment](docker.md) for full instructions.

---

## Summary checklist

| Dependency | Required? | How to check |
|---|---|---|
| Rust stable 1.77+ | Yes | `rustc --version` |
| `capnp` CLI | Yes (host builds) | `capnp --version` |
| Docker + Compose | No (container builds only) | `docker --version` / `docker compose version` |

Once all prerequisites are satisfied, proceed to [Building from Source](building.md).
