Installation — SDK, CLI, and Gateway Binary
The SDK is the only package required for your application code. Zero runtime dependencies, ~1.5KB gzipped.
npm install @rep-protocol/sdkFramework adapters (optional)
Section titled “Framework adapters (optional)”If you’re using React, Vue, or Svelte, install the corresponding adapter for hot-reload-aware hooks and stores:
npm install @rep-protocol/react @rep-protocol/sdknpm install @rep-protocol/vue @rep-protocol/sdknpm install @rep-protocol/svelte @rep-protocol/sdkBuild-tool plugins (optional)
Section titled “Build-tool plugins (optional)”For the best dev experience, install the plugin for your build tool. These inject the REP payload during development so the SDK works without running the Go gateway:
npm install -D @rep-protocol/viteimport { defineConfig } from 'vite';import { repPlugin } from '@rep-protocol/vite';
export default defineConfig({ plugins: [repPlugin()],});That’s it — rep.get() and rep.getSecure() now work in vite dev. No gateway needed. See the Vite plugin reference for all options.
npm install -D @rep-protocol/nextimport type { ReactNode } from 'react';import { RepScript } from '@rep-protocol/next';
export default function RootLayout({ children }: { children: ReactNode }) { return ( <html> <head><RepScript /></head> <body>{children}</body> </html> );}// app/api/rep/session-key/route.ts (only needed for SENSITIVE vars)export { GET } from '@rep-protocol/next/session-key';RepScript renders the REP payload during next dev and returns null in production — the gateway handles injection in prod. See the Next.js plugin reference for all options.
The CLI provides rep validate, rep typegen, rep lint, and rep dev commands. It automatically downloads the correct gateway binary for your platform during installation.
npm install -g @rep-protocol/cliOr use without installing:
npx @rep-protocol/cli validatenpx @rep-protocol/cli dev --proxy http://localhost:5173Gateway binary
Section titled “Gateway binary”The gateway is a standalone Go binary (~7MB). There are several ways to get it:
Via the CLI (recommended)
Section titled “Via the CLI (recommended)”The @rep-protocol/cli package downloads the gateway binary automatically during npm install.
Docker image
Section titled “Docker image”docker pull ghcr.io/ruachtech/rep/gateway:latestOr use in a multi-stage build:
COPY --from=ghcr.io/ruachtech/rep/gateway:latest /usr/local/bin/rep-gateway /usr/local/bin/rep-gatewayDirect download
Section titled “Direct download”Download from GitHub Releases for your platform:
Archives are published on the version tag — v0.1.7, not gateway/v0.1.7:
# Linux amd64curl -fsSL https://github.com/RuachTech/rep/releases/download/v0.1.7/rep-gateway_0.1.7_linux_amd64.tar.gz | tar -xzmv rep-gateway /usr/local/bin/
# macOS arm64curl -fsSL https://github.com/RuachTech/rep/releases/download/v0.1.7/rep-gateway_0.1.7_darwin_arm64.tar.gz | tar -xzmv rep-gateway /usr/local/bin/To always fetch the newest release instead of a pinned version:
VERSION=$(curl -fsSL https://api.github.com/repos/RuachTech/rep/releases/latest | grep -m1 '"tag_name"' | cut -d'"' -f4)curl -fsSL "https://github.com/RuachTech/rep/releases/download/${VERSION}/rep-gateway_${VERSION#v}_linux_amd64.tar.gz" | tar -xzmv rep-gateway /usr/local/bin/Each release also ships a checksums.txt for verification.
Build from source
Section titled “Build from source”Requires Go >= 1.24.5:
cd gatewaymake build# Binary at gateway/bin/rep-gatewayDevelopment prerequisites
Section titled “Development prerequisites”For contributing to REP itself:
| Tool | Version | Purpose |
|---|---|---|
| Node.js | >= 20.0.0 | TypeScript packages |
| pnpm | >= 9.0.0 | Workspace management |
| Go | >= 1.24.5 | Gateway development |
git clone https://github.com/ruachtech/rep.gitcd reppnpm installpnpm run build