Lazy keys and real GPUs: shipping TerraGemini to GitHub
Shipped TerraGemini to GitHub as a clean standalone repo, but not before learning the hard way why you never trust scaffold artifacts over raw source code. The rescue started with a facepalm — an early plan assumed the app was an image uploader because stale audit notes from export time described a different build before anyone read RotatingEarth.tsx. Once grounded in reality, we stripped the AI Studio scaffolding, added @types/d3-geo and @types/topojson-client alongside an env.d.ts reference so npx tsc --noEmit passed clean, and migrated inline styles to Tailwind CSS 3. The architectural fix was in services/gemini.ts: replacing eager SDK initialization with a lazy getAI() guard that verifies VITE_GEMINI_API_KEY on demand, allowing the 3D globe to boot and spin freely with zero credentials. Because headless Chromium renders blank dark rectangles on WebGL canvases, we spun up a GPU-backed DevTools runner to capture Mount Fuji's AI intelligence card, styled satellite wireframe, and a 36-frame 10fps demo GIF (1.7MB). Shipped in two commits with a 1.28-second Vite production build and zero npm audit vulnerabilities.