Skip to content

REP — Runtime Environment Protocol

Inject environment variables into browser apps at container runtime — with security classification, encryption, and integrity verification.

Every frontend framework resolves environment variables at build time via static string replacement. The resulting bundle is environment-specific — a bundle built for staging cannot be reused in production without rebuilding.

Containers are designed to be environment-agnostic artifacts, but frontend builds are environment-specific artifacts.

This means: one image per environment, broken CI/CD promotion, config changes require redeployment, and no security model for variables.

REP operates at the infrastructure layer — no build-tool plugins, no framework coupling. A lightweight Go gateway binary reads environment variables at container startup, classifies them by security tier, and injects them into HTML responses.

Security Classification

Three tiers: PUBLIC (plaintext), SENSITIVE (encrypted), SERVER (never sent). Prefix-based — no ambiguity.

Encrypted Variables

Sensitive vars are AES-256-GCM encrypted. Decrypted via single-use, rate-limited session keys.

Integrity Verification

HMAC-SHA256 integrity token + SRI hashing on every payload. Detect tampering in transit.

Hot Reload

Config changes push to the browser via SSE — no page reload, no redeployment.

ApproachSecurity ModelEncrypted VarsIntegrity CheckFramework AgnosticStandalone Binary
envsubst / sed on bundlesYes
Fetch /config.jsonYes
window.__ENV__ via shell scriptPartial
Build-tool plugins
REP3-tierAES-256-GCMHMAC + SRIYes~3MB Go
Container boot → Gateway reads REP_* env vars → Classifies → Encrypts sensitive → Signs payload
Request: Browser → [REP Gateway :8080] → [Upstream :80]
HTML responses get <script id="__rep__"> injected before </head>
All other responses pass through unmodified
import { rep } from '@rep-protocol/sdk';
// Synchronous — no loading state needed
const apiUrl = rep.get('API_URL');
const flags = rep.get('FEATURE_FLAGS');
// Encrypted — decrypted on demand
const key = await rep.getSecure('ANALYTICS_KEY');
// Hot reload — react to config changes
rep.onChange('FEATURE_FLAGS', (newValue) => {
console.log('Flags updated:', newValue);
});

Gateway

Go binary (~3MB). Zero dependencies. FROM scratch compatible. Proxy or embedded mode.

SDK

TypeScript. Zero runtime deps. ~1.5KB gzipped. Synchronous get(), async getSecure().

CLI

rep validate, rep typegen, rep lint, rep dev. Full development workflow.

Adapters

First-party React, Vue, and Svelte adapters with hot-reload-aware hooks/stores.

DocumentStatusVersion
REP-RFC-0001Active0.1.0
Security ModelActive0.1.0
ConformanceActive0.1.0

Specification documents are licensed under CC BY 4.0. Code is licensed under Apache 2.0.