Loyalty Points management System: System Design Interview

Design the backend components and APIs for implementing loyalty points capability XYZ e-commerce.
Every time an authenticated customer buys from XYZ e-commerce in any channel, he/she gains

  1. loyalty points for every 10 pounds spend. To keep is simple, we round off to nearest integer and assign only integer points - there is no notion of points with decimals.
  2. Every time a customer logs into our website or mobile app, we will show a dashboard with top n ranking (n can be 10, 20, etc.). the dashboard will show a proxy name for the customer, his/her rank and number of points for the customers with top n ranks.
  3. Show the position of the customer in the dashboard along with 2 (configurable) customers ranked above and 2 (configurable) customers ranked below along with ranks and score.
  4. 50 millions customer in UK and Ireland
  5. 10 millions orders everyday -- summing up to mobile, store, website
  6. 10 millions DAU
  7. 10 transactions/day each user
  8. reading the system -- 100k/second
  9. proxy name --- confidential name

----------Functional Requirements:----------

  1. User should be able to view dashboard along with 2 (configurable) customers ranked above and 2 (configurable) customers ranked below along with ranks and score.
  2. When customer buys from XYZ e-commerce in any channel, he/she should gains loyalty points

----------Non-Functional Requirements:----------

  1. The system should have high availability for viewing the dashboard but should consistence for calculating Loyalty and dashboard results.
  2. The system should have low latency search
  3. The system should be scalable and able to handle high throughput for reading 100k/second
  4. The system should be scalable and able to handle high throughput for writing 10 millions * 10 /day

----------Core Entities----------

  1. User
  2. Loyalty
  3. Rank
  4. Order

----------API----------

1. Buying Items POST:/order/orderId -> status like success or failure of placing order
{
"ItemIds": string[],
"paymentDetails": ...
}

2. Get dashboard GET:/loyalty/userId -> Rank[]

3. Inserting loyality POST:/loyalty/userId --> loyaltyId
{
loyalty-points:"Integer"
}

High-Level Design
image

Deep Dives
image

Read Optimize
image

Comments (1)