Design Truecaller
Understanding the Problem
📞 What is Truecaller? Truecaller is a caller ID and spam blocking app. When an unknown number calls, it shows a name ("Priya Sharma" or "City Dental Clinic") and, if enough people have reported it, a red "Likely spam: Telemarketing" banner, all before you've decided whether to answer. The names come largely from crowdsourced data, and the spam labels come from users reporting the calls they get.
Functional Requirements
Core Requirements
- Users should see a name and a spam label for an incoming call from an unknown number, while the phone is ringing.
- Users should be able to report a number as spam (with a category) or mark it as not spam, and suggest a name for it.
- Users should be able to search any number and see its name and spam status.
- Users should get basic protection (known spam numbers labeled or blocked) even when the phone has no data connection.
Below the line (out of scope)
- Messaging, payments and other features the app has grown.
- SMS spam filtering (similar ideas, different pipeline).
- The contact upload and consent flows in detail, beyond noting they must exist.
Non-Functional Requirements
Core Requirements
- A lookup must return within about 300 ms at p99 end to end. The phone shows the incoming call immediately, and caller ID that appears after the user has already answered or declined is useless.
- The system should handle hundreds of millions of users. With 300M daily users receiving about 10 calls each, that's 3 billion lookups a day, roughly 35,000 per second on average and 100,000+ per second at peak.
- New spam campaigns should be labeled within minutes to hours, not days.
- Spam labels should be hard to game: a competitor shouldn't be able to get a legitimate business labeled spam, and a spammer shouldn't be able to clear their own label.
- Lookups should be private and protected from bulk scraping: the directory must not become a downloadable database of everyone's name.
Below the line (out of scope)
- Strong consistency. A label that's a few minutes stale is fine.
Some math. There are billions of phone numbers in the world. Say we hold profiles for 5 billion numbers at about 200 bytes each (best name, spam score, labels, counts, type): about 1 TB. That fits comfortably in a distributed key-value store, and a hot subset fits in a cache.
The read pattern is very skewed. Most calls come from a small set of numbers: telemarketers and robocallers hit thousands of people a day, and businesses call many customers. Your aunt's number is looked up rarely. So a cache will have a very high hit rate on exactly the numbers that matter most for spam.
Writes are small by comparison. Even if 2% of calls produce a spam report, that's 60 million reports a day, about 700 per second.
The core of this design is a read-heavy key-value lookup on a phone number with a tight deadline. The interesting parts are what goes into that value (a name chosen from noisy data, a spam score that's hard to manipulate) and how to answer when the network is slow or gone.