How to Build a Daily Card Feature Without a Database Using Hash Functions
A developer has shared a stateless approach to implementing a 'card of the day' feature that avoids the need for per-user database writes. The method uses a deterministic hash function — such as FNV-1a or xxhash — seeded with a combination of user ID, date, and deck version to always return the same card for a given user on a given day. Timezone handling remains a practical challenge, and the author settled on accepting client-reported dates while validating them within a ±1-day window of UTC. Including a deck version in the seed prevents retroactive card shifts when new cards are added to the deck. The technique is already in use on a live app called Oraclely and is best suited for ephemeral draws where storing draw history is not required.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in