All system design challenges
#28 Search/Inventory/Catalog

Meta Marketplace

A local buy-and-sell marketplace: post listings with photos, search them by place and category, and message the seller.

Asked at Meta Roblox

What is being asked

Design a marketplace where individuals list items and nearby buyers search and contact them. The core is listing storage, location-aware search and keeping search results in step with listings that sell.

Requirements

Functional

  • Create, edit and close listings with photos, price, category and location.
  • Search by text, category, price and distance; sort by relevance or recency.
  • Buyer and seller messaging; mark as sold.

Non-functional

  • Search dominates traffic and must feel instant.
  • A sold item should leave results within seconds.
  • Photos are the bulk of the data.

Design

Web / mobile appAPI gatewayListing serviceSearch serviceMessaging serviceListings DBSearch index: text +geoObject storage + CDNIndexing pipeline
Boxes are services; rounded shapes are data stores and queues.
  1. A listing is written to the primary database, the source of truth. Photos are uploaded directly to object storage and served through a CDN in several sizes.
  2. Every change to a listing emits an event; an indexing pipeline updates a search index that supports text, filters and geographic distance.
  3. Search queries the index for ids, then loads current details for the page of results.
  4. Messaging is a separate service keyed by conversation between buyer, seller and listing.

Key decisions and trade-offs

  • Database for truth, index for search. The index is a derived copy that lags by a second or two. Filtering out sold items at read time from the database covers the gap.
  • Geo search. Indexing by geohash cell lets "within 10 km" become a small set of cell lookups plus an exact distance filter.
  • Ranking. Relevance blends text match, distance, freshness and seller quality; a pure recency sort is simple but easy to spam by re-posting.
  • Trust and safety. Listings pass automated checks for prohibited items and scams before they are indexed.

Follow-up questions

  • How would you show "new since you last looked" for a saved search?
  • How do you prevent one seller from flooding results with duplicates?
  • How would you handle a listing that goes viral?
  • What changes if the marketplace takes payment and arranges shipping?
Log in to tick off the challenges you have worked through. Log in