Skip to content
Closed
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
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ The provider detail page (`/providers/:addr`) is expensive — it queries **ever
| `COINGECKO_API_URL` | `https://api.coingecko.com/api/v3` | API |
| `KEYBASE_API_URL` | `https://keybase.io/_/api/1.0` | API |
| `NEXT_PUBLIC_API_URL` | `http://localhost:8080` | Web |
| `NEXT_PUBLIC_GA_ID` | (unset, GA disabled) | Web — Google Analytics 4 measurement ID. When set, the root layout renders `<GoogleAnalytics gaId>` from `@next/third-parties/google`. Layout calls `headers()` so the read happens per-request — wired via ECS task env from terraform `web_ga_id`, not baked into the bundle |
| `NODE_ENV` | `production` | Web |

## Not Covered (external data sources needed)
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"dependencies": {
"@info/shared": "workspace:*",
"@next/third-parties": "^16.2.4",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "^1.1.13",
"@tailwindcss/postcss": "^4.0.0",
Expand Down
11 changes: 10 additions & 1 deletion apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import type { Metadata, Viewport } from "next";
import { Inter } from "next/font/google";
import { headers } from "next/headers";
import { GoogleAnalytics } from "@next/third-parties/google";
import { Header } from "@/components/layout/Header";
import { Footer } from "@/components/layout/Footer";
import { ErrorBoundary } from "@/components/data/ErrorBoundary";
Expand Down Expand Up @@ -53,7 +55,13 @@ export const viewport: Viewport = {
userScalable: true,
};

export default function RootLayout({ children }: { children: React.ReactNode }) {
export default async function RootLayout({ children }: { children: React.ReactNode }) {
// headers() opts the layout out of static prerender so process.env is read
// per-request — needed because NEXT_PUBLIC_GA_ID is wired through ECS task
// env (terraform), not baked into the bundle at build time.
await headers();
const gaId = process.env.NEXT_PUBLIC_GA_ID;

return (
<html lang="en" className="dark" suppressHydrationWarning>
<body className={`min-h-screen bg-background antialiased ${inter.variable} ${inter.className}`}>
Expand All @@ -72,6 +80,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
<Footer />
</div>
</SwrProvider>
{gaId && <GoogleAnalytics gaId={gaId} />}
</body>
</html>
);
Expand Down
20 changes: 20 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading