ALM Vote Manager
Volunteer project · TypeScript, Next.js
An app to pick the player of the match at the Évreux basketball club. Spectators scan a QR code at the venue, sign up and vote from their phones.
ALM is the basketball club in Évreux, my hometown. At every home game, the crowd picks the best player of the night, the MVP. The club used to vote by show of hands or on paper, which took a while and made the count rough at best. I built this app so that every spectator could vote from their phone, without installing anything. It was used for about ten games, with 180 spectators voting in total.
A match night
The home page shows a QR code, designed to be projected on a screen at the venue. Spectators scan it, fill in a short sign-up form, then land on the list of players. Injured players are left out, and one tap casts a vote. It takes under a minute to go from the scan to the vote.
On the club’s side, an admin opens the vote at the right moment, follows the results, then closes it. The screen then shows the podium with the MVP up front.
Two ways to sign in
Admins and spectators don’t need the same things, so they don’t sign in the same way.
Admins have an account with a password hashed with Argon2, and their sessions are handled by Lucia and stored in the database. That means I can revoke a session at any time if someone’s access needs to be cut.
Spectators don’t create a password. After signing up, they get a signed JWT that’s valid for five hours, which covers the game and the award afterwards. Nobody needs to revoke it, since it just expires. The two systems are kept apart, and a spectator token doesn’t open any admin page.
Counting the votes
A vote is just a row added to the database, with the player, the match and the time. Results are worked out at read time by counting rows per player. During the few minutes when everyone votes at once, the database only handles inserts, and no vote ever waits on another.
The dashboard doesn’t update in real time. The admin presses a button to reload the results. I considered WebSockets, but a single admin watches those numbers and decides when to close the vote, so a request on demand was enough and there was no connection to keep alive.
When the vote closes, the MVP’s name and the vote count are saved straight onto the match. That data is duplicated on purpose, so the match history loads without counting every vote again.
Spectators’ data
Signing up asks for a name, and optionally an email and a phone number, which the club can then look at in a dedicated tab. That’s personal data, so GDPR applies. It’s encrypted with AES-256 before it’s stored, and only decrypted when it’s shown to admins.
The app is hosted on Clever Cloud, along with its MySQL database, because it’s a French host and the data stays in France.
Looking back
The one-vote-per-match limit relies on a cookie. That was fine for a vote like this, but a spectator who opens a private window can vote a second time. Today I’d tie each vote to the registered spectator, with a unique constraint in the database on the spectator and match pair.
I’d also add live updates on the public side, so the screen at the venue shows the count while people vote. It would feel more alive, and the admin would keep the refresh button.
at a glance
- ContextVolunteer project for ALM Évreux Basket
- RoleDesign, development and deployment
- TeamSolo, summer 2024
- UsageAbout ten games, 180 voters
- StackTypeScript, Next.js, MySQL, Drizzle, Lucia
- HostingClever Cloud, data kept in France