Scalable Database
Location-based App
Dating Technology
Horizontal Scaling
Mobile App Development

Location based horizontal scalable dating app database model

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

A location-based dating app is not just a user-profile database with a distance query added on top. It is a mix of very different workloads: profile storage, proximity search, swipe events, match creation, chat, and presence updates. A horizontally scalable design usually succeeds by separating those workloads instead of forcing all of them into one giant relational schema or one giant document store.

Split the Problem into Data Domains

A practical architecture usually separates at least these concerns:

  • user identity and profile data
  • geospatial discovery
  • swipe and match state
  • chat and notifications
  • analytics and recommendation features

Trying to store all of that in one database often creates conflicting requirements. For example:

  • profile data wants strong consistency and straightforward updates
  • nearby-user search wants efficient geospatial indexing
  • chat wants write-heavy append behavior
  • analytics wants event streams and aggregation

So the most important database-model decision is usually not table design. It is domain separation.

A Reasonable Core Model

A relational database is often a good fit for canonical user and relationship data.

Example tables:

sql
1CREATE TABLE users (
2    user_id BIGSERIAL PRIMARY KEY,
3    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
4    status TEXT NOT NULL,
5    birth_date DATE NOT NULL
6);
7
8CREATE TABLE profiles (
9    user_id BIGINT PRIMARY KEY REFERENCES users(user_id),
10    display_name TEXT NOT NULL,
11    bio TEXT,
12    gender TEXT,
13    interested_in TEXT
14);
15
16CREATE TABLE swipes (
17    swiper_id BIGINT NOT NULL,
18    target_id BIGINT NOT NULL,
19    direction TEXT NOT NULL,
20    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
21    PRIMARY KEY (swiper_id, target_id)
22);
23
24CREATE TABLE matches (
25    match_id BIGSERIAL PRIMARY KEY,
26    user_a BIGINT NOT NULL,
27    user_b BIGINT NOT NULL,
28    created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
29);

This gives you durable, queryable truth for:

  • who the users are
  • what their stable profile data is
  • who swiped on whom
  • which mutual swipes became matches

Location Should Usually Be Separate

Current location is often more volatile than the rest of the profile. Users move, location updates are frequent, and nearby search must be fast.

That is why many systems keep live discovery location in a separate geospatial store or specialized index.

Common patterns include:

  • PostgreSQL with PostGIS
  • Redis geospatial indexes
  • a search service with geo filtering

A simplified location table in PostGIS style might look like:

sql
1CREATE TABLE user_locations (
2    user_id BIGINT PRIMARY KEY,
3    updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
4    location GEOGRAPHY(POINT, 4326) NOT NULL
5);

Now discovery queries can ask:

  • who is within 10 km
  • who was updated recently
  • who matches profile filters

without overloading the core profile tables.

Horizontal Scaling Usually Means Sharding by Responsibility

Horizontal scale in an app like this rarely comes from one perfect shard key that solves everything. Different parts scale differently.

A practical split is:

  • primary relational store for accounts and relationships
  • geo-indexed store for nearby discovery
  • message store for chat
  • event stream for analytics and recommendation pipelines

This lets each subsystem scale according to its own access pattern.

For example, chat traffic may explode independently of discovery traffic, and nearby search may spike by geography and time of day.

Nearby Discovery Is Not Just Distance

A real discovery query usually combines:

  • radius filter
  • recency of location update
  • profile eligibility
  • visibility rules
  • moderation and block lists

That means a good design often does a two-step process:

  1. geo system finds candidate user IDs nearby
  2. profile service or database filters those IDs by business rules

This is often easier to scale than trying to make one database answer every aspect of the query in one pass.

Match and Chat Workloads Should Not Be Coupled Too Tightly

Matches are relationship state. Chat is message history. They are related, but their database needs differ.

A match record can stay small and strongly consistent:

sql
INSERT INTO matches (user_a, user_b)
VALUES (101, 205);

Chat is append-heavy and often better modeled separately:

json
1{
2  "match_id": 9001,
3  "sender_id": 101,
4  "sent_at": "2026-03-11T12:00:00Z",
5  "body": "Hi there"
6}

That separation makes it easier to scale messaging without complicating core matching logic.

Privacy and Safety Shape the Model Too

A dating app database cannot treat location as just another coordinate column. You often need:

  • coarse visibility rather than exact position
  • expiration of old location updates
  • block lists and safety controls
  • auditable moderation events

For example, storing the latest exact location forever is usually a poor privacy decision. Many systems store:

  • a recent location for discovery
  • a generalized area for product features
  • a short retention window for raw location history

That is a data-model decision, not just a policy document.

Common Pitfalls

The biggest mistake is trying to make one database handle profiles, live geo queries, chat, and analytics with one schema and one scaling strategy. Those workloads pull in different directions.

Another issue is storing location exactly like profile data even though location is more volatile, privacy-sensitive, and query-heavy.

Teams also often couple match state and chat too tightly. Matching is relationship logic; chat is message flow. They deserve different storage thinking.

Finally, horizontal scalability is not just about adding replicas. It is about shaping the data model so each subsystem can scale independently without cross-contaminating performance.

Summary

  • A scalable dating app usually separates profile, geo, match, and chat workloads instead of forcing them into one database model.
  • Relational storage works well for canonical user and match state.
  • Live location search often belongs in a geospatially optimized store or index.
  • Nearby discovery usually works best as candidate generation plus business-rule filtering.
  • Privacy, moderation, and retention rules should shape the data model from the start, not as an afterthought.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.