Social Commerce Platform

Shoppable posts, live drops and creator commissions

Design a social app where creators tag products in videos and live streams, viewers buy without leaving the app, limited drops sell out without overselling, and creators are paid a commission that is reversed when a sale is refunded.

Overview

A social commerce app puts a buy button inside the content. A creator tags a product in a video or holds it up during a live stream, a viewer taps the tag, sees the product card and pays without leaving the app. The platform takes the order, the seller ships it, and the creator earns a commission on the sale.

Three parts are worth the interview time. The live drop: a creator announces 2,000 units and 200,000 viewers tap at once; the system must sell exactly 2,000, fairly, in seconds. Attribution: when a viewer saw two creators promote the same product and bought a day later, which one gets the commission? The money: commissions are owed only on sales that stick, so a refund must reverse the commission, exactly once, even after a payout.

Most of the rest (video delivery, feed ranking, catalog tools) is its own system design problem; name it and keep it out of scope.

Questions to ask first

Settle these with the interviewer first. Each comes with the answer this design assumes.

  • Checkout in the app, or a link to the seller's site? In the app: the platform takes the order and the payment.
  • How big is a live drop? Up to 200,000 viewers and a few thousand units, at most 2 per buyer.
  • Which attribution model? Last touch within 7 days, for the same product, and stated to creators.
  • When is a commission paid? Monthly, once the return window for that sale has closed.
  • Must paid promotion be labeled? Yes. Tagged affiliate content carries a disclosure label.
  • Several sellers? Yes, it is a marketplace. Payments to sellers are out of scope here.

The design at a glance

The viewer app sends every request through an API gateway. Product cards are read from a product cache, while checkout claims drop units from Redis drop counters with a Lua script, confirms the sale in the orders database and takes the money through the payment provider. Separately, the app reports impressions and taps to an event collector, which appends them to an event stream; the attribution service reads that stream and writes commissions to the commission ledger. The Visual Explanation below draws it, starting with the most common path, a tap on a tag.

What you will be able to do

  • Sell a limited live drop without overselling, with a per-buyer limit and holds that expire.
  • Size the live-stream burst and see that broadcasting the countdown, not selling, is the heavy part.
  • Attribute a sale to a creator with a stated window and model, and explain why in-app checkout makes this easier.
  • Keep a commission ledger where refunds reverse commissions exactly once and payouts are never doubled.
  • Say what disclosure rules mean for the product.

Key concepts

  • Product tags
  • In-app checkout
  • Limited drops
  • Atomic counter with a Lua script
  • Holds with expiry
  • Fan-out of the countdown
  • Attribution window
  • Last-touch vs first-touch
  • Commission ledger
  • Disclosure labels

Functional requirements

  • Creators tag products in videos, posts and live streams
  • Viewers open a product card from a tag and buy in the app
  • Creators run limited drops during a live stream with a live stock countdown
  • Each sale is attributed to at most one creator and content item
  • Creators see earnings: pending, payable and paid
  • Refunds and returns reverse the commission on that sale
  • Tagged affiliate content shows a disclosure label

Non-functional requirements

  • A drop never sells more units than it has (strict correctness)
  • The product card opens in under 300 ms at p99 (a target we chose)
  • The countdown on viewers' screens may lag by about a second; the sale may not
  • A commission is earned at most once per order line and reversed at most once
  • Attribution rules are deterministic: the same events always give the same creator

Interview questions

  • How do you sell a 2,000-unit drop to 200,000 viewers without overselling?
  • Why not just use a database row lock for the drop?
  • How do you show a live stock countdown to 200,000 viewers?
  • A viewer watched two creators promote the same lamp and bought it a day later. Who gets the commission?
  • Why does in-app checkout make attribution easier?
  • How do you reverse a commission when an order is refunded?
  • How do you make sure a creator is never paid twice for the same month?
  • What does the platform have to do about disclosure?

Sign up free to read the full topic

More System Design topics

Start free on Cariara · Coding problems · System design studio