- JavaScript 48.7%
- CSS 29.9%
- HTML 21.4%
| public | ||
| .gitignore | ||
| netlify.toml | ||
| README.md | ||
Hackathon Vote
A tiny mobile-first voting page for live demo rounds.
The organizer keeps one host tab open. Every phone sends its vote to that browser, and the totals live only there. No database, no accounts.
People tap A / B / C / D / E (Other). One vote per browser per round; they can change it until the host starts a new round. Connected phones update as soon as the host receives a vote.
How it works
- Organizer opens
admin.htmland leaves that tab in the foreground. - Host shows a QR code for the join URL (
index.html?room=…). - Voters scan it, tap a letter, and the host stores
{ voterId: letter }inlocalStorage. - The host pushes the new totals back to every connected phone.
If the host tab closes, voting stops. Refreshing the host tab keeps the current round (it is saved locally) and the same join QR.
Local preview
You need a local web server. Opening the HTML files directly (file://) will not connect phones.
npx --yes serve public
Then:
- On the organizer computer, open
/admin.html. - On phones, scan the QR (same Wi-Fi), or open the printed URL with
?room=….
Phones cannot join a localhost QR. For a real room, deploy to Netlify and open admin.html on the public HTTPS URL.
Deploy on Netlify
The site is static files in public/. netlify.toml already points Netlify at that folder.
Option A: Drag and drop
- Open Netlify Drop.
- Drop the
publicfolder. - Open the given URL, then go to
/admin.html.
Option B: Netlify CLI
npx --yes netlify-cli login
npx --yes netlify-cli init
npx --yes netlify-cli deploy --prod
init is only needed the first time. Later deploys:
npx --yes netlify-cli deploy --prod
Open https://<site>.netlify.app/admin.html on the organizer device, then share that page’s QR.
Try it
- Open
admin.htmlon a laptop (best) or a dedicated organizer phone. - Scan Scan to join. Totals should jump on the host and on every voter phone.
- Tap a different letter on the same phone: that vote is replaced, not added.
- Refresh a voter phone: it still has its vote for this round and sends it again when it reconnects.
- On the host, tap New round. Counts go to zero and everyone can vote again.
Keep only one admin.html tab open. A second host tab gets a new room ID, and the old QR will not reach it.
Files
| File | Role |
|---|---|
public/admin.html |
Organizer page: stores votes, QR, reset |
public/index.html |
Voter page |
public/host.js |
Host logic |
public/app.js |
Voter logic |
public/shared.js |
Shared tally / UI helpers |
public/styles.css |
Mobile-first layout |
netlify.toml |
Netlify publish directory |