System Design Interview: Designing a Dating App With Swipes and Matches
3 views
"Design a dating app like Tinder" is a popular system design interview question because it mixes location-based recommendations, very high write volume from swipes, real-time match notifications and chat. Here is a structured way to answer.
1. Requirements
Functional: users create profiles with photos and preferences (age range, distance, gender); they see a stack of nearby candidates; they swipe left or right; a mutual right swipe creates a match and both users are notified; matched users can chat. Non-functional: low latency when loading the next profiles, hundreds of millions of swipes per day, and strong privacy for location data.
2. Estimates
With 20 million daily active users making 100 swipes each, that is 2 billion swipes per day, roughly 23,000 per second on average and several times more at evening peaks. Swipes are the main write load; profile reads come from cached recommendation stacks.
3. Core services
- Profile service: profiles and preferences in a relational or document store; photos in object storage behind a CDN.
- Location service: stores each user's approximate location, updated when the app opens; indexes users by geographic cell (geohash or S2 cells) for nearby queries.
- Recommendation service: builds a candidate stack per user.
- Swipe service: records swipes and detects matches.
- Match and chat services, with push notifications.
4. Building the candidate stack
Query users in nearby cells who match mutual preferences, exclude people already swiped on, then rank by signals such as activity recency, profile completeness and likelihood of mutual interest. Precompute stacks of 100 to 200 candidates in the background and cache them, so swiping feels instant. Refill when the stack runs low.
5. Recording swipes and detecting matches
Store swipes keyed by (swiper_id, swipee_id) in a scalable key-value store such as Cassandra or DynamoDB. When user A swipes right on B, check whether a right swipe from B to A exists. If so, create a match record for both users and send notifications. To make the check cheap, keep "who liked me" sets per user in a fast store. Make the operation idempotent so a retry does not create duplicate matches.
6. Excluding already-seen profiles
A per-user set of swiped IDs can grow large. Use a Bloom filter per user for fast "probably seen" checks during recommendation, backed by the swipe store for exact answers.
7. Chat
Use WebSockets through a gateway, store messages in a partitioned store keyed by match_id, and fall back to push notifications for offline users. Only matched users can message each other.
8. Safety and privacy
Never expose exact location; show rounded distance. Detect fake profiles and spam with rate limits, photo verification and reporting tools. Allow blocking and unmatching that immediately hides both users from each other.
9. Trade-offs
Freshness versus cost of precomputed stacks, eventual consistency for swipe counts, and how aggressively to rank versus showing a fair variety of profiles.
Walk the interviewer through requirements, scale, stacks, swipes and safety. If you want help while they push on details, Linkjob AI (https://linkjob.ai) offers real-time help during job interviews and technical interviews, including system design rounds.