Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ This document lists every environment variable used by the RemitLend platform. E
| `SENTRY_AUTH_TOKEN` | — | ✓ | ✓ | — | Sentry auth token for source maps | `frontend/next.config.ts` |
| `NODE_ENV` | ✓ | ✓ | ✓ | `development` | Node environment (`development`, `test`, `production`) | `next.config.ts` |
| `NEXT_PUBLIC_STELLAR_EXPLORER_URL` | ✓ | ✓ | ✓ | `https://stellar.expert/explorer/testnet` | Stellar explorer base URL for transaction links | `frontend/src/components/ui/TxHashLink.tsx` |

| `NEXT_PUBLIC_STELLAR_NETWORK` | ✓ | ✓ | ✓ | `testnet` | Stellar network name shown in the build-info footer | `frontend/src/components/BuildInfoFooter.tsx` |
---

## Contracts / Scripts (`contracts/`, `scripts/`)
Expand Down
7 changes: 7 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ NODE_ENV=development
# Mainnet: https://stellar.expert/explorer/public
# Testnet: https://stellar.expert/explorer/testnet (default)
NEXT_PUBLIC_STELLAR_EXPLORER_URL=https://stellar.expert/explorer/testnet

# ── Build Info (auto-injected by next.config.ts) ─────────────────────────────
# These are set automatically at build time. Override only if needed.
# NEXT_PUBLIC_COMMIT_SHA — short git SHA, defaults to 'local' when git is unavailable
# NEXT_PUBLIC_APP_VERSION — read from package.json version field
# NEXT_PUBLIC_STELLAR_NETWORK — 'testnet' | 'mainnet', defaults to 'testnet'
NEXT_PUBLIC_STELLAR_NETWORK=testnet
4 changes: 4 additions & 0 deletions frontend/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@
"submit": "Build, Sign & Submit"
}
},
"BuildInfo": {
"ariaLabel": "Build information",
"label": "v{version} · {network} · {sha}"
},
"Lend": {
"cooldownActive": "Withdraw available in about {minutes} minute(s) while cooldown is active."
},
Expand Down
20 changes: 20 additions & 0 deletions frontend/next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import { execSync } from "child_process";
import createNextIntlPlugin from "next-intl/plugin";
import type { NextConfig } from "next";
import { withSentryConfig } from "@sentry/nextjs";
import withSerwistInit from "@serwist/next";
import packageJson from "./package.json" with { type: "json" };

/* ── Build-time environment variables ────────────────────────────────── */
function getCommitSha(): string {
try {
return execSync("git rev-parse --short HEAD").toString().trim();
} catch {
return "local";
}
}

const commitSha = getCommitSha();
const appVersion = packageJson.version;
const stellarNetwork = process.env.NEXT_PUBLIC_STELLAR_NETWORK ?? "testnet";

const withNextIntl = createNextIntlPlugin("./i18n.config.ts");

Expand All @@ -12,6 +27,11 @@ const withSerwist = withSerwistInit({

const nextConfig: NextConfig = {
reactCompiler: true,
env: {
NEXT_PUBLIC_COMMIT_SHA: commitSha,
NEXT_PUBLIC_APP_VERSION: appVersion,
NEXT_PUBLIC_STELLAR_NETWORK: stellarNetwork,
},
};

const config = withSerwist(nextConfig);
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import { notFound } from "next/navigation";
import type { Metadata } from "next";
import BuildInfoFooter from "@/components/BuildInfoFooter";

export const metadata: Metadata = {
manifest: "/manifest.webmanifest",
Expand All @@ -25,6 +26,7 @@ export default async function LocaleLayout({
return (
<NextIntlClientProvider messages={messages} locale={locale}>
{children}
<BuildInfoFooter />
</NextIntlClientProvider>
);
}
29 changes: 29 additions & 0 deletions frontend/src/components/BuildInfoFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"use client";

import { useTranslations } from "next-intl";

/**
* Displays a minimal build-info footer: version · network · commit SHA.
*
* All values come from NEXT_PUBLIC_* env vars injected at build time,
* so there are no hydration mismatches.
*
* TODO: fetch /version from the backend API once the endpoint exists.
*/
export default function BuildInfoFooter() {
const t = useTranslations("BuildInfo");

const version = process.env.NEXT_PUBLIC_APP_VERSION ?? "0.0.0";
const network = process.env.NEXT_PUBLIC_STELLAR_NETWORK ?? "testnet";
const sha = process.env.NEXT_PUBLIC_COMMIT_SHA ?? "local";

return (
<footer aria-label={t("ariaLabel")} className="print:hidden mt-8">
<div className="mx-auto max-w-7xl px-4 pb-4 sm:px-6 lg:px-8">
<p className="text-center text-xs text-muted-foreground">
{t("label", { version, network, sha })}
</p>
</div>
</footer>
);
}
Loading