Skip to content

About

Resources

Stars

39 stars

Watchers

0 watching

Forks

Latest commit

 

History

300 Commits

Folders and files

Repository files navigation

Audio Twin Finder

Spotify Wrapped 2026 pairs you with an anonymous Audio Twin, a listener with similar taste, and gives you no way to reach them. This site lets twins find each other: each person types in what their card shows, and when the twin does the same, they match.

Live: audiotwinapp.com · X: @AudioTwinApp · Instagram: @audiotwin_app

Story-style form mirroring the Wrapped card Playlist-style match results

Not affiliated with Spotify.

How it works

Each user submits two profiles:

  • Twin: copied from the Wrapped card (city, age, star sign, listening time, join date, and the "How you're connected" screen).
  • Me: self-reported, every field optional except the city plus 2 others.

A match is scored by comparing:

Comparison Signal
My card's connection screen vs. their card's connection screen (shared song, artist hop, genre, play count) Strongest. It's identical on both twins' cards and can't be guessed without the card
My card vs. their self-report, and their card vs. mine (age ±1, star sign, join date, listening time) Strong
Distance between the card's city and where they actually live (PostGIS, 100 km) Filter

Blank fields are skipped and never penalized. Mutual = everything agrees in both directions; otherwise it's a possible twin. Contact details unlock only after both people confirm, and only if both are 18+.

Perfect matches

The home page shows how many confirmed pairs were a perfect match, once there are at least 10. A pair is perfect when it is mutual (every field both people filled in agrees, in both directions, and both locations are in range) and both top artists match exactly. Blank fields are skipped and never count against a pair. The artist check is stricter than normal scoring on purpose: ranking forgives one mistyped artist, a perfect match doesn't.

The count is a lifetime total kept in the aggregate counters (perfect_pair_confirmed, written when a pair is confirmed), so it survives people deleting their data. Pairs confirmed before it existed can be added once with node db/backfill-perfect.mjs --before=<ISO time> (a dry run; add --apply to write). The rule lives in isPerfect in web/src/lib/match.ts.

See DESIGN.md for the original design notes.

Privacy & security

  • No accounts and no passwords. A random token lives in an httpOnly cookie, and only its SHA-256 hash is stored.
  • No email unless you ask for match emails (see below). That address is kept apart from the contact and never shown to anyone.
  • A private link (/r/<token>) restores the session on another device.
  • Values of a candidate's fields are shown only where they match yours, so nobody can fish for answers.
  • New submissions are rate-limited per IP (the IP is stored hashed).
  • Users can delete their data at any time. Cards are deleted automatically by the privacy policy they were made under (see below).
  • Screenshots are never stored, only the typed fields.

Privacy policy versions

Each card records the policy it was made under in users.policy (web/src/lib/policy.ts):

  • v1, cards made before the 5 Dec 2026 update (/privacy/v1): everything is deleted 60 days after the card was made.
  • v2, newer cards (/privacy): kept while used, deleted 24 months after the last visit or save (users.last_seen_at).

A v1 card moves to v2 only when its owner taps "Keep looking for my twin" on the matches page, which writes a keep_card row in consents. "Go back to 60 days" takes it back (and deletes the card if it's already past 60 days). The form sends the version it showed, so a page loaded before a policy change saves under the old one.

Rules for anything new built on the data:

  • Matching works across both versions: both policies cover it.
  • A v2-only use (analytics, exports, news emails, training on answers) may only touch a row if every card it refers to is v2. Read from the v2.* views in db/schema.sql, which apply that rule, with the read-only role from db/analyst-role.sql, never with the app's database user.
  • Rows shared by two cards (confirmations, pairs, dismissals) are deleted with either card, so nothing about a v1 person outlives its 60 days through someone else's history.
  • Retention runs in purgeExpired (web/src/lib/retention.ts): one indexed delete per version. Once no v1 cards are left, the v1 delete and its index can go.

Statistics views

stats.* in db/schema.sql are totals for reports, over every card under both privacy policies. Groups under 10 are left out and cards under 18 are skipped, and test/data-rules.test.ts fails if a view breaks either rule:

  • stats.funnel_daily, stats.cards_by_campaign: lifetime counters from analytics_daily (visits, cards, emails, pairs, shares).
  • stats.cards_by_policy, stats.retention_daily: cards still held, and how many came back after 1, 7 and 30 days or through a match email.
  • stats.genres_by_place, stats.artists_by_country, stats.ages_by_country: what people say about themselves ("About you"), by place.
  • stats.match_quality: twin / cousin / not-my-twin answers by how many card fields agree (exact matches, rougher than lib/match.ts).

Query them with the read-only analyst role (db/analyst-role.sql), which sees stats.* and v2.* and nothing else.

Stack

Next.js 16 (App Router, Server Actions, Cache Components) · Tailwind CSS 4 · Postgres + PostGIS · GeoNames cities1000 plus a hand-kept list of missing places for city search · Vercel + Neon

City search

The city picker runs in the browser over static JSON shards in public/cities/, written at build time by db/cities-export.mjs. It is served from the CDN, so a search never runs a function or touches the database. The shards are gitignored; run npm run db:cities locally. The Vercel build writes them too, and fails a production build if the export can't run, since a site without them has a picker that finds nothing. Search ignores accents and punctuation (db/city-key.mjs): "Zurich" finds Zürich, "St.John's" finds St. John's.

Places GeoNames leaves out (suburbs, districts) go in web/db/extra-cities.txt, one per line, and are added on the next deploy. When someone can't find their town, the picker lets them report it. List the reports with npm run db:city-reports, add the town to extra-cities.txt, then clear it with --done "Name" "Country".

Caching and cost

Match lists are cached per user in Vercel's Runtime Cache ("use cache: remote", tagged candidates:<id>), so /matches and each match page don't each re-run the PostGIS search. Someone else's new or edited card can take about ten minutes to appear. A person's own save clears their entry at once, and deleted cards are filtered out on every read. Anything that is counted and can't be undone, such as the perfect-match check, uses the uncached computeCandidates instead.

/find is static; a saved card is fetched from /api/me only for browsers that have the twin_has_card flag cookie. The matches routes keep their prefetches static (ensureStatic).

Running locally

Requires Node 20+ and Docker.

cd web
npm install
npm run db:up      # PostGIS on localhost:5433
npm run db:setup   # schema + cities (downloads GeoNames on first run)
npm run db:seed    # optional: fake listeners around Vienna
npm run db:cities  # city search shards in public/cities (the Vercel build writes them too)
npm run dev

Open http://localhost:3000. With seed data, visit http://localhost:3000/r/demo-token to log in as a demo user who already has a mutual twin.

Checks: npm run lint, npx tsc --noEmit, npm test, npm run build. Tests need the local Docker DB; they create and use a separate twin_test database (override with TEST_DATABASE_URL).

Campaigns & funnel

Give each fan account its own link:

https://www.audiotwinapp.com/?ref=<slug>

To add a fan account, add its slug (lowercase, e.g. deftones-fanpage) to CAMPAIGNS in web/src/lib/campaigns.ts and deploy. Unknown ref values are counted as other, and visits without one as direct. The ref is remembered for 30 days in a first-party cookie, set in the browser, and attached to the card when it's submitted; the server re-checks it against the allowlist then. It's never forwarded or put in share links.

Landing visits and form starts are no longer counted (each cost a function call and a write on every visit). Older rows are still in the table, but the funnel starts at cards.

To see results per campaign over the last 30 days (pass another number for a different window):

cd web
DATABASE_URL='<neon url>' npm run db:funnel -- 30   # omit DATABASE_URL for the local DB

Or paste this into the Neon SQL editor:

SELECT campaign,
  sum(count) FILTER (WHERE event = 'card_submitted') AS cards,
  sum(count) FILTER (WHERE event = 'share_native')   AS native_shares,
  sum(count) FILTER (WHERE event = 'share_copy')     AS links_copied,
  sum(count) FILTER (WHERE event = 'share_download') AS images_downloaded,
  sum(count) FILTER (WHERE event = 'pair_confirmed') AS pairs,
  sum(count) FILTER (WHERE event IN ('perfect_pair_confirmed', 'perfect_pair_backfilled')) AS perfect_pairs
FROM analytics_daily
WHERE day > current_date - 30
GROUP BY campaign ORDER BY cards DESC NULLS LAST;

These are daily aggregate counters only: no URLs, tokens, contacts, cities or answers. cards counts only new cards saved to the database. pairs counts each mutual confirmation once, and perfect_pairs the ones that were perfect matches. Share columns count share actions. A share or download doesn't prove anything was posted.

Set NEXT_PUBLIC_SITE_URL if the site moves off https://www.audiotwinapp.com. Share links always point to that origin.

Match emails

People can ask to be emailed when someone says they're their twin or audio cousin: a checkbox on the card form, or the box on the matches page. The address lives in notify_emails, apart from users.contact, and is deleted with the card.

  • /api/cron/notify runs hourly (Vercel Cron, vercel.json). It emails people with a new yes since their last email, at most one email per person per 20 hours and 3 in all, and at most EMAIL_DAILY_LIMIT (default 100) a day across everyone. Whoever has waited longest for their email goes first.
  • Nobody confirms an address when they type it in, so an unconfirmed address gets one email at most, from all the cards that use it. That email says someone entered the address, and opening its button confirms it (notify_addresses, keyed by a hash of the address). It's kept for 60 days and not deleted with the card, so deleting a card doesn't free the address for another first email.
  • One network can turn match emails on (or change the address) for at most 3 cards a day (NOTIFY_OPTIN_LIMIT). Over that, the card still saves and the page says the emails aren't on.
  • Each run first sends "we found your perfect twin" emails: for two-way perfect pairs (findPerfectPairs) that haven't met, to each side that hasn't said yes and hasn't been told about that twin (perfect_notified). Nobody's yes would ever announce these. Same limits.
  • The email says how many people are waiting and nothing about who. Its button is /r/<token> with a fresh token in the sessions table, so it signs in on any device without replacing the card's own token. /u/<token> (the same token) stops the emails; mail apps' one-click unsubscribe posts there too.
  • It does nothing until these are set in Vercel: CRON_SECRET (any long random string), RESEND_API_KEY, and EMAIL_FROM (e.g. Audio Twin <hello@your-domain>, on a domain verified in Resend). Set NEXT_PUBLIC_SITE_URL to that domain too, so the links in emails match it.
  • node db/send-test-email.mjs you@example.com sends one sample email (needs RESEND_API_KEY and EMAIL_FROM in the environment) to check delivery and looks, without touching the database. Its links are placeholders.

Problem reports

Users report problems at /report (linked in the footer and on the error page, which passes along the page and error reference). Reports are private: they go to the reports table, never to GitHub, because a matching problem usually needs someone's card to explain. A report can carry an optional reply email and, if the person ticks the box, a link to their card. Reports are deleted after 60 days.

Read them with npm run db:reports and remove one once it's handled with --done <id>. Don't copy anything personal from a report into a public issue.

People who prefer GitHub can open a public issue from the same page. Blank issues are off: the bug and "matching looks wrong" forms in .github/ISSUE_TEMPLATE/ warn against posting cards or contacts, and point to the private form.

Deploying

Import the repo in Vercel with Root Directory set to web, and add a Neon database from the Vercel Storage tab. The vercel-build script creates the schema, loads cities, and writes the city search shards on every deploy. It's idempotent, so it's safe to rerun. Preview deployments use the same database as production unless you give them their own.

Project layout

web/
  db/            schema.sql, setup (idempotent), seed (dev), cities-export (search shards),
                 extra-cities.txt, city-reports, funnel, backfill-perfect
  src/app/       pages: landing, /find, /matches, /matches/[id], /r/[token], /how-it-works,
                 /privacy, /terms, /api/submit, /api/me, /api/city-report
  src/lib/       match.ts (scoring, isPerfect), data.ts (queries, session, rate limit, caching),
                 pairs.ts (confirmations), submit.ts, cities.ts (browser search), analytics.ts
  src/components/
  test/          vitest; most need the local Docker DB
docker-compose.yml   local PostGIS

Contributors

Built and run by Saba Momtselidze, with help from:

  • Brandon Ferrell (@bferrell16): kept the site up under the launch traffic (outage handling, rate limits, caching), plus SEO and match-email fixes
  • Miguel López Cobo (@NerokArtworks): mobile UX polish on the find form, and a confirmation step before deleting your data
  • shtorin (@shtorin): filling in the twin card from Wrapped screenshots, read on your device, plus llms.txt so AI assistants can describe the site
  • Jacob Paris (@jacobparis): fast, cheap city search served from static files

Supporting the project

The site is free and has no ads. If you'd like to chip in: GitHub Sponsors, Ko-fi or PayPal.

Contributing

PRs welcome. Open an issue first for anything bigger than a small fix, so we can agree on the approach.

  1. Fork, branch off main, and follow Running locally.
  2. Before opening the PR, run npm run lint, npx tsc --noEmit, npm test and npm run build in web/.
  3. Keep it privacy-first: no new personal data, trackers or third-party scripts without discussing it in an issue and updating the privacy policy.
  4. Sign the Contributor License Agreement. A bot asks you on your first PR: reply with the sentence it gives you. You keep the copyright to your work; the agreement lets the project keep using it if it ever changes license or moves into a company.

Found a security problem? Don't open a public issue. Use GitHub's private vulnerability reporting on the repo instead.

License

MIT. City data from GeoNames is licensed under CC BY 4.0.

About

Resources

Stars

39 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages