Skip to content

Online Auction System (like eBay)

Quick Reference Guide for System Design Interviews


Problem Statement

Design an online auction platform where sellers can list items for bidding, buyers can place bids, and the system automatically manages auction lifecycles, determining winners and processing payments.


Requirements

Functional Requirements

  • Create auction listings
  • Place bids on items
  • Real-time bid updates
  • Automatic auction closure
  • Winner determination
  • Bid history

Non-Functional Requirements

  • Consistency: No overselling, correct winner
  • Availability: 99.99%
  • Latency: < 100ms for bid placement
  • Scale: 10M concurrent auctions, 1M bids/minute

High-Level Architecture

High-Level Architecture


Auction Data Model

-- Auctions table
CREATE TABLE auctions (
    auction_id      UUID PRIMARY KEY,
    seller_id       UUID NOT NULL,
    title           VARCHAR(500),
    description     TEXT,
    category        VARCHAR(100),
    starting_price  DECIMAL(12,2) NOT NULL,
    reserve_price   DECIMAL(12,2),  -- Minimum to sell
    buy_now_price   DECIMAL(12,2),  -- Instant purchase
    current_price   DECIMAL(12,2),
    bid_increment   DECIMAL(12,2) DEFAULT 1.00,
    start_time      TIMESTAMP NOT NULL,
    end_time        TIMESTAMP NOT NULL,
    status          VARCHAR(20) DEFAULT 'pending',
        -- pending, active, ended, sold, cancelled
    winner_id       UUID,
    winning_bid_id  UUID,
    created_at      TIMESTAMP DEFAULT NOW(),

    INDEX idx_status_end (status, end_time),
    INDEX idx_category (category),
    INDEX idx_seller (seller_id)
);

-- Bids table
CREATE TABLE bids (
    bid_id          UUID PRIMARY KEY,
    auction_id      UUID NOT NULL REFERENCES auctions(auction_id),
    bidder_id       UUID NOT NULL,
    amount          DECIMAL(12,2) NOT NULL,
    max_amount      DECIMAL(12,2),  -- For proxy bidding
    status          VARCHAR(20) DEFAULT 'active',
        -- active, outbid, winning, cancelled
    created_at      TIMESTAMP DEFAULT NOW(),

    INDEX idx_auction_amount (auction_id, amount DESC),
    INDEX idx_bidder (bidder_id)
);

-- Bid history (denormalized for fast reads)
CREATE TABLE bid_history (
    auction_id      UUID,
    bid_id          UUID,
    bidder_id       UUID,
    amount          DECIMAL(12,2),
    created_at      TIMESTAMP,

    PRIMARY KEY (auction_id, created_at, bid_id)
);

Bid Placement Flow

Bid Placement Flow


Proxy Bidding (Auto-Bidding)

Proxy Bidding


Auction Lifecycle

Auction Lifecycle


Real-Time Updates

Real-Time Updates


Concurrency & Consistency

Concurrency


Interview Discussion Points

  1. How do you handle concurrent bids?
  2. Distributed lock or optimistic locking
  3. Atomic operations in Redis
  4. Last valid bid wins

  5. How do you ensure correct winner?

  6. Strong consistency for bid processing
  7. Transaction for bid + auction update

  8. How do you handle auction ending?

  9. Scheduled job or delayed queue
  10. Process at exact end time

  11. How do you implement proxy bidding?

  12. Store max bid
  13. Auto-increment on competing bids

  14. How do you prevent sniping?

  15. Extend auction on last-minute bids

  16. How do you scale hot auctions?

  17. Redis for current price
  18. Async persistence
  19. Rate limit bid frequency