How Hot Shots is built

The code runs in four places: the Tipster's browser, the TanStack Start server on Vercel, the Supabase database, and Squiggle, the AFL data service. Click a box on the map, or a topic under it, to open that part of the system.

The browser only ever talks to the site's own server, plus a Realtime WebSocket during Games. Only the two sync endpoints call Squiggle, and Supabase's own scheduler starts them. Every other read comes from the site's own tables.

Auto-tips & the Leaderboard

The Leaderboard is worked out fresh on each request from four inputs. Missed Games are filled with Auto-tips first, so everyone is scored on the same set of Games.

Stored Tipsafl_tippingCompetition entrieswhen each Tipster enteredGamesstart times, winnersProfilesnames and photoswithAutoTipsHome team for each missedGame after LockoutscoreTipsCorrect tips · Margindifference on Margin gameassembleLeaderboardby Score, then lowestMargin difference; ties shareTips + Auto-tips
What buildLeaderboard does on each request. Group tips and player stats run the same Auto-tip step first, so every page agrees.

How it works

  • Auto-tip: a Tipster who hadn't tipped a Game by Lockout gets the Home team. It only applies to Games whose Lockout came after they entered the Competition, and it's never an Underdog tip.
  • Score is the number of Correct tips. In a Draw, every Tip on that Game is wrong.
  • Margin difference is how far a Margin was from the result. Tipping the wrong team adds the real margin to the tipped one. The lowest season total breaks ties.
  • Tipsters still level share the rank. A finished Season's last place is the Wooden spoon, unless the Competition has three or fewer.
  • The Underdog quota is two per Round outside Finals. Missing it is called out but doesn't cost points.

Why

Auto-tips and scores depend on Game results that change during a Round. Working them out per request from Tips and Games means there's nothing to get out of step.

Decision record: ADR 0001

Stack and testing

Built with

  • React 19, the interface
  • TanStack Start and Router, file-based routes and server functions
  • TanStack Query, server state, cached in the browser
  • Supabase, Postgres, Auth and Realtime
  • Vercel, hosting for the server
  • Tailwind CSS v4 and shadcn/ui, styling and components
  • Zod, validating what Squiggle sends and what the server receives

How it's tested

  • Vitest unit and component tests, next to the code they cover.
  • Storybook stories for components and diagrams, including this page's.
  • The Demo: the whole site running in the browser over a snapshot, so every page can be exercised end to end with no accounts or live data.

Read the code in the repository, the decision records, or AGENTS.md, the guide the project's contributors and coding agents work from.

Decisions

Each decision record explains what was chosen and the alternatives it beat.