From 07d787c23c6bfdc5d802f5f1aca525a7a4a7bac2 Mon Sep 17 00:00:00 2001 From: Olumide-01 Date: Sat, 26 Sep 2026 20:54:27 +0100 Subject: [PATCH] docs(env): document NEXT_PUBLIC_APP_URL in all three places (#36) src/app/layout.tsx (metadataBase) and src/app/sitemap.ts both read NEXT_PUBLIC_APP_URL and fall back to http://localhost:3001, but the variable was undocumented, so production builds silently emitted localhost canonical/OG URLs and sitemap entries. Adds it to .env.example, the README Environment table, and docs/ENVIRONMENT.md, each noting that it must be set to the public origin in production. --- .env.example | 6 ++++++ README.md | 1 + docs/ENVIRONMENT.md | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 93349a9..b61cc91 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,12 @@ # Backend API base URL NEXT_PUBLIC_API_URL=http://localhost:3000 +# Public origin this frontend is served from. Used for canonical/OG URLs +# (metadataBase) and sitemap.xml entries. MUST be the public origin in +# production (e.g. https://stellartickets.app) — leaving it unset there +# silently emits http://localhost:3001 URLs. +NEXT_PUBLIC_APP_URL=http://localhost:3001 + # Must match the backend's STELLAR_NETWORK / the network Freighter is set to NEXT_PUBLIC_STELLAR_NETWORK=testnet NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015" diff --git a/README.md b/README.md index f8b33d7..f47451a 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,7 @@ See [`.env.example`](.env.example) for the full list. | Variable | Meaning | |---|---| | `NEXT_PUBLIC_API_URL` | Base URL of the [backend](https://github.com/StellarTickets/backend) API | +| `NEXT_PUBLIC_APP_URL` | Public origin this frontend is served from, used for canonical/OG URLs and `sitemap.xml`. **Must be the public origin in production** (e.g. `https://stellartickets.app`) — if it's left unset, production emits `http://localhost:3001` URLs | | `NEXT_PUBLIC_STELLAR_NETWORK` | `testnet` / `futurenet` / `mainnet` — must match the backend's `STELLAR_NETWORK` and whatever network the user's Freighter wallet is set to, or signed transactions will be rejected | | `NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE` | The matching network passphrase (e.g. `"Test SDF Network ; September 2015"` for testnet), used when building/verifying transactions client-side | | `NEXT_PUBLIC_TICKETING_CONTRACT_ID` | *Optional.* The deployed `ticketing` contract address (same as the backend's `TICKETING_CONTRACT_ID`). When set, published events link to the contract on stellar.expert (testnet/mainnet only) | diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md index e7ad4e0..ed748b7 100644 --- a/docs/ENVIRONMENT.md +++ b/docs/ENVIRONMENT.md @@ -5,9 +5,10 @@ See [`.env.example`](../.env.example): | Variable | Purpose | |---|---| | `NEXT_PUBLIC_API_URL` | Backend base URL | +| `NEXT_PUBLIC_APP_URL` | Public origin this frontend is served from, used for canonical/OG URLs and `sitemap.xml`. **Must be the public origin in production** (e.g. `https://stellartickets.app`) — it falls back to `http://localhost:3001` when unset | | `NEXT_PUBLIC_STELLAR_NETWORK` | Must match the backend's configured network | | `NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE` | Passed to Freighter when signing, must match the network above | -All three are `NEXT_PUBLIC_*` because they're read client-side (the +All of them are `NEXT_PUBLIC_*` because they're read client-side (the API base URL for `fetch`, the network passphrase for wallet signing) — none of them are secret.