Interactive Archify Visual Architecture Suite
The platform's architecture, streaming pipelines, compilation workflows, and verification stages are modeled as structured visual diagrams. Click a tab below to preview each system model, or open the interactive diagrams in a full window.
Complete Subsystem Decomposition
The platform is organized into six decoupled tiers designed for fast execution, clear security boundaries, and reliable error handling:
Zero-framework vanilla Single-Page Application (docs/index.html). Uses a 56px inset glass header, 240Hz semi-implicit Euler spring cursor, and container-bounded delta scroll calculations to keep navigation fast without framework overhead.
api/judge/run.mjs runs user code inside a QuickJS WebAssembly sandbox using five specialized codecs (json, tree, list, graph, ops). Defends against infinite loops, memory leaks, and silent data conversion bugs.
GitHub OAuth 2.0 with HMAC-SHA256 session cookies. Features the SESSION_EPOCH global kill-switch for instant token invalidation across all edge servers with zero database lookups.
Vercel Edge streaming SSE proxy with 10-second keepalive pings, 52-second total budget ceiling, Upstash Redis tiered rate limiting (5/min per IP vs 20/min for authenticated users), and two-channel delimiter fencing to stop prompt injection.
Offline Acorn AST probe injection using static regionTable offsets. Emits Envelope v1.1 execution traces with in-realm serializers inside a 3-second, 16MB QuickJS WebAssembly sandbox.
SHA-256 script digest enforcement in vercel.json, 471 chat assertions, 96 judge assertions, and Playwright recursive ancestor luminance contrast scans.
15 Architectural & Technical Decision Records (ADRs)
<div> elements with rounded corners (border-radius: 50%).
#cur-dot) and trailing ring (#cur-ring) contain inline <svg> and <circle> elements. The SVG sets shape-rendering="geometricPrecision" for smooth mathematical anti-aliasing and vector-effect="non-scaling-stroke" on the 32px ring so that scaling to 2.227× on hover keeps a crisp 1.0px hairline border.
<div> elements with rounded corners into a fixed-size texture in GPU memory. When you zoom the page (150%, 200%) or scale the cursor up on hover, the graphics card stretches that fixed-size texture, creating blurry or jagged edges. SVG circles describe geometry with mathematical coordinates, so the browser recalculates clean curves at the exact screen resolution every time it draws.
F_damping = -c * v
a = F_spring + F_damping
v_{t + Δt} = v_t + a * Δt
x_{t + Δt} = x_t + v_{t + Δt} * Δt
requestAnimationFrame when movement is under 0.1px and velocity is under 0.05px/s, dropping idle CPU usage to 0.00%.
docs/assets/cursor.js checks e.pointerType on every event. If touch is detected, it hides the custom cursor (opacity = '0') and skips physics updates. For desktop mice and trackpads, it applies universal descendant suppression:
html[data-cursor="on"], html[data-cursor="on"] * { cursor: none !important; }
}
2. Sidebar Navigation Items: The ring centers on the vertical midpoint of the right edge (targetX = rect.right, targetY = rect.top + rect.height / 2), creating a 50/50 balance.
3. Inline Body Links: Hides the snap ring, enlarges the center dot by 1.6× with a subtle glow, and underlines the text.
api/_lib/codecs.mjs implements five exact data codecs: json (101 problems), tree (20 problems), list (13 problems), graph (9 problems with {__ref: N} cycle markers), and ops (7 stateful design classes). Any unsupported format immediately throws CodecNotImplementedError.
JSON.stringify(), cyclic graphs crash with circular structure errors, or trees get compared by memory references instead of node values. Failing immediately at build or test time prevents silent incorrect grading.
sid): { sub, login, name, avatar, epoch, exp }. Edge functions verify the signature using SESSION_SECRET in under 0.1ms with zero network queries. The middleware also checks session.epoch === parseInt(process.env.SESSION_EPOCH, 10). If an incident occurs, incrementing SESSION_EPOCH from 1 to 2 immediately invalidates all active cookies worldwide.
- Anonymous Tier: 5 requests per minute per IP address (
chat:anon:<ip>). - Authenticated Tier: 20 requests per minute attached to the user's GitHub ID (
chat:u:<githubId>), bypassing IP collisions. - Daily IP Ceiling: 300 requests per day per IP across both cohorts (
chat:daily:<ip>), preventing automated scripts from exhausting API limits.
api/_lib/chat-security.mjs:
Tool Content: <<<TOOL_CONTENT>>> ... <<<END_TOOL_CONTENT>>>
{ system: 'prod' } intact.
scripts/build-site.mjs compiles all guides, frontmatter, and dry-run tables into docs/curriculum-data.js (3.09 MB uncompressed, ~680 KB compressed with Brotli). The browser downloads it once and caches it. After that, searching, filtering, and switching problems take under 5ms directly from memory.
scripts/gen-blocks.mjs pre-analyzes code scopes and compiles an immutable regionTable in build/blocks.json. Probes (__trace_step__) are injected using Acorn AST traversal targeting exact character slice offsets. Probes identify scope membership statically from the table: scope 0 covers the solution and its recursive closures; scope 1 covers the test runner. Automated checks (Rule V11) verify that every recursive algorithm emits at least 3 execution frames.
depth++ on enter, depth-- on exit) to ignore helper runners. However, 102 out of 450 LeetCode solutions are recursive (trees, backtracking, divide and conquer). A runtime counter tagged the first call as depth 0 and ignored all recursive calls as depth > 0, producing empty 1-frame traces that falsely passed simple tests. Statically mapping scopes captures recursive calls completely.
paintReveal()); the active sentence streams as plain text at 60fps with zero layout thrashing.2. 52-Second Total Budget (TOTAL_BUDGET_MS = 52s): Enforces a 52-second limit within Vercel's 60-second cutoff, leaving 8 seconds of headroom to send a clean error frame if an upstream API hangs.
3. 10s SSE Keepalives: Emits
: ping
comments every 10 seconds to keep reverse proxies from closing idle connections.4. 15s Tool Budget Guard: Requires at least 15 seconds of remaining time before making external search requests; otherwise, it answers using built-in knowledge.
'unsafe-inline'.
vercel.json strictly forbids 'unsafe-inline' for scripts. Pinned exactly 2 inline script blocks in docs/index.html (early theme setup and router controller). Synchronized via scripts/refresh-csp-hash.mjs, which calculates SHA-256 base64 digests and updates deployment manifests. Playwright tests fail closed if an unhashed script tag is introduced.
'unsafe-inline' so quick initialization scripts can run, but this leaves a door open for malicious injected scripts. Generating cryptographic hashes for approved scripts allows necessary inline code to execute while blocking unauthorized code.
api/_lib/kv.mjs, solved problem writes are strictly deduplicated sets (idempotent). Telemetry events are stored in a dedicated key space capped at exactly 500 events using a FIFO drop queue. In case of Upstash Redis network failure, the functions degrade gracefully to empty progress without failing code execution verdicts or throwing client-side exceptions.
~~~viz-array, ~~~viz-tree, ~~~viz-matrix) embedded directly in the curriculum markdown. The client renders memory cells with dedicated pointer badges (e.g. p=0, L, R) at sub-millisecond speeds, fully integrated with theme CSS variables.
240Hz Euler ODE Spring Physics & Geometry Lab
Move your cursor inside the canvas below to interact with the real-time Semi-Implicit Euler spring simulator. Toggle between Trailing Lens (k = 190, c = 17) and Magnetic Snap (k = 1400, c = 60) to observe damping and energy sleep behavior.
k = 190 | c = 17
Energy: 0.00 μJ (Sleeping: YES)
Tools & Skills Ecosystem Matrix
The rapid development, hardening, and verification of the platform was powered by a curated suite of specialized tools, runtimes, and engineering disciplines:
| Tool / Skill | Category | Concrete Role in Codebase | Tangible Value & Bugs Prevented |
|---|---|---|---|
|
Archify CLI
|
Agentic Skill | Compiles Architecture, Sequence, Workflow, and Lifecycle IR schemas into GPU-accelerated interactive HTML visualizers. | Eliminated architectural drift and outdated static drawings; provided real-time, interactive failure mode exploration for developers. |
|
QuickJS-Emscripten
|
Engine & AST | WebAssembly execution sandbox for LeetCode user solutions and dry-run code blocks (api/_lib/sandbox.mjs). |
Guaranteed 100% hermetic isolation. Prevented arbitrary solution code from mutating Node host prototypes, memory leaks, or running infinite loops (3s/16MB limit). |
|
Polyglot Codecs
|
Engine & AST | 5 specialized codecs (json, tree, list, graph, ops) in api/_lib/codecs.mjs. |
Enforces Hard Rule G1 (zero lazy fallbacks), preventing silent-wrong execution traces and supporting cyclic graphs via back-references. |
|
Acorn & Acorn-walk
|
Engine & AST | Parses 450 JavaScript blocks into AST and injects non-invasive tracer probes (scripts/instrument.mjs). |
Enabled source-slice level probe injection that preserved original line numbers and character offsets without modifying code execution semantics. |
|
SESSION_EPOCH
|
Security & Auth | Stateless HMAC-SHA256 session management with integer epoch validation (api/_lib/session.mjs). |
Provides instantaneous global session invalidation without database lookups. Leaked cookies can be revoked in seconds via environment variable change. |
|
Vercel Edge Functions
|
Edge & AI | Low-latency SSE streaming proxy for AI chat (api/chat.mjs) operating on Vercel's global edge network. |
Delivered sub-10ms TTFB globally, with keepalive comment dispatching preventing premature HTTP socket termination. |
|
Upstash Redis
|
Edge & AI | Distributed sliding window rate limiter (@upstash/ratelimit) per IP and authenticated session. |
Prevented API token exhaustion and DDoS spam without requiring persistent server state or database connection pooling. |
|
Two-Channel Delimiters
|
Security & Auth | Distinct boundary fences for guide text vs untrusted tool web text (api/_lib/chat-security.mjs). |
Defends against prompt injection attacks originating from web pages retrieved via external search tools. |
|
Playwright Test
|
Testing & QA | End-to-end browser automation suite running Desktop (1440×900) and Mobile Pixel 7 viewports. | Automated WCAG AA relative luminance checks over transparent ancestor DOM nodes; verified 56px mobile header height and pointer gating. |
|
Hyperplan / Adversarial
|
Agentic Skill | Multi-perspective architectural audit methodology testing assumptions against the running tree before implementation. | Exposed the "Phantom Problem" in chat persistence (saving hours of needless rewrites) and identified the recursive depth-counter defect. |
|
Non-Vacuity (Rule V11)
|
Testing & QA | Verification discipline asserting that generated traces contain ≥ 3 distinct execution frames for recursive problems. | Prevented silent test passes on empty traces across 102 recursive LeetCode solutions, ensuring trace validity. |
|
WAI-ARIA 1.2 Combobox
|
Engine & AST | Accessible virtual focus pattern with aria-activedescendant in curriculum search and command palette. |
Eliminated DOM focus stealing, preventing virtual keyboard dismissals on mobile devices during search queries. |
|
Dagr Slicer & Guard
|
Agentic Skill | Sub-millisecond architectural boundary enforcement and surgical AST context extraction. | Prevented UI-to-database architectural boundary leakage and kept token consumption minimal during large-scale code refactoring. |
|
Firecrawl
|
Edge & AI | External web retrieval tool for live LeetCode documentation lookups in AI chat. | Enabled dynamic context retrieval while safely bounded by the 15-second execution headroom guard. |
Engineering Management Playbook: 7 Strict Rules
saveStore() to add local persistence. Line-by-line inspection of the codebase showed that saveStore() did not exist because persistence was already implemented and tested under STORAGE_KEY = 'lt150-chat-v1'.
assert(trace.steps.length >= 0) passed even though the output was incomplete.
: ping) every 10 seconds to keep client connections open.
getComputedStyle().backgroundColor often received rgba(0, 0, 0, 0) (transparent) on card wrappers. Code that converted this to black reported dark text on white cards as failing contrast, creating hundreds of false warnings.
border-bottom: 1px solid var(--border-soft) to the frosted glass header increased outer height from 56px to 57px, breaking mobile drawer positioning and causing subpixel scrolling jitter. Replacing exterior borders with inset box shadows preserved the 56px dimension.
epoch into every signed token, revoking all active sessions is a one-line environment variable bump.
Automated Verification Scorecard
| Test Suite | Target Area | Verification Command | Assertions & Result |
|---|---|---|---|
| CSP Cryptographic Gate | Content Security Policy | node scripts/refresh-csp-hash.mjs |
✅ 100% Match in vercel.json |
| Judge Subsystem Suite | Hermetic Codecs & Drivers | npm run test:judge |
✅ 96 Assertions / 0 Failures |
| Chat Hardening Suite | Edge SSE & Keepalive Auth | npm run test:chat |
✅ 471 Assertions / 0 Failures |
| Dry-Run AST Validator | Syntax & Trace Schema | npm test |
✅ 450 Syntax Blocks Passed |
| Playwright E2E Suite | Contrast, Cursor, Header | npx playwright test |
✅ WCAG AA ≥ 4.5:1 Luminance |