@devries-cameron20 / t3code Mirror · read-only / commits / 60aec28a9c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 22, 07:00 UTC

feat(marketing): fetch GitHub stars at build time (#29555)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 2, 2026 at 13:20 UTC 60aec28a9c6fdb7417a7382ec094ccc4984d0738
1 file changed +19 -1
apps/marketing/src/lib/site.ts
+19 -1
@@ -6,7 +6,25 @@ export const IOS_APP_STORE_URL =
6 export const ANDROID_PLAY_STORE_URL =
7 "https://play.google.com/store/apps/details?id=com.t3tools.t3code";
8
9 +// Runs at build time, so each deploy picks up the current count.
10 +async function fetchGithubStars(): Promise<string> {
11 + const token = process.env.GITHUB_TOKEN;
12 + try {
13 + const response = await fetch("https://api.github.com/repos/pingdotgg/t3code", {
14 + headers: token ? { Authorization: `Bearer ${token}` } : {},
15 + });
16 + if (!response.ok) throw new Error(`GitHub API responded ${response.status}`);
17 + const { stargazers_count: stars } = (await response.json()) as { stargazers_count: number };
18 + return stars < 1000 ? String(stars) : `${Math.floor(stars / 1000)}k+`;
19 + } catch (error) {
20 + // A deploy must not ship a made-up count; offline dev should still render.
21 + if (import.meta.env.PROD) throw new Error("Could not fetch GitHub stars", { cause: error });
22 + console.warn("Could not fetch GitHub stars", error);
23 + return "?";
24 + }
25 +}
26 +
27 export const MARKETING_STATS = {
10 - githubStars: "40k+",
28 + githubStars: await fetchGithubStars(),
29 users: "500,000",
30 } as const;