DEV Community

Realbodyfat
Realbodyfat

Posted on

Body fat from one photo — analyzed once, then deleted. Here's how I built it.

I kept wanting a number between "guess in the mirror" and "book a $150 DEXA scan." Calipers need a second person and a steady hand. Smart scales swing a few points depending on how much water you drank. So I built realbodyfat.com: upload one full-body photo, get body fat %, lean mass and fat mass in about ten seconds.

The constraint that shaped the whole thing: the photo is analyzed once and discarded. No account, so there's no row to attach it to. Nothing is written to disk, and nothing is used for training. That turned out to drive most of the architecture.

The stack

  • Astro on Cloudflare Workers. The marketing pages, the free US Navy tape calculator, and ~190 programmatic pages (body-fat-by-waist, Army max-waist by height, method comparisons) are static and served from the edge. The photo scan is the only dynamic part.
  • A single React island for the scan flow — image picker, the request, the result card. The rest of the site ships zero JS.
  • Durable Objects for credit wallets. No user accounts, but people who buy a credit pack need their credits to persist. A license code maps to a Durable Object that holds the balance. It's the smallest stateful thing I could get away with, and it means there's no user table to leak.
  • A vision model behind a Worker does the estimate. The image goes straight through — Worker → model → result — and is never persisted at either end.

The honest part

It's an estimate, not a measurement, and the site says so on every page. DEXA is better and I say that too. Photo-based estimation is weakest at the extremes (very lean or very muscular bodies), and depends on photo quality. The Navy tape method — also free and unlimited on the site — lands within about 3–4 points of DEXA for typical builds if you'd rather use a tape than a camera. The move I recommend is to pick one method and track the trend over weeks, not to trust any single reading.

Pricing, because someone always asks

One free scan a day, no account. After that it's a one-time credit pack — no subscription, and credits never expire. Each scan costs me inference, so the free tier covers casual tracking and packs cover people who want more.

What I'd do differently

Going account-less made the credit system the hardest part, not the ML. If I started over I'd design the license-code → wallet flow first and build the rest around it, instead of bolting statefulness onto a deliberately stateless site.

Happy to answer anything about the edge setup, the zero-retention design, or where the estimate falls over. Try it: https://realbodyfat.com/

Top comments (0)