Blog

An AI beauty score that never uploads a photo: 5 engineering decisions behind FacialRate

Since FacialRate launched, not one photo has left a visitor’s phone. The hard part is keeping that true through hundreds of changes, while the score stays trustworthy, the backend stays cheap and search can still find the product. It took five decisions, and each came after something went wrong.

FacialRate is our own product, an online AI beauty score tool. We built it with AI, we run it, and we grow it through SEO and GEO. Here we talk through the engineering decisions behind it and how we built them.

1. Put the model in the browser

The surest way to never upload a photo is to never give the server a chance to see one. Face detection and scoring run entirely in the visitor’s browser.

The first problem was not the model. It was the CDN. MediaPipe loads its model from a public CDN by default, and in development everything worked. In some regions that CDN does not load at all, and the visitor sees a spinner that never stops. A visitor whose first load fails does not give you a second.

  1. We serve the MediaPipe Face Landmarker model and its WebAssembly runtime from our own domains, with a mirror we control for regions where the main route is slow.
  2. The model is cached in the browser, so a second visit starts almost at once.
  3. The photo is checked on the device first. When head angle or expression would give an unreliable reading, the app asks for another photo.

The model returns 478 three-dimensional landmarks per face. When we compared our own photos, smiling and not smiling moved the nose and eyebrow readings together. That error is now corrected on the device, before any score exists.

So the photo stays on the device, today. After the next few hundred changes, who checks that it still does?

2. Make privacy a test that can fail

Tests do. A promise that lives only on the home page will be broken by some careless change. A promise written as a test holds on every change.

AI coding agents are fast. Adding an analytics event to a new card, or one more field to a log line, can carry face data along with it. No bad intent, just help nobody asked for. So the promise became checks:

A promise holds when a test turns red without it.

Much of this code was written by agents working overnight. How we keep them in line has its own post: AI agents coding all night, and our 5 guardrails.

3. Try to prove the score wrong before launch

Whether a scoring model works is a question for human judgment, so we tested ours against people’s ratings before we trusted it.

The first version scored faces by the classic geometric rules: symmetry, facial thirds and fifths, the golden ratio. Before launch we checked it offline against a dataset of faces rated by real people. Our geometric score and the human ratings barely related at all, and leaned slightly the wrong way. We dropped the rules that day. About 31 hours later, a machine-learning model fitted to human ratings was the only score in the product.

Any one dataset has limits: who is in it, and who rated them. It can prove a model wrong but cannot prove it right for everyone, so we cross-check on datasets from other sources and keep a record of every bias we find.

  1. Every geometric measure must be scale-invariant: the same face, nearer or farther from the camera, gives the same result.
  2. The model and calibration curves are versioned data files, one set each for women, men and everyone, generated by scripts and never edited by hand.
  3. Every change of scale ships with a database migration and new cache keys, so old scores never mix into a new ranking pool.

4. Run the backend at the edge, on a usage budget

The heavy computing happens on the visitor’s device, so the backend only does light work that caches well. There are no servers to patch and no GPU bill.

Usage is a real limit: how often the cache is written each day and how many rows each query scans both go straight into the cost. If every rank lookup queried the database, cost would climb with traffic.

  1. One edge service serves both the app’s static files and its API, with no server of our own to maintain.
  2. A scheduled background job adds new scores to the cached distribution from a watermark, and skips the write when nothing changed. Looking up a rank never touches the database.
  3. Paid reports are encrypted on the server with a versioned key and opened with a capability token. Paid content never reaches the front end, and the build scans every byte it is about to publish to make sure.
  4. Payment callbacks check age, amount and currency and are idempotent. Every endpoint has its own rate limit.

Two catches from review show why this matters. One endpoint accepted a group parameter without checking it, so outside requests could keep creating groups until the cache’s write allowance ran out; it now checks against an allow-list. And a security scanner showed that a mistyped path such as /backend/.env answered 200 with the home page, which looks like the file exists. Missing paths with a dot now return a real 404.

5. Give search one front door

Search engines and AI assistants should find one site for FacialRate, so the app stays out of the index and everything points to the main site.

When both the app and the main site could be found, they competed for the same keywords. Now the main site, www.facialrate.com, is the only entry: a static site in five languages, each page with its own title, description and structured data, an llms.txt for AI systems, and a library of guides on face shapes, proportions and taking a good photo.

Since launch, FacialRate’s visibility in search engines and AI search has grown well.

Compute on the device, check on the server, and give search one front door.

Can this be repeated?

Yes, for any product that handles sensitive data and needs to keep server costs down. Start with one question: what can run on the device instead of the server? Try FacialRate to see the result, or tell us about your product. The same approach runs through our AI engineering, infrastructure maintenance and SEO and GEO work.

Questions

Does FacialRate upload photos?

No. Face detection and scoring run in your browser. The server receives only derived data such as the score; the photo and its 478 face landmarks stay on your device.

Can a face model run in a web browser?

Yes. MediaPipe Face Landmarker runs as WebAssembly in the browser. After the first load the model is cached, so later visits start almost at once.

How is the FacialRate score calibrated?

With a machine-learning model fitted to human ratings, calibrated separately for women, men and everyone. It was tested against a public human-rated dataset before launch, and its calibration files are versioned and generated by scripts.

What kind of product suits this architecture?

Products that handle sensitive data and need low server costs: run what you can on the device, and keep the backend to light work that caches well.

More from the blog

Tell us what you are working on

A new AI product, more visibility in search and AI answers, a system that has to stay up, or a process to automate: write to us.

Contact ushi@nocboard.com