Design Likes and Reactions
MediumSystem design · Social
Design a likes and reactions service used across content types (posts, comments, videos). A user can have one reaction per item and can change or remove it; every item shows per-type counts; some actions notify the author. Focus on separating the exact per-user state from eventually consistent counts, hot-item contention, idempotency and the 'who reacted' list. Out of scope: the feed and content services themselves.
Requirements
- Enforce one reaction per user per item, with idempotent upserts of desired state
- Maintain counts without a contended row per item: batched asynchronous aggregation, sharded for hot items
- Never lose count events: emit from a transactional outbox/change feed and reconcile from the source of truth
- Support bulk count reads for a page of items, a paginated reactor list, abuse limits and throttled notifications