Price Tracking Service
Product Price Monitoring and Alerts
Design a service that checks product prices on shopping sites on a schedule, keeps their history, and tells users when a price drops to the target they set.
Overview
A price tracker watches product pages for people. A user pastes the link to a kettle, says 'tell me when it costs $30 or less', and forgets about it. The system fetches that page every few hours, reads the price, stores it when it changes, and sends one message when the price reaches the target.
The flow is simple: schedule, fetch, extract, compare, alert. The interview goes deep on three places. Scheduling: which of ten million products to check next, when each shop allows only so many requests. Extraction: reading a price reliably from pages that all look different. Alerting: sending each alert once, at the right moment, even when prices wobble around the target.
This is a small cousin of the Web Crawler problem (fetching politely at scale), the Job Scheduler problem (running work when it is due) and the Notification System problem (delivering messages reliably). Name those links in the interview; do not redesign all three.
Questions to ask first
- How many products and shops? — 10 million tracked products across about 100 retailers
- How fresh must prices be? — Hourly for popular products, daily for the rest
- How do we get prices? — The retailer's product API or feed where one exists; otherwise fetch the public page within the site's rules
- What alerts? — Price at or below a target; later, percent drops
- How fast after a drop? — Within 15 minutes of our check seeing it (a target we chose)
- Which channels? — Email and mobile push; SMS out of scope
What you will be able to do
- Size the fetch load from product counts and check intervals, and see why each site's limit caps freshness.
- Schedule checks by priority with a due time per product, and claim work safely with several workers.
- Read prices from structured data first, validate them, and store them as integer cents with a currency.
- Fire an alert once when a price crosses its target, and never twice for the same drop.
Key concepts
- Crawl scheduling
- Per-site politeness
- robots.txt (RFC 9309)
- Structured data extraction
- Change detection
- Alert crossing and re-arm
- Notification outbox
- Price history
Functional requirements
- Add a product by URL (or from the browser extension) and start tracking it
- Set, change and delete a target price per product
- Show the price history as a chart
- Notify the user by email or push when the price reaches the target
- Handle several currencies; never compare prices in different currencies
- Mark products unavailable or out of stock instead of recording a price of zero
Non-functional requirements
- Popular products checked about hourly, everything else at least daily (targets we chose)
- An alert goes out within 15 minutes of the check that saw the drop
- Never send the same alert twice for one drop; never alert on a price we could not read
- Stay inside every site's rules: robots.txt, its terms, and a per-site request budget
- Alert sending stays available 99.9% of the time; fetching may lag first
Interview questions
- How do you decide which products to check next?
- How do you avoid being blocked, and what are the rules?
- How do you extract prices from so many different sites?
- How do you make sure a user gets one alert per price drop?
- What if the same product is tracked by a million users?
- How would you add a percent-drop or all-time-low alert?
- How do you store and serve the price history chart?
- What do you monitor?
Sign up free to read the full topic
More System Design topics
Start free on Cariara · Coding problems · System design studio