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.
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
- Deal scorer
- Journey graph
- Document library
- CSV → graph ingest
Stack
- TypeScript
- React
- Vite
- Browser APIs