14 KiB
GENOME.md — the-playground
Generated: 2026-04-17 10:00 UTC
Repo: Timmy_Foundation/the-playground
Analyzed commit: 142d77736de3b303ea5320dbd5dcfda99e59f325
Host issue: timmy-home #671
Project Overview
the-playground is a browser-first creative sandbox with a strong visual identity and a deliberately simple deployment model: open index.html or serve static files. It is not yet the full platform promised by the README. The current repo is a compact prototype shell with real interaction loops for sound, drawing, constellation play, gallery persistence, and export.
Current measured facts from the fresh main archive I analyzed:
- 14 JavaScript source files
- 1 CSS design system file
- 2 HTML entry pages (
index.html,smoke-test.html) - 1 Python test module in the target repo (
tests/test_perf_budgets.py) - 0 package manifests
- 0 build steps
pytest -q→7 passed in 0.03s- no backend or network API in the shipped app shell
What exists on main today:
- cinematic entrance screen
- three actual canvas/runtime modes:
free-drawambientconstellation
- a Web Audio engine for notes/chords/scales
- a Canvas 2D visual engine
- an IndexedDB-backed gallery
- export helpers for WAV, single-item download, ZIP packaging, and standalone HTML export
- perf budget artifacts and a dormant runtime performance monitor
- a browser smoke harness plus one pytest module for perf budget/pipeline presence
This repo is best understood as four layers:
- page shell + script-order runtime contract
- browser engines (
PlaygroundAudio,PlaygroundVisual,PlaygroundGallery) - experience/orchestration (
src/playground.js,ModeManager,constellation) - export/perf sidecars that are only partially integrated into the live app
Architecture
graph TD
HTML[index.html] --> CSS[src/styles/design-system.css]
HTML --> U[src/utils/utils.js]
HTML --> S[src/utils/state.js]
HTML --> E[src/utils/events.js]
HTML --> AE[src/engine/audio-engine.js]
HTML --> VE[src/engine/visual-engine.js]
HTML --> G[src/gallery/gallery.js]
HTML --> WAV[src/export/wav-encoder.js]
HTML --> EXP[src/export/download.js]
HTML --> SP[src/panels/sound/sound-panel.js]
HTML --> GP[src/panels/gallery/gallery-panel.js]
HTML --> MM[src/modes/mode-manager.js]
HTML --> CONST[src/modes/constellation.js]
HTML --> APP[src/playground.js]
APP --> AE
APP --> VE
APP --> G
APP --> SP
APP --> GP
APP --> MM
APP --> U
APP --> S
APP --> E
GP --> EXP
EXP --> WAV
G --> IDB[(IndexedDB playground-gallery)]
AE --> AC[AudioContext]
VE --> CANVAS[Canvas 2D]
SMOKE[smoke-test.html] --> U
SMOKE --> S
SMOKE --> E
SMOKE --> AE
SMOKE --> VE
SMOKE --> G
PERF[src/utils/perf-monitor.js]
PERFTEST[tests/test_perf_budgets.py] --> PERF
PERFTEST --> PERFCFG[lighthouse-budget.json + .lighthouserc.json + .gitea/workflows/perf-check.yml]
HTML -. not loaded on main .-> PERF
Entry Points
index.html
The real product entry point.
Responsibilities:
- defines the entrance curtain
- defines header, left sound panel, center canvas, right gallery panel, and footer action bar
- loads global scripts in strict dependency order
- exposes no module loader or bundler boundary
Current runtime script order:
src/utils/utils.jssrc/utils/state.jssrc/utils/events.jssrc/engine/audio-engine.jssrc/engine/visual-engine.jssrc/gallery/gallery.jssrc/export/wav-encoder.jssrc/export/download.jssrc/panels/sound/sound-panel.jssrc/panels/gallery/gallery-panel.jssrc/modes/mode-manager.jssrc/modes/constellation.jssrc/playground.js
Important truth: src/utils/perf-monitor.js exists in the repo but is not loaded by index.html on current main.
src/playground.js
The orchestration nucleus.
What it does today:
- entrance particle system and enter transition
- engine construction and initialization
- default ambient animation loop
- mode registration and selector rendering
- canvas resizing
- gallery initialization and rerender after saves
- save/download/clear/fullscreen button wiring
- footer prompt handling and keyboard shortcuts
This file is the clearest statement of what the app actually is right now.
smoke-test.html
Browser smoke harness.
- loads a subset of runtime files directly
- runs assertions in the browser DOM
- provides manual high-signal sanity checks around utils/state/events/audio/visual/gallery
tests/test_perf_budgets.py
The only pytest module in the target repo.
What it verifies:
- existence of
src/utils/perf-monitor.js - existence of
lighthouse-budget.json - existence of
.lighthouserc.json - existence of
.gitea/workflows/perf-check.yml - very shallow content checks for the perf monitor and perf workflow artifacts
Data Flow
Boot flow
- Browser opens
index.html. - CSS establishes the gold-on-dark design system.
- utility/state/events globals load.
- engine/gallery/export/panel/mode globals load.
src/playground.jsruns in an IIFE.- entrance screen shows animated particles.
- user clicks
Enteror presses a key. enterPlayground()fades out entrance, initializes audio, reveals the app shell, and starts the playground.
Core interaction flow
PlaygroundVisualbinds the canvas.PlaygroundGalleryopens IndexedDB.SoundPanel.init(audioEngine)renders the left-side sound UI.GalleryPanel.init(galleryEngine)renders the right-side gallery UI.ModeManagerregisters available modes and renders selector buttons.- ambient mode starts by default; draw and constellation can be selected.
Draw/save/export flow
- user draws or interacts in a mode.
- save path converts canvas to a blob/data URL.
PlaygroundGallery.save()writes a gallery item into IndexedDB.gallery:item-savedfires on the event bus.GalleryPanelrerenders.- download path exports the canvas PNG and a JSON metadata sidecar.
- gallery panel can also invoke
PlaygroundExport.downloadItem()for persisted items.
Constellation mode flow
ModeManager.switch('constellation')activatessrc/modes/constellation.js.- stars are created and drawn on the canvas.
- drag events move stars.
- close-distance interactions trigger pentatonic notes and an ambient drone.
- teardown removes listeners and fades out drone oscillators.
Metrics synthesis flow (current state)
- perf budget artifacts exist in the repo.
tests/test_perf_budgets.pyproves those files exist.PerfMonitorcan emit paint/layout/long-task/memory signals.- but the live app never loads or starts it, so there is no real runtime metric emission on
main.
Key Abstractions
PlaygroundUtils
Small browser helper surface:
uuid()clamp()lerp()map()toast()downloadBlob()
PlaygroundState
Global mutable state bucket for:
- canvas
- audio
- gallery
- UI
- recording
It is a convenience registry, not a durable data store.
PlaygroundEvents
Minimal event bus:
on(event, fn)emit(event, data)off(event, fn)
PlaygroundAudio
Web Audio wrapper for:
- note → frequency mapping
- chord generation
- scale generation
- oscillator playback
- chord playback
PlaygroundVisual
Canvas wrapper for:
- resize
- clear
- drawLine
- drawCircle
- seeded palette generation
- placeholder pseudo-noise helper
PlaygroundGallery
IndexedDB repository:
- DB name:
playground-gallery - object store:
items - indexes:
type,collection,created - methods:
init,save,getById,getAll,deleteItem
ModeManager
Registry/switcher for canvas experiences:
register()switch()renderSelector()currentmodes
PlaygroundExport
Download/export sidecar for:
- single item download
- metadata sidecars
- batch ZIP export
- standalone HTML gallery export
PlaygroundWavEncoder
AudioBuffer → WAV blob encoder used by export paths.
PerfMonitor
Dormant runtime performance monitor for:
- FCP/LCP
- CLS
- long tasks
- memory polling
Useful code, but currently disconnected from the product entrypoint.
API Surface
This repo has no network API. The public surface is browser globals plus IndexedDB object contracts.
Browser globals exposed on main
PlaygroundUtilsPlaygroundStatePlaygroundEventsPlaygroundAudioPlaygroundVisualPlaygroundGalleryPlaygroundWavEncoderPlaygroundExportSoundPanelGalleryPanelModeManager
Event bus contract
Observed event names:
audio:note-playedaudio:chord-playedgallery:item-savedgallery:item-deletedcanvas:mode-changedplayground:ready
Gallery item contract
Persisted items can include:
idcreatedmodifiedtypenamedatamimeTypethumbnailmetadata- sometimes audio/video-specific fields consumed by export helpers
UI command surface
Important DOM ids:
btn-savebtn-downloadbtn-clearbtn-fullscreenmode-selectorsound-contentgallery-contentplayground-canvas
Keyboard shortcuts implemented on main:
Ctrl+S→ SaveCtrl+D→ DownloadF11→ FullscreenEscape→ exit fullscreen
Test Coverage Gaps
Current state
What I verified on a fresh main archive:
pytest -q→7 passed in 0.03s- there is exactly one pytest module:
tests/test_perf_budgets.py - no JS unit-test harness
- no package manifest
- browser smoke harness still exists, but it is not the same thing as CI-grade coverage
What is covered today
- presence/shape of perf budget artifacts
- presence of the perf monitor file
- presence of the perf check workflow
- smoke-test manual coverage around utils/state/events/audio/visual/gallery (browser harness, not pytest)
Critical uncovered paths
src/playground.jsorchestration- entrance flow
- initialization sequence
- action-bar wiring
- keyboard shortcuts
- panel toggles
src/export/download.js- single-item export
- ZIP export
- standalone HTML export
src/export/wav-encoder.js- WAV blob correctness
src/modes/constellation.js- drag lifecycle
- teardown correctness
- audio interaction contract
- gallery interaction behavior
- open/view flow
- item count updates
- HTML escaping and render safety
Filed from this analysis
- the-playground #247 — PerfMonitor ships but is never loaded or started on
main - the-playground #248 — batch export loads JSZip from CDN, violating zero-dependency/local-first posture
Security Considerations
Strong points
- no backend/API attack surface in the shipped app
- local-first IndexedDB persistence
- static hosting posture is simple and inspectable
- no npm dependency tree on current
main
Risks
innerHTMLremains a major sink surface- gallery rendering is the riskiest because it interpolates persisted item data
- related issues already exist in the target repo
- dynamic third-party script load in export path
PlaygroundExport._loadJSZip()injects a CDN script tag for JSZip- this breaks the repo's own zero-dependency/local-first claim
- dormant perf monitoring path
- monitoring code exists but is not in the runtime path
- repo can give a false sense of observability
- browser capability assumptions remain strong
- IndexedDB
- AudioContext
- Fullscreen API
- Blob/FileReader
crypto.randomUUID()
Dependencies
Browser/runtime dependencies
- Canvas 2D API
- Web Audio API /
AudioContext - IndexedDB
- Fullscreen API
- Blob /
toBlob - FileReader
crypto.randomUUID()- standard DOM APIs
Project/tooling dependencies
- no
package.json - no bundler
- no build step
- one pytest-based perf artifact check
- one browser smoke harness
External runtime dependency discovered
- JSZip from CDN in
src/export/download.jsfor batch ZIP export
Deployment
Current deployment model is still very simple:
- open
index.htmldirectly in a browser - or serve the repo as static files from any web server
Verification flow I used:
- inspect
index.htmlscript contract - run
pytest -qin the target repo - inspect critical mode/export/perf files directly
- compare live repo state to the existing genome artifact
Technical Debt
Highest-priority debt
- README vision still exceeds code reality
- orchestration/export/mode behavior lacks serious automated coverage
PerfMonitorexists but is not wired into runtime (#247)- ZIP export relies on CDN-loaded JSZip (
#248) - gallery/open interaction depth is still shallow compared to the product promise
Meaningful product debt
- no real frontend app/test packaging discipline
- no integrated runtime metrics surface despite perf budget artifacts
- export system is richer than the rest of the UI exposes
- batch export and standalone gallery export exist in code but are not a clearly surfaced first-class workflow in the main shell
- the prototype is still held together by global load order rather than explicit module boundaries
Bottom Line
the-playground is no longer just a two-mode shell. Current main has grown into a more substantial browser prototype with export infrastructure, a third experience mode, a perf-budget lane, and one real pytest module.
But the repo still has a truth gap between what exists in source and what is actually exercised end-to-end:
- export is richer than the visible UI story
- performance monitoring exists but is not running
- dependency posture says local-first while ZIP export reaches for a CDN
- automated coverage is still far thinner than the surface area of the product
That is the real architectural story now: the codebase is starting to branch into platform-level capabilities, but verification and integration are lagging behind the feature shards already present in source.