KatInterview

Product Review Platform with Helpful Votes and Author Payouts

System DesignModel answer
HardModel answerSystem Designsystem-designidempotencydistributed-counters

Last updated

Design a high-traffic product review service with idempotent helpful-votes, scalable counters, ranking, abuse defenses and an exact, auditable author reward flow.

You are asked to design the backend for a review feature on a large online marketplace. Shoppers write reviews for products they bought, and other shoppers mark those reviews as helpful or unhelpful. Review authors earn rewards once their reviews pass certain helpful-vote thresholds.

Your design should cover:

  1. APIs for creating a review, casting/changing/withdrawing a vote, fetching the top reviews of a product, and viewing and claiming rewards.
  2. Data model for reviews, individual votes, per-review aggregate counters, and rewards.
  3. Voting correctness: one vote per user per review, safe under client retries and duplicate messages, with support for changing or undoing a vote.
  4. Counter strategy: how you keep vote totals accurate enough and cheap enough when a single review can receive a burst of votes (for example sharded, batched or approximate counters), and which numbers must be exact.
  5. Ranking: how "top" reviews are chosen and served.
  6. Abuse resistance: fake accounts, coordinated brigading, self-voting, vote rings.
  7. Scale, caching and consistency: read/write path separation, failure handling (failover, retries, deduplication), and the consistency level you pick for each piece of data.
  8. Operations: monitoring and how you would repair or rebuild derived data.

State your own scale assumptions (users, products, reviews, votes per day, read QPS) and use them to justify choices such as sharding and caching.

Hints

Hint 1

Make the vote endpoint a PUT that sets an absolute value (+1, -1, 0) rather than a toggle or increment, so retries are naturally idempotent. Treat the votes table as the source of truth and everything else as derived.

Hint 2

Separate the paths: a small transactional write to the votes store plus an outbox event, then asynchronous aggregation into counters. Think about micro-batching and spreading a hot review's writes over several counter shards.

Hint 3

Display counts can lag by seconds, but reward eligibility cannot be approximate. Use unique constraints on (review, milestone) and on ledger entries, and compute rewards from exact, abuse-filtered counts.

Hint 4

Raw up minus down is a weak ranking signal. Consider a confidence-based score such as the Wilson lower bound, optionally weighted by voter trust, and cache the top N per product.