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
Every hour a job reads the latest weather, COE, inflation and exchange-rate data and drafts questions with thresholds near 50/50.
- 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
Players trade. One database function locks the market, prices the trade, and writes the ledger, position and price in one transaction.
- 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
Calibration scores, leaderboards and the hole-card experiment are computed from SQL views.
AI features and their evaluations
- coach rubricNot yet run against Claude.
- description rubricNot yet run against Claude.
- holecard faithfulnessNot yet run against Claude.
- portion accuracyNot yet run against Claude.
- resolution explainerNot yet run against Claude.
- text to sqlNot yet run against Claude.
Key decisions
- 0001Hand-built UI components and a project design system
- 0002Keep Next.js 16 Cache Components on
- 0003Run database tests on PGlite instead of a Docker Supabase
- 0004A double-entry ledger in integer milli-chips
- 0005Use Supabase publishable and secret key names
- 0006One question, one market per league, priced by LMSR
- 0007Verified data sources and deterministic resolution rules
- 0008Scheduled jobs: pg_cron calls Next.js routes, which call locked-down SQL
- 0009One AI wrapper, facts first, deterministic checks after every call
- 0010Privacy by construction: consent, anonymised deletion, private photos
- 0011Hawker centres come from NEA's GeoJSON, refreshed weekly by a job
- 0012Ask the data: Postgres's own parser plus a read-only role, admin only
- 0013Weekly coach summary: AI writes, code checks the numbers, a template is the fallback
- 0014Settlement emails: opt-in, an outbox in Postgres, Resend as sender
- 0015First run on real Supabase: two fixes, and Playwright tests as the real-database safety net
- 0016Independent QA: fixes and the choices behind them