Skip to content
Showdown

How it's built

Showdown is a portfolio project, built end to end with an AI coding agent: product spec, database, market maker, data pipeline, AI features with evaluations, and analytics.

Stack

App
Next.js 16 and TypeScript, hosted on Vercel in Singapore
Database and sign-in
Supabase Postgres with row-level security on every table
Chips
A double-entry ledger in integer milli-chips, changed only by database functions
Prices
An automated market maker (LMSR), so there's always a price to trade at
Settling
Official data fetched, snapshotted, and judged by deterministic code
AI
Claude phrases clues, writes descriptions, explains results and estimates portions; code decides outcomes
Analytics
PostHog with consent, SQL metric views, Python notebooks

How a market flows

  1. 1

    Every hour a job reads the latest weather, COE, inflation and exchange-rate data and drafts questions with thresholds near 50/50.

  2. 2

    Code computes true facts from that data. Claude rephrases them as hole cards; a check rejects any clue with a number that isn't in the source.

  3. 3

    Players trade. One database function locks the market, prices the trade, and writes the ledger, position and price in one transaction.

  4. 4

    When the data is published, a job fetches it, stores a snapshot, applies the rule in code, pays winners from the house, and Claude writes a plain-English summary.

  5. 5

    Calibration scores, leaderboards and the hole-card experiment are computed from SQL views.

AI features and their evaluations

Key decisions

  1. 0001Hand-built UI components and a project design system
  2. 0002Keep Next.js 16 Cache Components on
  3. 0003Run database tests on PGlite instead of a Docker Supabase
  4. 0004A double-entry ledger in integer milli-chips
  5. 0005Use Supabase publishable and secret key names
  6. 0006One question, one market per league, priced by LMSR
  7. 0007Verified data sources and deterministic resolution rules
  8. 0008Scheduled jobs: pg_cron calls Next.js routes, which call locked-down SQL
  9. 0009One AI wrapper, facts first, deterministic checks after every call
  10. 0010Privacy by construction: consent, anonymised deletion, private photos
  11. 0011Hawker centres come from NEA's GeoJSON, refreshed weekly by a job
  12. 0012Ask the data: Postgres's own parser plus a read-only role, admin only
  13. 0013Weekly coach summary: AI writes, code checks the numbers, a template is the fallback
  14. 0014Settlement emails: opt-in, an outbox in Postgres, Resend as sender
  15. 0015First run on real Supabase: two fixes, and Playwright tests as the real-database safety net
  16. 0016Independent QA: fixes and the choices behind them