Commander Capital Console
A Node/Express app with a vanilla-JS front end that replaced two Excel workbooks. It consolidates deck lists into one buy order, prices it against a store's API and Scryfall market data, splits sourcing across vendors on a drag-and-drop board, enforces a copy-level coverage invariant before an order can be finalized, and keeps books with FIFO COGS, an eBay Sell API sync, and a derived double-entry general ledger.
- Run the built-in tutorial: it drives one order through Build → Price → Cart → History using the app's real handlers.
- Books → General ledger: the journal and trial balance derived from the sales ledger and lots.
- Books → Sync eBay: runs the real sync and mapping code against a stand-in eBay client.
What's under the hood
- Invariant: copy-level coverage reconciliation between the consolidated order and every vendor list, keyed by Scryfall ID and finish. Splits across vendors must sum before they apply; finalize refuses short orders.
- Books: eBay Fulfillment and Finances APIs (OAuth refresh-token flow) mapped to per-line sales, with fees, ad fees, labels, and refunds allocated by largest remainder; Mercari CSV import; FIFO COGS against built lots plus per-deck fixed costs; and a journal and trial balance derived from the ledger.
- Persistence: atomic JSON writes with restore points and optimistic concurrency (revision checks reject stale writes).
- Scale: ~23k lines and 34 test files (node:test plus Playwright end-to-end drag-and-drop tests).
Demo: je-client.js and ebay-client.js are stand-ins with the same exports serving deterministic sample data. Everything downstream is production code.