All Success StoriesHealth Tech & AI Diagnostics

Building an AI Scalp & Hair-Health Analysis Platform

Client: Confidential Client · Industry: Health Tech & AI Diagnostics

  • AI Diagnostics
  • Computer Vision
  • Health Tech
  • Next.js
  • Firebase
  • Multimodal LLM
  • Face Mesh
  • Prompt Engineering
01The Idea

A clinical-style read from a few phone photos

Hair loss is one of those things people research obsessively but rarely act on — mostly because the first real step, a clinical consultation, feels like a big, expensive commitment just to find out “how bad is it, actually?” We set out to remove that barrier entirely: open the site, take a few guided photos, and get a clinical-style read in under a minute. No sign-up, no waiting room.

The product captures a short set of face and scalp photos, runs them through a multimodal AI vision pipeline, and returns a Norwood-scale classification, a dermatological (“trichoscopy”) read of the scalp, an estimated graft count and cost range, and a ranked list of nearby clinics — all in a tabbed report that can be saved, downloaded as a PDF, or shared with a link. It's a Next.js app on Firebase, with a real-time face-mesh model running client-side for capture guidance and a hosted multimodal LLM doing the clinical reasoning server-side.

02Product Walkthrough

From landing to a saved report

Landing Page
01

Landing Page

Sells the promise in one screen — a clinical-grade result from just a camera, in ~30 seconds, photos never stored on a server. Three CTAs cover the three ways people arrive: ready to act, cautious but willing, or just researching.

02

Guided Photo Capture

Closer to a face-ID unlock than a photo booth: a live face-mesh model checks the pose against an on-screen guide and fires the shutter after two seconds of stillness — no button. Scalp close-ups invert the logic and wait until no face is detected.

Guided Photo Capture
Analysis in Progress
03

Analysis in Progress

The pipeline chains a face-landmark pass, several AI classification calls, and clinical calculations. Progress is modeled honestly — real pre-flight steps complete visibly, then the bar advances on an estimate that only moves forward and stalls short of 100% until the real response lands.

04

Results Dashboard

A stage classification with a confidence score front and center, a four-stat summary (graft count, golden-ratio deviation, symmetry, recovery estimate), a cost comparison across geographies, and AI-generated suggestions personalized to the user's stage and intake answers.

Results Dashboard
Trichoscopy — the Dermatological Read
05

Trichoscopy — the Dermatological Read

For users who provide a scalp close-up, a deeper AI pass produces a clinical-style trichoscopy report: density and diameter-variation measurements, follicular/vascular findings, and a primary diagnostic impression with differentials. Gated behind a free account.

06

Hairline Design

For anyone weighing a transplant, the product renders a proposed hairline — distance from the glabella, temporal angle, transition-zone width — computed against measured facial geometry and Rule-of-Thirds / golden-ratio conventions.

Hairline Design
Clinic Directory
07

Clinic Directory

A searchable, sortable directory ranks clinics by proximity, surfacing specialties, price tier, estimated per-graft cost, and direct call/website actions — turning “I now know my situation” into “here's who to call.”

08

Optional Health Intake

A skippable questionnaire — family history, hair-care habits, lifestyle, medical background — feeds directly into the personalization layer: the care-tips generator and AI suggestion cards read from these answers when available.

Optional Health Intake
03Under the Hood

Next.js, Firebase, and a multimodal LLM

Frontend: Next.js (App Router) + TypeScript + Tailwind, Zustand for client state, and a real-time face-mesh model running entirely in-browser for capture guidance.

Backend: Firebase Auth plus a non-default named Firestore database for accounts and saved reports, with serverless API routes for the AI pipeline, PDF generation, and clinic/location lookups.

AI layer: a hosted multimodal LLM handles both the Norwood classification and the trichoscopy read, driven by heavily engineered prompts rather than a fine-tuned model — the entire clinical behavior lives in prompt design, output validation, and a chain of fallback models.

Next.jsTypeScriptTailwindZustandFirebase (Auth + Firestore)Multimodal LLMIn-browser Face MeshPDF generation
04Engineering Challenges

Ten problems, and how we solved them

01
A deterministic clinical classifier

Rewrote the prompt as an explicit decision tree with hard per-stage criteria, a default to least-severe absent evidence, and a numeric confidence rubric — then validated required clinical fields separately from “valid JSON.”

02
A model that was over-cautious

Trichoscopy returned near-zero confidence on legible photos. We added an override: if any scalp/hair is visible, confidence must be ≥3–4/10, with uncertainty expressed via differentials — plus a worked density-counting method.

03
Fallible external AI dependencies

Every AI capability has a primary model plus an ordered fallback chain, swappable via env vars. A 404 skips to the next candidate; a 429 backs off. Best-effort steps degrade gracefully instead of 500-ing.

04
Auto-capture without a shutter button

A live face-landmark model checks three signals per frame — face inside the guide, head rotation matching the requested angle, and two continuous seconds of stillness — before firing. Scalp shots invert the face check.

05
A constraint that only bites on real data

Firestore can't store an array-of-arrays — exactly the density-heatmap shape. A recursive sanitizer now strips those fields (and raw photo data) before every write.

06
localStorage quota exhaustion

Persisted history with base64 payloads silently hit the browser quota. The fix: exclude the heaviest fields from serialization, cap history by age and count, and retry against a smaller set on quota errors.

07
An honest progress bar

Modeled as two phases — real, fast pre-flight steps at their true pace, then an estimate-driven phase that only moves forward and stalls short of 100% until the response lands. Never frozen, never lying.

08
Public sharing on an owner-only model

Rather than loosening strict security rules (how health data goes world-readable), a narrow server endpoint with elevated credentials handles the one legitimate public-read case for share links.

09
Two measurement systems

A fast in-browser landmark model and a holistic server-side vision model don't fully agree yet. We shipped explicit about which figures come from which, and kept the landmark model independently testable — reconciliation is scheduled follow-up.

10
Duplicated ranking logic

“Rank clinics by distance” was implemented three times across screens. Flagged as tech debt and the textbook case for extracting shared domain logic the moment a second call site appears.

05From Ambition to Shipped

What shipped, and what we descoped

Internal planning showed a considerably bigger original vision than what shipped first — a useful before/after for anyone building something similar.

Shipped: guided multi-angle capture, Norwood classification, trichoscopy-style analysis, graft/cost estimation, a branded PDF, a public share link, accounts with saved history and trend charts, a clinic directory, and an education library. Deliberately descoped for v1: a community feed, a “simulate my results” editor, in-app booking, a paid tier, a packaged mobile app, and A/B instrumentation.

🧭

A full cross-browser QA pass, a formal performance audit, and deployment docs remain explicitly unfinished internally, despite the product already running live — a realistic state for a fast-moving first release, not a hidden one.

Ready to Be Our Next Success Story?

Let's turn your challenge into your next success story.