DEV Community

A dating or matching app still ships its compatibility scoring in the client

Swipe apps and niche matching products often compute a "compatibility" percentage before the user even hits like. Interests, deal-breakers, distance decay, activity scores, and the mysterious boost that puts some profiles on top - if that formula runs in JavaScript, it is public.

This is not only an IP problem. It is a fairness and abuse problem. Anyone who can read the scorer can game it.

What usually ships in the feed bundle

  • Feature weights - shared hobbies, education, religion, smoking, kids, "intent" answers.
  • Hard filters - age band, distance, gender preferences, verified-only.
  • Soft boosts - recently active, high reply rate, subscription tier, "popularity" priors.
  • Decay curves - how fast distance or inactivity hurts the score.
  • Experiment flags - which users see which ranking variant.

Here is the kind of function that turns up in a minified feed chunk:

function compatibility(me, them, w) { if (them.age < me.ageMin || them.age > me.ageMax) return -Infinity; if (haversineKm(me, them) > me.maxKm) return -Infinity; let s = 0; for (const tag of me.likes) if (them.likes.includes(tag)) s += w.tag; s += w.active * recencyScore(them.lastActive); s += w.photo * them.photoQuality; if (them.isSubscriber) s += w.subBoost; if (me.dealbreakers.some((d) => them.traits.includes(d))) s -= w.dealPenalty; return s; }

Those w.* constants decide who gets seen. They also tell a scraper exactly how to build a profile that ranks.

Abuse scenarios that matter more than cloning

  • Profile optimization. Creators and agencies A/B their bios against your weights.
  • Bot farms. Bots pass every client-side filter and only fail (maybe) on the server.
  • Incel / harassment tooling. Public write-ups of ranking leaks become guides for targeting.
  • Competitor clones. A rival niche app copies your scoring overnight.

Obfuscation helps with (4) and slows down (1)-(3). It does not replace server-side ranking. If the ordered feed comes from the client sorting a big candidate array, you have already lost control.

Design the trust boundary correctly

  • The server should return an ordered candidate list (or opaque scores). The client should not re-rank the global pool with a full weight table.
  • Hard safety filters (banned users, underage checks, block lists) must be enforced server-side every time.
  • Subscription unlocks ("see who liked you") are API authorizations, not CSS.
  • Client-side previews for "edit profile → estimated reach" can use a reduced model, not the production weights.

Protecting what must stay on the device

Some matching UX is offline-first or does instant re-score when the user tweaks filters. For that reduced model:

  • Keep production weights off the client entirely; ship a distilled approximation if you need UX.
  • If you must ship real weights for a thin client, VM-obfuscate the scorer and constant table.
  • Rotate weight versions and bind them to account sessions so a dumped table goes stale.
  • Monitor for anomalous client versions or patched bundles.
  • Never put moderation classifiers that decide harassment/safety solely in the browser.

Practical checklist

  • [ ] Production feed order is computed on the server.
  • [ ] Safety and age checks are server-enforced on every request.
  • [ ] Any client "compatibility %" uses a reduced model or is clearly approximate.
  • [ ] Weight tables are not sitting as plain JSON in the bundle.
  • [ ] VM or control-flow protection covers the client scorer if it still ships.
  • [ ] Source maps for matching chunks are private.
  • [ ] Paid features are gated by API responses, not by hiding DOM nodes.
  • [ ] You have a plan for rotating leaked weights.

Honest bottom line

Obfuscation raises the cost of reading your matching brain. It does not make attraction fair, and it does not stop a determined abuser who can observe outcomes. Put authority on the server; use protection on the client for the leftover IP.

Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser playground (3 runs/day, ≤5 KB) and Pro at $9/month or $79/year. Details at vm.ldvmp.com.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.