Design a Tinder-like Dating App Matching System

Medium
Real World SystemsMatching AlgorithmGeolocationSwipe MechanicsProfile ManagementRecommendation

Problem Statement

Design the core backend of a dating/social matching application like Tinder — handling user profiles, preference-based discovery, swipe mechanics, mutual match detection, and match conversations.

Requirements

Functional Requirements

  • User profiles: photos, bio, age, gender, location, interests
  • Preference settings: age range, distance radius, preferred gender(s)
  • Discovery feed: show potential matches based on preferences and proximity
  • Swipe RIGHT (like) or LEFT (pass) on profiles
  • Mutual match: if both users swipe right on each other, create a Match
  • Match notification: both users notified on mutual match
  • Conversation unlocked only after a match
  • Super like (limited per day): shows user prominently to the liked person
  • Undo last swipe (premium feature)
  • Block/report users

Non-Functional Requirements

  • Thread-safe match detection (concurrent swipes)
  • Location-based profile ranking
  • Singleton MatchingService

Key Entities

  • UserProfile: id, name, age, gender, bio, photos, location, preferences, interests
  • Swipe: swiperId, targetId, type (LIKE/PASS/SUPER_LIKE), timestamp
  • Match: id, user1, user2, matchedAt, conversation
  • Conversation: matchId, messages
  • DiscoveryService: filters and ranks potential matches
  • MatchingService: Singleton; manages swipes, match detection, conversations

Constraints

  • Super like limited to 1 per day (free) or 5 per day (premium)
  • Discovery feed excludes: already swiped, blocked, and users outside preferences
  • Distance calculated using Haversine formula (simplified: Euclidean OK for interviews)
  • Conversation only available after mutual match
  • Undo limited to last 1 swipe (premium only)

!Constraints

- Super likes: 1/day free tier, 5/day premium - Discovery excludes already-swiped and blocked profiles - Mutual match detection must be thread-safe (concurrent right swipes) - Messaging only available between matched users - Undo only available to premium users, for last swipe only
Output

Run or submit your code to see output here.