Problem
Sports research tools are usually paywalled or built to sell picks. Parlay N’ Roll runs with paid data providers switched off (its “Zero Cost Mode”), so every number it shows has to come from data the app stores and can account for.
Approach
- A React 19 + TypeScript app built with Vite and React Server Components, deployed as a Cloudflare Worker that serves the static assets and the API.
- An owned-data layer in Cloudflare D1, defined by four versioned SQL migrations.
- Eight API routes: events, market history, odds, picks, pulse, research board, schedule and weather.
- An odds calculator covering American-odds conversion, parlays and round robins, and a dictionary of 109 betting concepts.
Engineering highlights
- Indexed, parameter-bound D1 queries, capped at 250 rows per response; public responses cached for 5 minutes.
- An import pipeline with timeouts, size and row caps and no automatic retries; when an import fails, the app falls back to its last good snapshot.
- Append-only history: once a price is recorded it is never rewritten.
- Upstream provider payloads are validated with zod schemas (types, lengths, ranges) before anything is imported.
- 19 automated test files on Node’s built-in test runner, covering odds math, the calculator, data integrity and rendered HTML.
npm testbuilds the app, then runs the suite.
Challenge
Keeping stored market history trustworthy when the upstream data can be slow, oversized or malformed.
Solution
Treat every import as untrusted: hard limits on time, size and rows, no retries that could double-write, a snapshot fallback, and append-only tables, with tests that check the data’s integrity.
Status
Public beta, in active development.