EarthTwin is a React + TypeScript single-page app that renders a 3D interactive globe and simulates environmental metrics from a user's lifestyle.
This repository contains the frontend app (Vite). The project uses react-three-fiber (three.js) for 3D rendering, Tailwind CSS for styling, and Radix/shadcn UI primitives.
- Frontend: React + TypeScript, Vite
- 3D: react-three-fiber (three.js)
- UI: Tailwind CSS, Radix primitives, shadcn components
- Snapshot/capture:
src/components/ShareSnapshot.tsx(special handling for WebGL canvases and SVGs) - API wrapper:
src/lib/earthApi.ts
- Client-side mock fallbacks removed — app expects backend at
http://localhost:5000. - Earth globe sizing and masking fixed (canvas rounded to avoid visible corners).
- Snapshot improvements — canvases and inline SVGs are swapped to images before capture; Carbon Score is hidden during capture to produce a globe-only image.
Requirements: Node.js (LTS), npm
Install dependencies:
npm installRun dev server:
npm run devBuild for production:
npm run buildsrc/components/EarthGlobe.tsx— 3D globe and shaderssrc/components/ShareSnapshot.tsx— snapshot/capture logicsrc/components/MetricGauge.tsx— carbon score gaugesrc/lib/earthApi.ts— API wrapper