A self-hostable World Cup 2026 prediction pool for small groups. Members pick match outcomes, add an optional exact-score guess for bragging rights, choose group-stage qualifiers, and compete on a live leaderboard.
Status: complete. The 2026 tournament is over and the original pool has
finished. The code remains self-hostable: follow the setup steps below to run
your own pool. The final standings and every pick from the original pool are
preserved in results/final-results.json.
This is built for friendly bragging rights only. It does not include odds, payments, payouts, or real-money wagering.
- Email and password signup with an optional shared invite code
- Member profile setup with display names and generated colors
- Admin promotion from configured email addresses
- Fixture and result import from football-data.org
- Manual result editing for admins when the API is late or unavailable
- Matchday tabs for group-stage matches that flip to round tabs (Round of 32, Round of 16, and so on) once the group stage finishes
- Open matches surface first per matchday, locked and finished ones collapse, and a counter shows how many still need a pick
- Client-side tab switching after the dashboard loads
- Optimistic pick saving with no full-page refresh
- Match picks that lock at kickoff
- Group qualifier picks that lock at the first match in that group
- Optional third group pick for the 2026 Round of 32 format
- Winner-only knockout picks from the Round of 32 onward (no draw option), scored like any other match pick
- Match and group scoring computed live from results, never stored
- Leaderboard views: total points, standardized accuracy (correct picks over all decided games), and a knockout-only board (Round of 32 onward) with per-round filters
- Pool split bars on each match card showing how members picked
- Member profiles (click a leaderboard row) with current streak, best streak, and exact-scoreline count
- Live dashboard data read fresh on every request
- Light and dark themes with a responsive mobile nav
- Vercel Cron result sync at 9:00 AM Eastern time
- Next.js App Router
- Supabase Auth and Postgres
- Vercel hosting
- football-data.org for match and result sync
- TypeScript
- Members join with email and password.
- If
POOL_INVITE_CODEis set, signup requires that code. - Admins sync fixtures from
/adminafter settingFOOTBALL_DATA_TOKEN. - Members save match picks and group qualifier picks.
- Picks lock automatically when the relevant match or group starts.
- Results are imported by cron or updated manually by an admin.
- The leaderboard updates automatically: scores are computed on read from the stored match results, so there is nothing to recalculate.
The public repo does not contain secrets. Every deployment needs its own Supabase project, Supabase keys, and optional football-data.org token.
- Correct match outcome: 3 points
- Predicted scoreline: optional and worth no points, kept only as an "exact scorelines" bragging stat
- Knockout pick (Round of 32 onward): pick the winner only, 3 points if correct (extra time and penalties decide the result, so there is no draw option)
- Group qualifier hit: 5 points per picked team that reaches the Round of 32
- Wrong match pick: 0 points
- Wrong group qualifier pick: 0 points
Leaderboard ties sort by total points, then correct match picks, then display name.
The leaderboard has three views. Points is the full total (match picks, group qualifiers, and knockout). Accuracy is standardized as correct picks over every decided game in the pool, not just the games a member chose to bet on, so skipping a game counts against accuracy the same as a wrong pick. Knockout ranks by knockout points only, counting Round of 32 picks onward, and can be filtered to a single round from the Round of 32 through the final.
Scores are computed on read from the stored match results (only finished matches count), so a scoring change takes effect immediately - there is nothing to recalculate.
The original pool ran the full tournament: 15 members, 104 matches, 1,286 match picks, and 83 group sheets. Spain beat Argentina 1-0 in the final.
| # | Member | Points | Match record | Group pts |
|---|---|---|---|---|
| 1 | Yash Raj Pandey | 340 | 70 of 104 | 130 |
| 2 | Gonzalinho | 335 | 65 of 99 | 140 |
| 3 | Fernando | 334 | 63 of 104 | 145 |
| 4 | Amman | 331 | 67 of 101 | 130 |
| 5 | Sarah | 326 | 62 of 103 | 140 |
| 6 | Cristhian Ruiz | 307 | 59 of 102 | 130 |
| 7 | Nicolas Rueda | 300 | 65 of 93 | 105 |
| 8 | Juliana | 198 | 66 of 99 | 0 |
| 9 | Patricio | 186 | 62 of 100 | 0 |
| 10 | Estefania | 178 | 46 of 84 | 40 |
| 11 | Felipe | 174 | 58 of 84 | 0 |
| 12 | Ben | 171 | 57 of 94 | 0 |
| 13 | Raghav Rathi | 103 | 31 of 55 | 10 |
| 14 | Usman | 93 | 31 of 62 | 0 |
| 15 | Diego | 3 | 1 of 2 | 0 |
A few things the data showed: the title was decided by 6 points, and by group sheets rather than match picks - six members never filled one in, and the highest-scoring group sheet (145 points) belonged to the member with the lowest accuracy in the top six. Fourteen matches beat the entire pool, including Germany 4-5 Paraguay in the Round of 32, which every single member called for Germany. Draws were badly underpicked: 7 percent of picks against 19 percent of results.
results/final-results.json holds the full archive - standings, all 104 results with the pool's success rate per match, every pick by display name, and every group sheet. Emails and user IDs are deliberately excluded.
The 2026 tournament has 12 groups of four. The top two teams from each group and the eight best third-placed teams reach the Round of 32.
For each group, members must pick two teams and may pick a third team. The third pick is useful because some third-placed teams advance.
The app does not try to reimplement every official third-place tiebreaker. Instead, group bonus scoring is finalized after the synced knockout fixtures contain 32 real Round of 32 teams. This keeps the scoring aligned with the resolved tournament bracket.
profiles: member profile, role, display name, and avatar colormatches: synced or manually edited fixtures and resultspredictions: one match pick per member per matchgroup_predictions: one group qualifier pick set per member per group
Row Level Security is enabled. Members can read shared match data, update their own profile, and write only their own unlocked picks. Admin-only operations use the Supabase secret key on the server.
- Two Supabase clients, chosen deliberately.
lib/supabase/server.tsuses the publishable key plus the user's cookies, so it runs under RLS as the signed-in member - use it for auth and for member-initiated writes.lib/supabase/admin.tsuses the secret key, bypasses RLS, and is for reads and writes that span all users (dashboard aggregation, match sync, admin actions). Never hand the admin client or its unfiltered data to a client component. - RLS is the real security boundary. The policies in
supabase/schema.sqlre-check that a match is stillSCHEDULEDand thatstarts_at > now(). The equivalent checks in the server actions are a UX layer on top, not the enforcement. - A group's deadline is its earliest kickoff, enforced in three places that must stay in sync: the
is_lockedflag inlib/groups.ts, the lock check insaveGroupPredictionAction, and thegroup_predictionsRLS policy. - Scoring is computed on read, never stored.
lib/dashboard.tsreads matches plus predictions and scores them live vialib/scoring.tsandlib/groups.ts. Thepoints,is_correct, andis_scoredcolumns onpredictionsandgroup_predictionsare vestigial leftovers - nothing reads them and nothing should start. - PostgREST caps a response at 1000 rows.
predictionsexceeded that during the tournament, so it is read with pagination (fetchAllPredictions). Reading a growing table with a plain.select()silently drops rows and corrupts the leaderboard. group_predictionsarrived as a later migration, so the code treats a Postgres42P01(undefined table) error as "feature unavailable" rather than crashing. Keep that guard if you touch group code.npm run typecheckis the only check in the repo. There is no test runner, linter, or formatter configured.
Requirements:
- Node.js 20 or newer
- A Supabase project
- A football-data.org token if you want API sync
Create a Supabase project, then run supabase/schema.sql in the Supabase SQL editor.
Copy .env.example to .env.local and fill in the values:
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=
SUPABASE_SECRET_KEY=
FOOTBALL_DATA_TOKEN=
CRON_SECRET=
ADMIN_EMAILS=
POOL_INVITE_CODE=
NEXT_PUBLIC_SITE_URL=http://localhost:3000Install dependencies and start the app:
npm install
npm run devOpen http://localhost:3000.
NEXT_PUBLIC_SUPABASE_URL is your Supabase project URL.
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY is the browser-safe Supabase publishable key.
SUPABASE_SECRET_KEY is the privileged server key. Keep it in local and Vercel environment variables only.
FOOTBALL_DATA_TOKEN is optional but required for fixture and result sync.
CRON_SECRET protects the cron endpoint.
ADMIN_EMAILS is a comma-separated list of emails that should become admins after signup.
POOL_INVITE_CODE is optional. If set, new members must enter it when joining.
NEXT_PUBLIC_SITE_URL should be the local or deployed site URL.
For the simplest private-pool flow, disable email confirmation in Supabase Auth settings. If email confirmation stays enabled, users must confirm email before they can sign in.
Add these redirect URLs in Supabase Auth:
http://localhost:3000/auth/callback
https://your-domain.vercel.app/auth/callback
- Import the GitHub repo into Vercel.
- Add the same environment variables from
.env.example. - Set
NEXT_PUBLIC_SITE_URLto the deployed site URL, for examplehttps://your-domain.vercel.app. - Add the deployed callback URL in Supabase Auth settings.
- Redeploy after changing environment variables.
Add your email to ADMIN_EMAILS, sign up through the app, then visit /admin. The app promotes matching emails to admin on first access.
Admins can:
- Sync fixtures and results from football-data.org
- Edit match status, scores, and winners manually
The app includes a Vercel Cron Job at /api/cron/sync-results.
vercel.json uses this schedule:
{
"path": "/api/cron/sync-results",
"schedule": "0 13 * * *"
}That is 9:00 AM Eastern time during the World Cup. Vercel cron schedules are written in UTC.
For manual testing:
curl -H "Authorization: Bearer YOUR_CRON_SECRET" \
https://your-domain.vercel.app/api/cron/sync-resultsThe endpoint imports current fixtures and results into the matches table. Scoring is computed on read from those results, so no recalculation step is needed.
If you already deployed an earlier version, keep your existing data and run the migrations in Supabase SQL editor:
-- Run the contents of these files:
-- supabase/migrations/20260611_group_predictions.sql
-- supabase/migrations/20260612_group_third_pick.sqlThese migrations add group picks and the optional third group pick. They do not delete existing profiles, matches, or match predictions.
Run TypeScript checks before opening a PR or deploying:
npm run typecheck- Do not commit
.env.local,.vercel, or other local secret files. - Keep
SUPABASE_SECRET_KEY,FOOTBALL_DATA_TOKEN, andCRON_SECRETserver-side only. - Use your own Supabase project and football-data.org token.
- The package is marked
privateto prevent accidental npm publishing. The GitHub repo can still be public.
MIT
This project is an independent fan-made prediction pool. It is not affiliated with FIFA, Vercel, Supabase, or football-data.org.