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.

Signing in

Supabase Auth with Google or an emailed one-time code, and no passwords. Every step runs on the server, which sets the session cookie itself. JavaScript in the page can't read that cookie.

BrowserThe serverSupabase AuthGoogle1. Continue with Google2. Start OAuth (PKCE)3. Google consent screen4. Who this is5. Before User Created hook:is this email invited?6. Redirect to /auth/callback?code7. GET /auth/callback8. Exchange code for a session9. HttpOnly cookies, redirect
A first sign-in with Google. With an emailed code, steps 3–4 become "Supabase emails a code, the person types it in", and the same invite check and cookie step follow.

How it works

  1. Invite-only. A hook refuses any email address with no Invitation, before Supabase creates an account.
  2. Cookies only the server touches. The server sets the session as HttpOnly cookies in its responses. Safari caps cookies written by JavaScript at 7 days, but not these, so nobody has to sign in every week.
  3. The guard. Every route under _authenticated calls getSessionUserId() first, and sends anyone without a session to /sign-in. getClaims() also refreshes a session that's about to expire.
  4. Profile, Tipster, entry. A new account gets a Profile (name and photo). Opening AFL Tipping for the first time makes them a Tipster. Opening it during a Season enters them in that Season's Competition, and Auto-tips start from that moment.

Why

Clerk's free plan ended sessions every 7 days. Supabase Auth with server-set cookies has no session limit, and the site already runs on Supabase. Entering a Competition by opening the App is its own decision.

Decision records: ADR 0006, ADR 0007

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.