An interactive playground that turns core data-structure algorithms into step-by-step animations. LT-Vis is designed for teaching and self-paced exploration: every operation produces a timeline of renderer-friendly events you can play, pause, and rewind in the browser.
- Scope: Linked list, stack, binary tree (with traversals), and binary search tree (insert/find/delete) — all implemented from scratch in TypeScript and instrumented with
OpStep/VizEventtimelines. - Architecture: Monorepo managed by pnpm. Pure model logic lives in
packages/model-ts, shared contracts inpackages/shared, and the React/Vite UI inapps/web. - Goal: Keep the model layer renderer-agnostic while delivering a smooth classroom-friendly visualization experience.
.
├─ apps/web/ # React + Vite client (timeline viewer, demo scenarios)
├─ packages/shared/ # Cross-package TypeScript contracts (Structure, OpStep, VizEvent)
├─ packages/model-ts/ # Data structures + operation → timeline engines
├─ docs/ # Product requirements and design specs
├─ examples/ # Executable timeline samples mirroring course demos
└─ README.md
-
Install prerequisites
- Node.js 20 (Volta recommended)
- pnpm ≥ 9 (
corepack enableornpm i -g pnpm)
-
Bootstrap the workspace
pnpm install
-
Run the demo
pnpm dev
Navigate to the printed Vite URL (default
http://localhost:5173). Use the scenario selector to explore linked list, stack, binary tree, and BST timelines.
| Command | Description |
|---|---|
pnpm dev |
Start the web app in Vite dev mode |
pnpm build |
Build web client and compile model package |
pnpm test |
Placeholder; wire up Vitest/Playwright here |
pnpm typecheck |
Run tsc across all packages (contracts enforced) |
- Implement new structures inside
packages/model-ts/src/structures. Each should emitOpStep[]describing the visualization timeline. - Register structures with
StructureSessionto execute operations and collect steps. - Mirror new operations in
apps/web/src/scenarios.tsso the demo can showcase them.
- The current renderer is a lightweight SVG snapshot viewer (
SnapshotCanvas). Swapping to React Flow or another layout engine only requires consuming the existingVizEventstream. - Timeline playback lives in
apps/web/src/components/TimelinePlayer.tsxand demonstrates play/pause, scrubbing, and speed changes.
- Contributor guidelines live in
AGENTS.md. - Formal requirements and architecture decisions are documented under
docs/(REQUEST.md,DESIGN.md). - When proposing changes, keep commit messages terse and scoped (e.g.
model: add huffman builder) and request reviews from the relevant module owner.
- Vite cannot resolve
@lt-vis/model-ts: If you seeFailed to resolve entry for package "@lt-vis/model-ts", make sure you are running the dev server from the repo root withpnpm dev. The Vite config (apps/web/vite.config.ts) aliases@lt-vis/sharedand@lt-vis/model-tsdirectly to theirsrc/entrypoints, so no prebuild is required. If the error persists, double-check for local overrides to the Vite config or rebuild the model package withpnpm -C packages/model-ts buildor simplypnpm build.