The Cap Room
An NBA front-office console: cap sheets, a trade machine whose verdicts explain themselves, player evaluation.

Live, code public on GitHub. Built for a real application.
The idea
NBA roster construction runs on the 2023 collective bargaining agreement, a rulebook dense enough that front offices keep specialists to navigate it. The Cap Room turns that rulebook into software: cap sheets against the five salary lines, a trade machine that stamps deals legal or illegal, and contract-aware player evaluation. I built it as an engineering demo for an NBA front-office role.
What I built
Everything sits on one pure TypeScript rules engine: CBA constants, cap-sheet math, trade legality, pick rules. It imports nothing from the UI and carries 43 unit tests, so the rules exist once and get tested once. On top of it are three modules: a Cap Sheet that shows team salary as a gauge against floor, cap, tax, and both aprons, with live exceptions and the hard cap each one would trigger; the Trade Machine; and Player Eval with league percentiles computed against all qualified players, not just the seeded teams.
The flagship is the Rule Ledger. Build a two-team deal, players, cash, and picks, and the verdict lists every check the engine ran, pass or fail, with the arithmetic in plain English. An illegal trade cites the rule that killed it. A legal trade that creates a hard cap says so. Proposals serialize into the URL, so any trade is a shareable link. The demo scenario is the Dončić test: a pick package that fails the Stepien rule, until you swap the 2028 first for 2029 and it stamps LEGAL.
The hard parts
01
A rulebook as functions
The CBA is prose. The engine needs it as composable checks: aprons, exceptions, the Stepien rule for picks. Getting them to compose without special cases was the real modeling work.
02
No silent verdicts
A red X with no explanation is useless in a front office. Every failure carries its rule and its numbers, which forces the engine to produce evidence, not just booleans.
03
Shareable by construction
Serializing proposals into the URL makes every scenario reproducible: a bug report, a debate, or a demo is just a link.
What’s next
More seasons of data and deeper pick logic.