Skip to main content

Classic design · Mid

Matching app (Tinder)

Classic interview design. Key points: probabilistic data structures and geospatial indexing.

14 min read · Content reviewed on October 23, 2026

Short answer

Classic interview design. Key points: probabilistic data structures and geospatial indexing. A matching app shows a stack of profiles, and the person swipes to like or pass. When two people like each other, the app notifies both. The focus of the exercise is the profile stack and the swipe, not chat or photos.

01 · CONTEXT AND REQUIREMENTS

What a matching app needs to do

A matching app shows a stack of profiles, and the person swipes to like or pass. When two people like each other, the app notifies both. The focus of the exercise is the profile stack and the swipe, not chat or photos.

Functionally, the person creates a profile with preferences and a maximum distance, sees a stack of profiles within those limits, and swipes on each one. On the non-functional side, four demands drive the design: strong consistency on the swipe, scale for many daily users, a stack loaded with low latency, and no repeated profiles.

02 · API AND FIRST VERSION

Three endpoints and two services

The API has one route for the profile (POST /profile), another for the stack (GET /feed, which receives the client's current location), and another for the swipe (POST /swipe/{userId}).

The first version separates the profile service from the swipe service, each with its own database. The reason is that a profile is created and viewed far less often than swipes are written, so the swipe service needs to escalar by itself. For the write volume, the source picks Cassandra, partitioned by the swiping user, accepting eventual consistency as the tradeoff.

  1. The app sends the request to the API Gateway.

    Architecture diagram: Tinder: first version
    CLMobile app
    NWAPI Gatewayroteia
    CPProfile service
    DBProfile database
    CPSwipe service
    DBSwipe database
    CPPush (APNS or FCM)
  2. Profile and stack requests go to the profile service, which queries the profile database.

    Architecture diagram: Tinder: first version
    CLMobile app
    NWAPI Gateway
    CPProfile serviceprofile and stack
    DBProfile databasereads and writes
    CPSwipe service
    DBSwipe database
    CPPush (APNS or FCM)
  3. Each swipe goes to the swipe service, which writes to the swipe database and looks for the reverse swipe.

    Architecture diagram: Tinder: first version
    CLMobile app
    NWAPI Gateway
    CPProfile service
    DBProfile database
    CPSwipe servicewrites and checks
    DBSwipe databaseswipe written
    CPPush (APNS or FCM)
  4. If the reverse exists, whoever just swiped sees the match right away and whoever liked first gets a push.

    Architecture diagram: Tinder: first version
    CLMobile app
    NWAPI Gateway
    CPProfile service
    DBProfile database
    CPSwipe service
    DBSwipe database
    CPPush (APNS or FCM)notifies the first one

03 · SWIPE CONSISTENCY

When two people like each other at the same time

The risk is a race. If the two swipes arrive almost together, each server looks for the reverse swipe and finds nothing; then both swipes are written. Both are saved, but the chance to notify the match is lost.

The source notes that consistency can be relaxed and a periodic reconciliation run that notifies reciprocal pairs. Since the requirement is to notify the last person to swipe right away, the design proceeds with strong consistency, and the comparison below shows the options.

AbordagemPonto-chaveLimite
Database pollingScans for reciprocal swipes from time to time.Does not notify the match immediately.
Cassandra lightweight transactionUses Paxos for linearizability.Only works within a single partition.
Partition per user pairAll swipes between two users live in the same partition.Hot partitions with very active users.
Redis with Lua scriptWrites and checks atomically.Loses only the detection of very recent swipes if Redis fails.
  1. The app sends the swipe to the service, which builds a unique key for the user pair, in the same order for both directions.

    Architecture diagram: Tinder: atomic match detection
    CLMobile app
    CPSwipe servicepair key
    CHPair Redis
    DBSwipe Cassandra
    CPPush (APNS or FCM)
  2. The service tells Redis to write the swipe and read the other person's swipe in one atomic operation.

    Architecture diagram: Tinder: atomic match detection
    CLMobile app
    CPSwipe service
    CHPair Rediswrites and checks
    DBSwipe Cassandra
    CPPush (APNS or FCM)
  3. If the other person also liked, the match is created and whoever liked first gets the push.

    Architecture diagram: Tinder: atomic match detection
    CLMobile app
    CPSwipe service
    CHPair Redis
    DBSwipe Cassandra
    CPPush (APNS or FCM)notifies the first one
  4. Cassandra remains the durable store of the history, and Redis keeps only the recent swipes.

    Architecture diagram: Tinder: atomic match detection
    CLMobile app
    CPSwipe service
    CHPair Redis
    DBSwipe Cassandradurable history
    CPPush (APNS or FCM)

04 · PROFILE STACK

A fast stack, with filters and distance

Querying the profile database directly is slow, and the location search is the slowest part. The way out is a search index with geospatial support, kept up to date with the transactional database through change data capture (CDC).

Another way out is to precompute the stacks in the background and store them in cache. This delivers the stack instantly, but very active users exhaust the cache and the stack can become stale, that is, contain profiles that no longer meet the filters.

StrategyVantagemLimite
Search indexQueries filters and distance in real time.Keeping the index in sync with the transactional database.
Precomputation in cacheStack ready when the app opens.Very active users exhaust the cache.
Combination of bothStarts generating more profiles in real time when the cache runs out.May serve stale profiles.
  1. When the app opens, the request reaches the feed service.

    Architecture diagram: Tinder: profile stack
    CLMobile app
    NWAPI Gateway
    CPFeed servicereceives the order
    CHFeed cache
    DBSearch index
    CPPrecomputation job
    DBProfile database
    CHAlready-seen filter
  2. The service delivers the precomputed stack that is in the cache, with no expensive query.

    Architecture diagram: Tinder: profile stack
    CLMobile app
    NWAPI Gateway
    CPFeed service
    CHFeed cacheready stack
    DBSearch index
    CPPrecomputation job
    DBProfile database
    CHAlready-seen filter
  3. A background job recomputes the stacks, generally only for active users.

    Architecture diagram: Tinder: profile stack
    CLMobile app
    NWAPI Gateway
    CPFeed service
    CHFeed cache
    DBSearch index
    CPPrecomputation jobrecalcula
    DBProfile database
    CHAlready-seen filter
  4. When the stack is running low, the service queries the search index to generate more profiles in real time.

    Architecture diagram: Tinder: profile stack
    CLMobile app
    NWAPI Gateway
    CPFeed service
    CHFeed cache
    DBSearch indexfilters and distance
    CPPrecomputation job
    DBProfile database
    CHAlready-seen filter
  5. Change data capture carries the changes from the profile database to the index.

    Architecture diagram: Tinder: profile stack
    CLMobile app
    NWAPI Gateway
    CPFeed service
    CHFeed cache
    DBSearch indexatualizado
    CPPrecomputation job
    DBProfile databasesource of truth
    CHAlready-seen filter

To limit staleness, the source suggests a strict TTL for the cache and precomputation only for active users; changing filters or location can also trigger a background refresh.

05 · ALREADY-SEEN PROFILES

Never repeat a profile

Showing a profile again after it was already swiped gives the impression that the swipe was lost. The simplest approach queries the user's swipe history and filters out the ones already seen. It can miss swipes and re-show profiles, and becomes more expensive as the history grows.

A first reinforcement is for the app itself to store recent swipes and filter the stack on the client. For large histories, the source proposes a per-user Bloom filter. It can flag a profile as already seen when it was not, but it never fails to flag one that was, so the cost is hiding some profiles forever. The error rate is tunable and tied to the space used.

The operational cost is keeping the filter up to date and rebuilding it if the cache goes down, which is easy to do from the swipes but expensive at scale.

Frequently asked questions

What is Matching app (Tinder)?

Classic interview design. Key points: probabilistic data structures and geospatial indexing.

What does the Matching app (Tinder) design cover?

It is organized in these sections: What a matching app needs to do, Three endpoints and two services, When two people like each other at the same time, A fast stack, with filters and distance, and Never repeat a profile.

How long is Matching app (Tinder) and what level is it?

It takes about 14 minutes to read and is rated Mid level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.