Complexity: Trivial - 100 Points · type:dx
Milestone: M4 - Merchant surface
Band lever: none
Context
apps/web/lib/api.ts:76 reads
process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8787". The fallback is
right for local development and wrong everywhere else.
Problem
NEXT_PUBLIC_* values are baked at build time, so forgetting this variable on a
deployed build is not caught by anything at deploy time. Every dashboard request
then targets localhost:8787 in the visitor's browser — connection refused,
with no error message naming the real cause. docs/MAINNET.md already calls out
this exact class of footgun for NEXT_PUBLIC_STELLAR_NETWORK; this variable has
the same failure mode and no such note.
What needs to be done
- Keep the localhost fallback only when
process.env.NODE_ENV !== "production".
- In a production build with the variable unset, fail loudly — throw at module
load, or render a clear configuration error rather than issuing doomed
requests.
- Document the variable alongside
NEXT_PUBLIC_STELLAR_NETWORK in
docs/MAINNET.md and .env.public.example, with the same "rebuild after
changing" warning.
Key files
apps/web/lib/api.ts:76 — BROWSER_BASE
docs/MAINNET.md — the existing NEXT_PUBLIC_* footgun section
.env.public.example
Done when
Tracked in ISSUES.md — issue 5.9.
Complexity: Trivial - 100 Points ·
type:dxMilestone: M4 - Merchant surface
Band lever: none
Context
apps/web/lib/api.ts:76readsprocess.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8787". The fallback isright for local development and wrong everywhere else.
Problem
NEXT_PUBLIC_*values are baked at build time, so forgetting this variable on adeployed build is not caught by anything at deploy time. Every dashboard request
then targets
localhost:8787in the visitor's browser — connection refused,with no error message naming the real cause.
docs/MAINNET.mdalready calls outthis exact class of footgun for
NEXT_PUBLIC_STELLAR_NETWORK; this variable hasthe same failure mode and no such note.
What needs to be done
process.env.NODE_ENV !== "production".load, or render a clear configuration error rather than issuing doomed
requests.
NEXT_PUBLIC_STELLAR_NETWORKindocs/MAINNET.mdand.env.public.example, with the same "rebuild afterchanging" warning.
Key files
apps/web/lib/api.ts:76—BROWSER_BASEdocs/MAINNET.md— the existingNEXT_PUBLIC_*footgun section.env.public.exampleDone when
Tracked in
ISSUES.md— issue 5.9.