How harsit14/code_visualizer works
Code Visualizer is a browser-based code tracing and learning app. Users enter or open a program, run it in an isolated runtime, then inspect and navigate a replayable trace with state, output, and structure visualizations. The README also documents lessons, practice cases, complexity experiments, workspace persistence and sync, replay exports, offline use, accounts, and hosted explanations. Edges reflect shown imports/calls or README-documented behavior; unsampled feature wiring is not inferred.
Main entry points: App.tsx Dashboard · useSession.ts Session orchestration · explain-step.ts Explainer endpoint · iframeTransport.ts Execution transport
Components 26
App experience
- Dashboard
src/app/App.tsx - Session orchestration
src/app/useSession.ts - Trace panels
src/components/DataPanel.tsx
Execution and traces
- Trace helpers
src/engine/trace.ts - Python tracer
engine/codeviz/analyzer.py - JavaScript tracer
src/engine/jsTraceEngine.ts - Runtime client
src/engine/runtimeClient.ts - JavaScript runtime client
src/engine/jsRuntimeClient.ts - Execution transport
src/runner/iframeTransport.ts - Runner protocol
src/runner/protocol.ts - Python worker
src/engine/pyodideWorker.ts
Learning and practice
- Guided lessons
src/lessons/lessons.ts - Practice cases
src/app/practiceCases.ts - Complexity analysis
engine/codeviz/complexity.py
Workspace and replay
- Workspace library
src/app/useWorkspaceLibrary.ts - Workspace format
src/app/workspaceFormat.ts - Workspace sync
src/app/useWorkspaceSync.ts - Replay and export
src/app/replayExport.ts - Offline support
src/offline/serviceWorker.ts
Accounts and services
- Worker API router
src/worker.ts - Account services
src/server/accountApi.ts - Authentication
src/server/auth.ts - Database access
src/server/database.ts - Explainer endpoint
functions/api/explain-step.ts
Other components
- Learner
- Hosted AI provider
Connections 27
- Learner → Dashboard: uses
README.md - Dashboard → Session orchestration: orchestrates
src/app/App.tsx - Session orchestration → Runtime client: runs Python
src/app/useSession.ts - Session orchestration → JavaScript runtime client: runs JavaScript
src/app/useSession.ts - Runtime client → Execution transport: creates transport
src/engine/runtimeClient.ts - JavaScript runtime client → Execution transport: uses transport
src/engine/jsRuntimeClient.ts - Execution transport → Runner protocol: exchanges messages
src/runner/iframeTransport.ts - Runner protocol → Python worker: dispatches requests
src/runner/protocol.ts - Session orchestration → Python tracer: runs Python traces
README.md - Session orchestration → JavaScript tracer: runs JS traces
README.md - JavaScript tracer → Trace helpers: produces trace data
- Dashboard → Trace panels: renders
src/app/App.tsx - Trace panels → Trace helpers: reads trace state
src/components/DataPanel.tsx - Session orchestration → Practice cases: runs practice cases
README.md - Dashboard → Guided lessons: resolves checkpoints
src/app/App.tsx - Session orchestration → Complexity analysis: measures growth
README.md - Dashboard → Workspace library: manages revisions
src/app/App.tsx - Workspace library → Workspace format: formats workspace
README.md - Dashboard → Workspace sync: enables sync
src/app/App.tsx - Dashboard → Replay and export: exports replay
README.md - Learner → Offline support: uses offline
README.md - Worker API router → Account services: routes account requests
src/worker.ts - Account services → Authentication: authenticates users
- Authentication → Database access: reads and writes
src/server/auth.ts - Worker API router → Explainer endpoint: routes explanation requests
src/worker.ts - Explainer endpoint → Database access: reads and caches
functions/api/explain-step.ts - Explainer endpoint → Hosted AI provider: requests explanations
README.md