A root-cause-first implementation of the Sonic Topography PRD: a neon, audio-reactive globe that visualizes regional music genres as a living frequency mesh.
- Canonical data contract in
data/regions.jsonwith schema validation at the source boundary. - Pure domain core (
src/core/*) covering validation, geo math, proximity evaluation, crossfade math, mesh construction, and camera focus computation. - Canonical genre color mapping module (
src/data/genreColorMap.ts) that enforces the PRD palette consistently across the dataset. - TDD coverage for the core domain layer using Node's built-in test runner.
- Runtime architecture (React + Vite + React Three Fiber + Zustand + Web Audio API) with shader-based neon lines, atmosphere fresnel, proximity-driven intensity, and scroll-to-cycle genre logic.
This environment cannot access the npm registry, so
npm installwill fail here. The steps below work in a normal development environment.
npm install
npm run devThen open the printed local URL (typically http://localhost:5173).
The core domain layer is validated with a compile-then-test workflow:
npm run testThis runs tsc -p tsconfig.test.json followed by node --test on the compiled artifacts.
- Path:
data/regions.json - Each entry must include:
id: stringname: stringcoordinates: [latitude, longitude]genres: { name, color, audioUrl, bpm }[]
Validation is enforced by validateRegions in src/core/schema.ts and applied at import time in src/data/regions.ts.
- Add new regions or genres in
data/regions.json. - Update canonical genre colors or aliases in
src/data/genreColorMap.ts. - Adjust proximity thresholds in
src/core/proximity.ts. - Tune mesh density and globe sizing in
src/config/globe.ts. - Tweak shader behavior in
src/shaders/*.