From 15af652799355a5aaded3a1769b7b93d3f7ef8d6 Mon Sep 17 00:00:00 2001 From: Guanzhou Song Date: Mon, 3 Aug 2026 07:47:09 -0400 Subject: [PATCH] Hoist the GitHub stats into one shared constant The star and fork counts were hardcoded independently in app/page.tsx and app/ai/page.tsx with no shared constant, so they drifted: the homepage said 3.2k+ stars and 200+ forks while /ai said 3.4k+ and 240+. Both sections render adjacent copy about the project being built in the open, so a visitor moving between the two pages saw two different star counts. Neither figure was false - the + suffix covers the actual 3423 stars and 248 forks - but nothing stopped the next refresh from updating one page and leaving the other behind, which is exactly what happened when the AI page was refreshed in #121. Both pages now read from app/services/projectStats.ts, which also holds the TSC member and organization counts quoted on both pages (verified against upstream MAINTAINERS.md: 11 members across Microsoft 4, Amazon 4, AB InBev 1, Rippling 1, YugabyteDB 1). Values stay hardcoded rather than fetched so the build keeps no network dependency; the refresh command and the date last checked are recorded next to them. Addresses the second half of #128. The create_indexes_background row in the first half is content in documentdb/docs and needs a separate PR there. --- app/ai/page.tsx | 14 ++++++++++---- app/page.tsx | 14 ++++++++++---- app/services/projectStats.ts | 19 +++++++++++++++++++ 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 app/services/projectStats.ts diff --git a/app/ai/page.tsx b/app/ai/page.tsx index 68570d8..dd53b39 100644 --- a/app/ai/page.tsx +++ b/app/ai/page.tsx @@ -2,6 +2,12 @@ import Image from "next/image"; import Link from "next/link"; import CommandSnippet from "../components/CommandSnippet"; import { getMetadata } from "../services/metadataService"; +import { + documentdbGitHubForks, + documentdbGitHubStars, + documentdbTscMembers, + documentdbTscOrganizations, +} from "../services/projectStats"; import { withBasePath } from "../services/sitePath"; export const metadata = getMetadata({ @@ -166,17 +172,17 @@ const useCases = [ const credibilityPoints = [ { - value: "3.4k+", + value: documentdbGitHubStars, label: "GitHub stars", }, { - value: "240+", + value: documentdbGitHubForks, label: "Forks", }, { - value: "11", + value: documentdbTscMembers, label: "TSC members", - detail: "across 5 organizations", + detail: `across ${documentdbTscOrganizations} organizations`, }, ]; diff --git a/app/page.tsx b/app/page.tsx index fcbb05c..9372ed2 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -3,6 +3,12 @@ import Link from "next/link"; import CommandSnippet from "./components/CommandSnippet"; import { documentdbKubernetesOperatorDocsUrl } from "./services/externalLinks"; import { getMetadata } from "./services/metadataService"; +import { + documentdbGitHubForks, + documentdbGitHubStars, + documentdbTscMembers, + documentdbTscOrganizations, +} from "./services/projectStats"; import { withBasePath } from "./services/sitePath"; export const metadata = getMetadata({ @@ -131,19 +137,19 @@ const trustBadges = [ const credibilityPoints = [ { - value: "3.2k+", + value: documentdbGitHubStars, label: "GitHub stars", detail: "on documentdb/documentdb", }, { - value: "200+", + value: documentdbGitHubForks, label: "Public forks", detail: "public on GitHub", }, { - value: "11", + value: documentdbTscMembers, label: "TSC members", - detail: "representing 5 organizations", + detail: `representing ${documentdbTscOrganizations} organizations`, }, ]; diff --git a/app/services/projectStats.ts b/app/services/projectStats.ts new file mode 100644 index 0000000..fbb1902 --- /dev/null +++ b/app/services/projectStats.ts @@ -0,0 +1,19 @@ +// Single source for the upstream project figures quoted on marketing pages. +// They were previously hardcoded independently on / and /ai, drifted apart, +// and then went stale - a visitor moving between the two pages saw two +// different star counts. +// +// Deliberately not fetched at build time: that would add a network dependency +// (and a rate-limited, unauthenticated one) to every build. Refresh by hand: +// +// curl -s https://api.github.com/repos/documentdb/documentdb \ +// | jq '{stars: .stargazers_count, forks: .forks_count}' +// +// Last checked 2026-08-03: 3423 stars, 248 forks. +export const documentdbGitHubStars = '3.4k+'; +export const documentdbGitHubForks = '240+'; + +// From upstream MAINTAINERS.md: 11 members across Microsoft (4), Amazon (4), +// AB InBev (1), Rippling (1), and YugabyteDB (1). +export const documentdbTscMembers = '11'; +export const documentdbTscOrganizations = '5';