
Full-stack
Hangisi?
A polling app I built for getting a quick opinion from other people on small decisions. Results are visible to those who voted and to the poll owner, and open to everyone once the poll expires or its owner closes it. I wrote it alone with Django and React, and it runs at hangisi.online.
Demo
Problem
For small undecided moments like which shoes to buy or what to call something, a social media story is not focused enough and a general survey tool is not fast enough. Here you write a question, add two to seven options, optionally set a time limit and share the link. What interested me technically was how to enforce one vote per person without forcing an account. Asking people to register before voting drives them away, but leaving it fully anonymous lets one person vote a hundred times.
Highlights
- Anonymous votes are tied to a random UUID in an HttpOnly, SameSite=Lax cookie (hv_vid); a signed-in user's vote is additionally tied to the account.
- The one-vote rule is guarded by the database, not by code: unique constraints on (poll, voter_token) and on (poll, user). When two votes arrive at the same time, one gets 200 and the other 409, which I checked with a two-thread test.
- Results are visible to someone who voted, to the poll owner and, once a poll is closed, to everyone; in every other case the API sends no counts or percentages at all.
- A poll lasts 1 hour, 1 day, 7 days or forever. 'Closed' is not stored but computed from the close and expiry times, and it arrives through one annotation in the feed query, so there is no extra query per poll.
- The feed sorts by New and Popular, has Open, Closed and All filters, and pages by 20. A user profile lives at /u/username and shows no e-mail address.
- 58 test functions across the three apps (accounts, polls, core) pin the option limits, repeat votes, closed polls and ownership rules.
Architecture and notes
The backend is Django with Django REST Framework, using session authentication and CSRF; in production secure cookies and the HTTPS redirect are on. A middleware reads the anonymous voter id from the cookie on every request, or creates a new one. Business rules such as voting and closing live in polls/services.py, and the views stay thin. The front end is React, TypeScript, Vite and Tailwind; the Three.js background on the home page falls back to a static image on narrow screens and when reduced motion is requested.
The database is Supabase PostgreSQL. To work with a connection pooler, prepared statements and server-side cursors are turned off and CONN_MAX_AGE is zero. Migrations are run by hand through the session pooler only and never in the Vercel build step. I wrote that into the README because running migrations during the build is an easy mistake in a serverless setup. The app runs on Vercel with automatic Git deploys switched off.
Known limits: someone who clears cookies can vote again anonymously, which is the known limit of this method. There is also no IP-based rate limit inside the application yet.
Private repository
- Last updated
Technologies
The source code is kept private; I can show it on request.
Request flow
Hover or focus a component to see what it is.