Back to projects

TypeScript · local-first

SwapBench

A client-side TypeScript application that treats hardware flipping as a graph problem: typed nodes for inventory and cash, directed edges for swaps and sales, and a scoring function over two-sided deals. State lives in the browser—no API, no account, no server-side store.

Canvas

Deployed at owengalaxy.xyz.

SwapBench Deal Journey canvas: a 3DS to gaming PC chain as a typed node-and-edge graph with sold and cash branches.
Deal Journey graph — 3DS → bike → laptop → gaming PC, with sold/kept terminals and a rolled-up P&L bar.

Architecture

SwapBench is a TypeScript SPA, compiled with Vite and rendered in React. The domain layer is typed independently of the UI: items, bundles, components, and cash are node kinds; swaps, sales, and keep-decisions are directed edges. CSV ingest, JSON export, and localStorage serialization all round-trip that same schema, so the canvas is a view over a structured graph rather than a pile of ad-hoc form state.

React owns three coordinated surfaces: a sidebar of journey documents, a spatial canvas for the selected graph, and an inspector bound to the current node or edge. Selection, layout, and derived totals (cash realized, items kept, estimated profit) are computed from the graph instead of being stored as duplicate UI fields.

Persistence is local-first. Saves write JSON under browser storage; an export dumps the full library. Storage keys still use a tradebench-* prefix so older client-side saves keep loading after the rebrand.

Systems

Stack