KatInterview

Design a B2B Product Engagement & Liking System

System DesignModel answer
MediumModel answerSystem Designsystem-designdata-modelingcaching

Last updated

Design a scalable backend architecture for product likes on a wholesale platform, handling dual-access querying, search result enrichment, counter aggregation, and brand metrics.

Design the backend system for product likes (engagement reactions) on a wholesale B2B marketplace.

On this platform, brands list products and retailers browse, search, and express interest in them.

Your design must support four core functional capabilities:

  1. Toggle Reaction: A retailer can like or dislike (remove like / set neutral) a product.
  2. Retailer Liked Products: A retailer can retrieve a paginated view of all products they have liked, ordered by most recent.
  3. Search Result Enrichment: When a retailer executes a search or browses a catalog page, each returned product must show its total aggregate like count and an indicator of whether the current retailer has liked it.
  4. Brand Analytics: A brand can view engagement stats and buyer interaction histories across all products in their brand catalog.

Specific Scope & Constraints to Address

  • Define latency vs. consistency trade-offs (e.g., immediate visibility for the active buyer vs. eventual consistency for public counts).
  • Present data models and storage choices for handling both access directions efficiently (retailer-centric and product/brand-centric).
  • Detail the read path strategy for search enrichment to prevent $N+1$ query bottlenecks.
  • Explain counter maintenance, idempotency, data reconciliation, and lifecycle policies (soft deletes of products or retailer accounts).

Hints

Hint 1

Clarify whether 'dislike' represents an explicit negative signal or simply removing a previously applied like. Choose a clean status model.

Hint 2

Address the two main query paths: querying by retailer_id to show a user's library versus querying by product_id/brand_id for search and vendor analytics.

Hint 3

Separate the strict read-your-own-writes consistency path for the acting buyer from the highly performant, eventually consistent aggregation path for public search counters.