Back to Projects
PicMe
CompletedNext.jsTypeScriptReact+11 more

PicMe

One selfie, all your photos. Attendees take a selfie at an event and instantly get every photo they are in. The selfie is turned into a face embedding on the phone and never uploaded.

Timeline

Aug 2026

Role

Full Stack Developer

Team

Solo

Status
Completed

Technology Stack

Next.js
TypeScript
React
PostgreSQL
pgvector
Drizzle ORM
better-auth
ONNX Runtime
WebAssembly
Cloudflare R2
Tailwind CSS
shadcn/ui
Neon
Vercel

Key Challenges

  • The browser and the server must produce directly comparable face embeddings: one mismatch in crop, scaling or channel order gives no matches at all
  • Uploading thousands of photos cannot block a web request
  • Finding the right photos without the selfie ever leaving the phone

Key Learnings

  • Embeddings and vector search: cosine similarity over 512-number face vectors with pgvector and an HNSW index
  • On-device inference in the browser with ONNX Runtime and WebAssembly
  • Decoupled background processing with presigned uploads and a Postgres jobs table
  • A parity test that gates everything: embed the same image on both sides and assert they agree

Overview

PicMe answers the question everyone has after an event: where are the photos of me? Organizers upload the event's photos and share a QR code. Attendees open the link, take a selfie, and get every photo they appear in.

It is a mobile-first web app, so there is nothing to install. Attendees just open a link.

How it works

  • Organizers (photographers, event teams) create an event, bulk-upload thousands of photos, and share a QR code.
  • Each photo is processed in the background. Faces are detected and each face becomes a 512-number embedding stored in a database that can search by similarity.
  • Attendees take a selfie. Their phone turns their face into the same kind of embedding, on the device, and sends only the 512 numbers.
  • The server finds the photos whose face embeddings are closest to the selfie's and shows them, ready to download.

Privacy by design

The selfie is turned into numbers in the browser, using WebAssembly. The server never sees the pixels. That is a product feature rather than a nicety, and an end-to-end test asserts it.

The one constraint everything hangs on

Matching only works if the embedding the browser produces for a face and the embedding the server produces for the same face are directly comparable: the same model weights, the same crop, the same pixel scaling, the same channel order and the same output normalization. A single mismatch does not make matching slightly worse. It produces no matches, and the failure looks exactly like "the model is bad".

So the project is arranged to make that impossible to get wrong:

  • One implementation. All preprocessing and inference lives in a single shared TypeScript package imported by both the browser and the server worker
  • One model file. The same .onnx bytes are loaded by the phone and by the worker
  • A test that gates everything. A parity test embeds the same JPEG in Node and in a headless browser and asserts they agree. Native inference on the server was only switched on after it measured 0.99998607 cosine similarity against the browser in the worst case

Stack

  • Framework: Next.js (App Router) and TypeScript in strict mode
  • UI: Tailwind CSS v4, shadcn/ui, Lucide icons
  • Auth: Better Auth with the Drizzle adapter
  • Database: Neon Postgres with pgvector (HNSW, cosine)
  • Storage: Cloudflare R2 with presigned uploads and downloads
  • Face detection: SCRFD
  • Face embedding: MobileFaceNet, 512 floats, L2-normalized
  • Inference: ONNX Runtime (WebAssembly in the browser)
  • Background work: A Vercel Function draining a Postgres jobs table on a cron
  • Bulk download: A streaming zip built in the browser, with no server CPU
  • Tests: Vitest for unit and parity tests, Playwright for end-to-end

Processing photos

Uploading 3,000 photos can't block a web request. Uploads go straight to object storage through presigned URLs, and a background worker picks each photo up from a queue, detects the faces and stores their embeddings. Organizers watch progress while it runs.