Backend systems solved this problem long ago with runtime configuration. You build once and configure the application when it starts.
Static webapps never got a clean equivalent.
Most solutions today are ad-hoc: - env.sh scripts that rewrite bundles - CI pipelines rebuilding per environment - templating HTML files - framework-specific hacks
These approaches are fragile and tied to specific build tools.
I’ve been working on a small protocol called REP (Runtime Environment Protocol) that tries to solve this in a portable way.
The idea is simple: 1. Infrastructure provides configuration as environment variables. 2. A gateway injects them into the HTML response as a JSON payload. 3. The frontend reads them at runtime through a small SDK. 4. The payload is integrity-verified to prevent tampering.
example injected payload: <script id="__rep__" type="application/json"> { "public": { "API_URL": "https://api.example.com" }, "_meta": { "integrity": "sha256-..." } } </script>
The frontend can then read configuration at runtime instead of at build time.
This enables: • build once, deploy anywhere • environment configuration via infrastructure • compatibility with static hosting and CDNs • no rebuilds when configuration changes
The spec focuses on three things: • a standard payload format • secure integrity verification • predictable injection semantics
I’m sharing it mostly to get feedback from people who deal with deploying frontend apps at scale.
Spec: https://github.com/RuachTech/rep/blob/main/spec/REP-RFC-0001.md
URL: https://rep-protocol.dev
Curious if others have run into the same pain or solved this differently.