← Back to all posts

Knockout Club, behind the curtains

How a head-to-head voting app for a book club works behind the scenes, and what I got wrong along the way.

Artwork from the Knockout Club landing page. Two fictional movie posters face off, one in a red corner and one in a blue corner, in a knockout bracket that leads to a single gold champion card.

I moderate a book club, and choosing our next read was always harder than it should have been. We used polls and Google Forms, and they worked, but the setup wore me out. For every candidate I had to find the author, write a synopsis and track down a cover, all by hand, before anyone could vote. By the time the poll went out, I was already tired of the process.

I also wanted the vote itself to be part of the fun. Ticking a box in a form doesn’t make anyone excited. So I built Knockout Club, an app where nominees face each other head-to-head, round after round, until the group crowns a winner.

Books were the starting point, but the idea doesn’t care what is being compared. After a first run with our book club, which went better than I expected, I added movies and series too. The bigger test came with our audiovisual club, where we crowned a winner among 16 movies.

In this post I’ll walk through how it works behind the curtains, and what I got wrong along the way.

The stack

  • Next.js, React and TypeScript — the interface and server-side logic.
  • Tailwind CSS — styling, with shared design rules.
  • Supabase — database, authentication, live updates and image storage.
  • Vercel — hosting and scheduled cleanup (tournaments are deleted after 90 days).
  • Google Books, Open Library and TMDb — title search and metadata.

Architecture diagram. A React interface talks to a Next.js API, which calls the application logic for rooms, rounds and voting, and a metadata layer for search, cache and enrichment. The logic uses Supabase (PostgreSQL, Auth, Realtime and Storage) and sends web push notifications. The metadata layer caches in PostgreSQL and queries Google Books, Open Library and TMDb. Vercel Cron calls the API to clean up expired tournaments.

Less typing, more choosing

Typing was what hurt most in the old process, so that’s where I started. Behind the search sits an enrichment layer. It fills in what’s missing (covers, descriptions, release years, authors or directors) and keeps looking for useful details, without ever overwriting something the organizer has edited.

Early on, I decided to use only free APIs, and that constraint ended up shaping the architecture. Free tiers come with rate limits, slow responses and incomplete results. So search asks the primary provider first and only calls the next one if the first fails, comes back empty or takes too long. That way, quota isn’t spent on every keystroke. A provider that keeps failing is skipped for a while, and repeated searches are served from a cache. For books, Google Books and Open Library complement each other. For movies and series, TMDb has been enough on its own, and if I ever want a fallback there, it takes one file and one line in a registry.

How the matches work

Each round shuffles the remaining titles with the Fisher–Yates algorithm and pairs them off in order. I like how little code that takes. There’s no separate logic for a bye (a nominee without an opponent), because with an odd number of titles, the one left over after the shuffle simply advances without a vote.

How a round is drawn. Five titles are shuffled and paired in order. Two matches go to a vote, and the leftover title advances through a bye.

There’s no fixed bracket either. Every round draws fresh pairings from whoever is still standing. The random generator can be swapped out in tests, so a shuffle can be checked against an exact order.

The organizer can guide everyone through one match-up at a time, or let participants vote through the round at their own pace. Winners advance until one title remains.

What the audiovisual club taught me

Two things I got wrong, and both showed up only when real people used the app.

The first was the elimination round. With 16 candidates, a full knockout would have taken too many rounds, so I added an optional preliminary round to cut the list down before the bracket starts. I had designed it so that people voted for the titles they wanted to eliminate. It made sense to me, but everyone read the screen and voted for what they wanted to keep. So I turned the logic around: the organizer decides how many titles go out, and each person picks the ones they want to keep. The lesson was simple: the interface has to match what people expect, not what I intended.

The second was access. Participants don’t create accounts, which keeps joining easy, but it also means their access lives in the browser. Open the link in a different browser, or clear your data, and you lose your place in the tournament. So I added a personal return link: the organizer generates it for one participant, and it restores that exact session, votes included. Since the participant ID works as a credential, the link rotates it when used, and the database stores only a hash of the token.

Live updates, and protecting the results

A tournament only works if every screen tells the same story. When someone votes or the organizer closes a round, everyone’s screen has to follow. The app stays in sync through database events: Supabase Realtime listens to changes in Postgres, like a new vote or a round closing, and pushes them to every connected device. The interface reacts to what actually happened in the database, not to what it guessed.

That is also why Supabase felt like the natural choice. The same platform handles authentication, storage and Row Level Security, and the part that matters most happens inside the database. The application manages the tournament, and the database protects its results. It prevents duplicate votes, and closing a round (recording the winners, eliminating the losers and preparing the next round) happens in a single transaction: either the whole update succeeds, or none of it does. That matters when someone votes at the exact moment the organizer closes a round.

Realtime has limits, too. When a phone locks its screen, it suspends the connection, and Supabase doesn’t replay what was missed. So the app checks for changes again as soon as the page becomes visible.

Keeping the design consistent

I like my apps to look good, but a visual theme is only a starting point. Keeping new features consistent takes explicit rules, especially when AI agents help you build.

My recurring problem was agents redesigning components whose design had already been decided. Left alone, you end up with three or four button styles doing the same job, and an app that looks like a patchwork quilt. So the repository has a design guide covering the system I created: colors, typography, spacing, components, loading states and accessibility. The agents are instructed to read it before creating new components. Buttons, for example, reuse the established primary, secondary, tertiary and destructive styles, so new features build on existing choices instead of starting another design system inside the same app.

Testing

I built the whole app in a couple of weeks, refinement included. It has about 1,300 unit tests and 61 end-to-end tests. The unit tests cover the logic and the API routes. The Playwright tests cover the organizer and participant flows, including voting on a phone and a full movie tournament, and they run against a real local Supabase stack rather than a mock.

CI runs on every pull request, but running everything each time burned through my GitHub Actions quota and made the pipeline slow. So I wrote a small script that reads the diff and decides what to run. A docs-only change runs nothing, a change to the voting interface runs only the affected specs plus a smoke test, and anything global, or any push to main, runs everything.

In use

Here is the audiovisual club’s movie tournament, from the first vote to the champion. In this one, 157 votes over five battles and an elimination round ended with Anatomy of a Fall beating A Real Pain 13–8 in the final.

The champion screen of a movie tournament, showing the winning poster, title, director and synopsis under a gold crown.

The champion screen of a real movie tournament.

The final result, 13 to 8, with the champion’s path through each round and buttons to share the result or start a new tournament.

The final, the path to the title and the share options.

A list of every battle by round, showing vote counts, a bye and two ties decided by a random draw.

Every battle, including a bye and two ties settled by a draw.

Tournament statistics with 157 votes, 5 battles and 4 rounds, the elimination round, the tightest battle and the biggest win.

The tournament in numbers.

← Back to all posts