An online auction is a competitive, time-based bidding system where users place offers and the highest valid bid wins.
Functional Requirements
- Users(sellers) can post an item for auction with starting price, auction duration, etc..
- Users can place bid on active auction where each new bid must be higher than current highest bid.
- Users can view an auction, like the auction details as well as highest bid on the auction.
Non-Functional Requirements
- The system should provides strong consistency over bid
- No two users should both “win”
- Highest bid must always be correct
- The system should support low latency.
- Users should be able to see highest bid on auction in real-time
- Users should be able to view details of an auction in less than 200ms
- The system should support high throughput - 10M concurrent auctions
- The system should be fault tolerant and durable
- We should not lose any bids
Data Model
- User: Represents a participant in the system. A user can act as a seller or a buyer.
- Auction: Represents an active listing where an item is being sold. It includes details such as starting price, current highest bid, start/end time, and auction status.
- Item: Represents the product being auctioned. It contains metadata like name, description, category, and images.
- Bid: Represents an offer made by a user on an auction. It includes the bid amount, the bidder, and the timestamp.
API Design
1. Users can post an item for auction
POST /auctions -> Auction { itemID: Item_id, startTime: start_time, endTime: end_time startingPrice: 123, }
2. Users can make a bid on an auction
POST /auctions/:auctionID/bids -> Bid
3. Users can view auction details
GET /auctions/:auctionID -> Auction & Item