Docs/Decisions/ADR-0007 Frontend Public Config

ADR-0007: Frontend public configuration — runtime first, never a baked localhost

Status
accepted (revised: originally "baked at image build time")
Decided
August–September 2026; revised when release images became domain-independent
Deciders
Platform Engineering
Motivating failures
In the original hosted deployment: a sign-in outage caused by a tracked .env.production.local that baked the wrong origins; "Cookie not found" on signup because interim hostnames were baked before the final domain went live; a feature flag that was never passed to the build

Context

web/ and web-admin/ are Next.js apps. Next.js inlines NEXT_PUBLIC_* values into the client bundle when they are present during next build. Originally every origin (API, Keycloak, Code Intel, App Builder) and feature switch was a build argument, so each environment needed its own image, and an omitted argument silently baked a localhost default that broke sign-in on any real domain. Published release images must instead work on any domain.

Decision

Alternatives considered

OptionOutcome
Bake everything at build time (the original rule)Replaced: one image per environment, and a missed argument fails silently.
A separate /env.js routeRejected in favour of an inline script in the already-dynamic root layout: no extra blocking request (web/docs/RUNTIME-CONFIG.md).

Consequences

Positive

Negative / costs

Standing rule
No browser-facing URL may be localhost/127.0.0.1 on a server. Set the PUBLIC_* values (Compose) or chart values (Helm) to the real public origins; scripts/vegaduta doctor checks this.

Evidence & references