# Design Tinder

## What are all possible Features

* User creates a profile
* login and authentication
* feed or recommendations of other user profiles
* User can swipe left, swipe right, or super like
* It's a match only if both swipe right
  * After match, conversation needs to be started within 24 hours to remain connected
  * Only female can initiate the conversation
*   option to message

    * text messages
    * share images / videos over messsages
    * Monitoring of type of messages / vulgarity


* Option to unmatch user
* Push notification (in case of a match and inactive)
* buy premium subscription, and get additional features
* payment system
* user settings: filters basis geography, age and others&#x20;

## Narrowing down the problem statement

### Functional Requirements

* User profile creation, and setting for recommendations
* Get other user profile recommendations
* Options to swipe right and left, and get a match
* non-premium account get limited number of swipes



### Non Function Requirements

* Scalability
* low latency
* read-heavy app
* security - DDOS attack handling / rate limiter

## Understanding the Scale

### Traffic

* Total number of users = 50 Million
* Number of daily active users (DAU) = 1 Million DAU&#x20;
* Number of new profiles created every day = 500 Thousand
* Total number of swipe every day = 100 \* 1 Million = 1 Billion per day
* Total number of matches per day = 10 Million per day

### Storage Requirements

* For images = 200 kb \* 6 images per user \* 50 Million users = 600 TB
*

## Data Model

<table><thead><tr><th width="257"></th><th>Swipe transaction</th><th>Swipe Data</th></tr></thead><tbody><tr><td>user_id</td><td>user_id</td><td>user_id</td></tr><tr><td>basic details</td><td>recomm_profile_user_id</td><td>date</td></tr><tr><td>image folder url</td><td>date time</td><td>total swipe count</td></tr><tr><td>enum(right swipe)</td><td>right/left/super</td><td>right swipe count</td></tr><tr><td>enum(left swipe)</td><td></td><td>super swipe count</td></tr><tr><td>enum (matches)</td><td></td><td>user type (basic / prem)</td></tr><tr><td>preferences {location, age range, gender (m,f,both)}</td><td></td><td></td></tr></tbody></table>

## System Design

### Design Considerations



### Building Microservices

* Recommendation Engine
  * Based on current preference filters
  * Only those which have not been swiped right or left in past
  * Only active users (example: who have been active in last 5 days)
  * Show less profiles to those getting a lot of matches
  * Collaborative grouping&#x20;
  * Do you reply or not
  * full text similarity between profiles

### Design Diagram

## Resources

* [https://www.youtube.com/watch?v=nBdTBDJNOh8](https://www.youtube.com/watch?v=nBdTBDJNOh8)
* [https://www.youtube.com/watch?v=iyLqwyFL0Zc\&list=PLrtCHHeadkHp92TyPt1Fj452\_VGLipJnL\&index=38](https://www.youtube.com/watch?v=iyLqwyFL0Zc\&list=PLrtCHHeadkHp92TyPt1Fj452_VGLipJnL\&index=38)
