A fast, no-backend personality quiz I built solo for an online community event. It held up to viral traffic.
The organizers of a month-long online community event wanted a set of quick, shareable personality quizzes: type in a name, get a result. It had to stay up when posts went viral, without a server to manage.
The trick was making results feel personal without storing anything. Each username went through a hash function that always gave the same answer, so people could compare results and screenshot them. With no backend, there was nothing to crash when traffic spiked.
The whole trick
function hash(str) {
let h = 0;
for (let i = 0; i < str.length; i++) {
h = Math.imul(31, h) + str.charCodeAt(i) | 0;
}
return Math.abs(h);
}
Same username in, same number out. No database needed.
Over 1.5 million visits in one month, with zero downtime and zero server costs.
A simplified mini version I rebuilt for this page. The real site looked different, so watch the demo above for that.