Repository navigation
Architecture Frontend
The TokenPrint Frontend is a modern web application built with Next.js (App Router), TypeScript, and React Three Fiber (R3F).
To render millions of points or thousands of geometric meshes at 60fps, standard React DOM rendering is insufficient. The frontend architecture must bridge the declarative ease of React with the raw performance of WebGL.
The frontend/ directory is structured to isolate heavy computations from the main React render thread.
-
app/: Contains the Next.js routing and the mainpage.tsxwhich mounts theAppShell. -
components/ui/: Standard React components (panels, buttons, sliders) built with Tailwind CSS. -
components/scenes/: R3F components that interface directly with Three.js. -
lib/: Pure TypeScript logic (no React dependencies). Contains theformulas.ts,sceneColors.ts, and the client-sidegguf/parser.
To prevent the 60fps useFrame loop from re-rendering the entire UI, state that updates frequently (like the camera position or the current timestamp) is stored in a headless Zustand store (lib/store.ts). R3F components read directly from this store without triggering React state updates.
flowchart TD
Next[Next.js AppRouter] --> AppShell[AppShell Layout]
AppShell --> DOM[React DOM UI]
AppShell --> R3F[React Three Fiber Canvas]
subgraph State Management
Zustand[Zustand Store]
end
Zustand -.->|State reads| DOM
Zustand -.->|High-frequency reads| R3F
subgraph Library Logic
GGUF[GGUF Parser]
Math[KaTeX Formulas]
end
Library Logic --> DOM
Library Logic --> R3F
| Previous | Home | Next |
|---|---|---|
| Overall Architecture | Home | Backend |
TokenPrint Wiki | Home | Getting Started | User Guide | Concepts | Architecture | API | GitHub
TokenPrint is an interactive 3D visualization platform for exploring transformer architectures, tensors, and real-time LLM inference.
- User Guide
- Architecture Explorer
- Live Inference
- Tensor Inspector
- Camera Controls
- HUD
- Timeline
- Scene Navigation
- Transformer Concepts
- Tokenization
- Embeddings
- Positional Encoding
- RoPE
- Multi-Head Attention
- KV Cache
- LayerNorm
- Feed Forward Network
- Residual Connections
- Logits
- Softmax
- Sampling
- Autoregressive Generation
- Visualization System
- Scene Graph
- Geometry
- Materials
- Animation System
- Color Mapping
- Camera System
- Interaction Model
- Architecture
- Overall Architecture
- Frontend
- Backend
- WebSocket Protocol
- Data Pipeline
- Renderer
- Event System