AI Simulation Prediction Market

A points-based prediction market where the crowd sets the odds and an AI analyst forecasts on its own, then both get scored.

When
Jun – Jul 2026
Role
Solo
Built with
Next.js, TypeScript, Supabase, Postgres, Claude, Vultr
Code
Public code
Links
By the numbers
42 commits of mine over 4 working days, Jun 22, 2026 to Jul 13, 2026
The State Primary markets: one market per race, crowd odds updating live.
Markets page listing nine State Primary election races with live crowd odds for each candidate.

What I built

It started after California Boys State as a quick app that predicted our mock election from delegate survey data: Governor, Lieutenant Governor, Secretary of State, Treasurer. I built the first version in two days.

Then I rebuilt it in a week as a multi-market exchange. Users stake points, odds move in real time, and an AI analyst reads each market's state on a schedule and posts its own probability and rationale next to the crowd's. When a market resolves, humans and the AI are scored with the same Brier score on one leaderboard.

What was hard

Two bets placed at the same moment could overdraw a balance. I moved staking into a single atomic Postgres function and wrote a test that fires 20 stakes at once against the live database.

LLM probabilities don't always add up to 100%. Every forecast goes through the same validation and renormalization step no matter which model produced it.

Locking down row-level security so guests can bet but can't touch anyone else's balance or the admin functions.

What I learned

Scoring the AI the same way as people keeps you honest. It's easy to say a model is good at forecasting; it's harder when it sits on a leaderboard under real users.

Results

Delegates at Boys State used it to see how the races could turn out and what everyone else was thinking.

The 20-concurrent-stake test passes with zero overdrafts.

Demo data was reset before the repo went public. The live deployment is currently down; the code is public.