Inspiration
Choosing a haircut should not feel like a guessing game.
I always found it surprisingly difficult to explain the haircut I wanted. Even phrases like:
“A little shorter, but not too short.”
can mean something completely different to the client and to the stylist.
Searching online does not solve the problem either. A hairstyle that looks great on someone else may not work with your hair density, curl pattern, hairline, face shape or styling habits.
So I built the tool I wished I had.
Hair Reality turns the question:
“What haircut would actually suit me?”
into a visual, personalised answer.
Instead of trying to imagine a haircut on someone else's face, the user can see recommended hairstyles on their own photo and take those results directly to their barber or stylist.
What it does
Hair Reality is an AI-powered hairstyle consultation tool for salons, barbershops and their clients.
The goal is simple:
help people choose a hairstyle that actually fits them and make it easier to communicate that choice to a stylist.
No app.
No account.
No complicated onboarding.
A salon can share one branded link.
The client opens it on their phone and Hair Reality guides them through the entire process.
1. Guided photo capture
The client takes four photos:
- front
- left
- right
- top of the head
But this is not just a standard camera upload.
The browser checks the user's head position in real time and automatically captures the photo only when the angle is correct.
This helps prevent one of the biggest problems with face-analysis APIs:
bad input.
Instead of allowing the user to upload any photo and hoping the API accepts it, Hair Reality guides the user before the image is even taken.
The goal is simple:
get a usable photo the first time.
2. AI hair and face analysis
The photos are analysed using the YouCam API.
I use it to detect:
- hair type
- hair density
- frizziness
- face attributes
This creates a personalised profile that becomes the foundation for the recommendation engine.
The system does not just ask:
“Which hairstyles are popular?”
It asks:
“Which hairstyles make sense for this specific person?”
3. Personalised hairstyle matching
Hair Reality scores 50 different hairstyles against the individual client.
The ranking considers factors such as:
- curl pattern
- hair density
- current hair length
- growth direction
- hairline
- face shape
- styling preferences
- how much time the client wants to spend styling their hair
Each recommendation also includes a plain-language explanation of why the hairstyle could work.
Instead of only saying:
“This style scored 91%.”
Hair Reality can explain why it matches the user's hair and face characteristics.
That matters because a recommendation is much easier to trust when the user understands the reasoning behind it.
4. See yourself in the best hairstyles
The client chooses their three favourite recommendations.
Hair Reality then generates three hairstyle try-ons directly on the client's own photo using the YouCam hairstyle generator.
The user can see:
- their original photo
- themselves with hairstyle #1
- themselves with hairstyle #2
- themselves with hairstyle #3
This is the core of the experience.
Instead of showing a barber a photo of a celebrity or a random model from Pinterest, the client can show:
their own face with the hairstyle they want.
That removes a lot of guesswork.
5. Take the result to the salon
The user can take the three generated try-on images and show them directly to their barber or stylist.
Instead of trying to explain:
“Something like this, but shorter here, maybe more volume on top, but not too much…”
they can simply show:
“This is the look I want to achieve.”
Hair Reality does not replace the barber.
It makes the conversation between the client and the barber easier.
The AI visualisation becomes a much clearer starting point than words alone.
Why salons could use it
Hair Reality can become a new digital touchpoint before the client even sits in the chair.
For clients, it means:
- more confidence before changing hairstyle
- less uncertainty
- easier decision-making
- a personalised visual reference
- a better way to communicate what they want
For stylists, it means:
- clearer client expectations
- less ambiguity
- easier consultations
- a visual starting point for the conversation
A client no longer needs to explain the haircut perfectly.
They can show it.
How I built it
I built Hair Reality with:
- TypeScript
- Node.js 24
- Express
- React
- PostgreSQL 17
- Docker Compose
- Caddy
The platform runs on my own VPS.
The React client uses prerendered shells for fast initial loading.
YouCam integration
I use the YouCam API for:
- hair type detection
- hair density detection
- hair frizziness analysis
- face attribute analysis
- hairstyle generation
All API requests run through a dedicated job queue.
Every call is recorded together with its unit usage so I can monitor and control external API costs.
This is especially important for hairstyle generation because try-ons are much more expensive than basic analysis.
Smart camera guidance
One of the biggest technical problems was photo quality.
Face-analysis APIs are extremely sensitive to camera angle.
To solve this, I integrated MediaPipe Face Landmarker directly in the browser.
Using the facial transformation matrix, Hair Reality measures:
- yaw
- pitch
in real time.
The camera only captures the image when the user's head position matches the required pose.
All of this happens on-device.
This means the user gets immediate guidance without sending unnecessary frames to the server.
OpenAI as a second intelligence layer
I also use OpenAI models as a second, independent interpretation layer.
They help:
- review hairstyle recommendations
- detect inconsistencies
- improve the ranking
- generate explanations in natural language
The hairstyle try-ons only run after a real ranking has already been produced.
I also cap usage so the cost of a consultation remains predictable.
Tests use fixtures instead of real external provider calls.
Challenges
The biggest challenge was not generating hairstyles.
It was getting reliable input.
YouCam validates head position very strictly.
Front-facing photos generally need to stay within roughly 10 degrees, while side views need to move beyond approximately 15 degrees.
Real-world smartphone photos failed surprisingly often.
The hardest image was the top-of-head photo, which is needed for hair density analysis.
To solve this, I:
- built my own guided camera
- compared accepted and rejected photos
- matched my capture limits to the angles YouCam actually accepted
- increased the capture resolution to 1080p
- made the camera fire automatically when the pose is correct
I also discovered that the API expects the left and right image slots to be swapped.
It was a small implementation detail, but one that only became obvious after real testing.
Handling AI imperfections
AI hairstyle try-ons are impressive, but they are not perfect.
Sometimes the model may slightly change:
- hair colour
- proportions
- volume
- small facial details
I do not try to hide that.
Hair Reality presents the result as what it really is:
an AI visualisation of a possible hairstyle.
The generated image is not a promise that the final haircut will look exactly the same.
It is a visual reference.
The final result still depends on the client's real hair and the stylist's work.
What I'm proud of
Hair Reality is not just a mock-up or a demo screen.
I built a working product running in production on a real phone.
The full journey already works:
- open the salon link
- take guided photos
- validate head position automatically
- analyse the client's hair
- rank hairstyles
- explain why they fit
- choose three favourites
- generate three personalised try-ons
- show the results to a stylist
The entire flow can already be tested end to end.
What I am most proud of is that the product does not stop at:
“AI can generate a hairstyle.”
It solves the whole path leading to that point:
capture → analyse → rank → explain → visualise
What I learned
The biggest lesson was simple:
better input beats smarter post-processing.
When working with face and hair analysis, photo quality and pose affect almost everything downstream.
I learned that guiding the user correctly at capture time matters more than trying to repair poor input later.
I also learned that recommendation systems feel much more trustworthy when they explain why something was recommended.
A score alone is not enough.
Saying:
“This hairstyle scored 92%.”
is far less useful than saying:
“This style works because your density supports the volume, your face shape benefits from the added height and it fits the amount of styling time you selected.”
Context matters.
What's next
The current version answers one important question:
“What could I look like in this hairstyle?”
But I think the same data can support a much bigger product.
Barber cutting instructions
One of the most interesting next steps is turning the selected hairstyle into a practical cutting guide for the barber or stylist.
Instead of only showing the final look, Hair Reality could also describe how to achieve it.
For example:
- target length on top
- target length on the sides
- fade height
- taper type
- clipper guard suggestions
- areas where volume should be preserved
- areas that should be reduced
- fringe direction
- texture recommendations
- styling technique
- suggested styling products
- notes based on hair density
- notes based on growth direction
- notes based on the client's hairline
The client would not only arrive with a picture.
They could arrive with a structured explanation of:
how the stylist could recreate that look.
That could make the gap between the AI visualisation and the real haircut much smaller.
Booking integration
Another obvious next step is booking.
A future Hair Reality flow could look like this:
- analyse your hair
- discover suitable hairstyles
- see yourself wearing them
- choose your favourite
- find a salon or barber
- book the appointment
- arrive with the selected hairstyle already saved
That would turn Hair Reality from a consultation tool into a complete journey from:
“I want a new haircut”
to:
“I know what I want and I already have an appointment.”
Salon and barber integrations
Hair Reality could also connect recommendations with real salon services.
For example, the system could recognise that a selected look may require:
- skin fade
- scissor cut
- textured crop
- long-layer haircut
- beard and haircut package
- styling consultation
- colour treatment
Instead of recommending only the hairstyle, Hair Reality could also suggest the type of service needed to achieve it.
Barber-specific recommendations
A future version could go even further.
Different barbers and salons have different specialities.
Hair Reality could eventually match the selected hairstyle with professionals who are particularly good at:
- fades
- long hair
- curly hair
- textured cuts
- modern men's styles
- classic cuts
- colour work
The system would then connect:
the right hairstyle with the right professional.
Better try-ons
I also want to improve the visual consistency of the hairstyle generation.
Some of the main areas for improvement are:
- better hair-colour preservation
- more accurate proportions
- more consistent volume
- better preservation of facial features
- more control over hairstyle parameters
The closer the try-on gets to a realistic preview, the more useful it becomes during the real salon consultation.
More languages
Haircuts are visual, but consultations are local.
Supporting more languages would make Hair Reality useful to salons in different markets without changing the core product.
The underlying analysis can remain the same while the recommendation and explanation layer adapts to the client's language.
Long-term vision
Today, Hair Reality helps answer:
“Would this hairstyle suit me?”
The next step is:
“How should my barber cut it?”
And eventually:
“Where can I book someone who can do it?”
The long-term vision is to connect the entire journey:
inspiration → analysis → recommendation → visualisation → stylist → booking → haircut
Hair Reality should make choosing a haircut feel less like guesswork and more like a real personalised consultation.
The goal is simple:
see it before you cut it.
Built With
- caddy
- docker
- esbuild
- express.js
- mediapipe
- node.js
- openai-api
- playwright
- postgresql
- react
- sharp
- typescript
- youcam-api
- zod