How I built an AI headshot generator in 30 seconds (FLUX + Next.js + Stripe)

Published: (February 26, 2026 at 11:33 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Overview

I had a weekend free and a simple question: how cheap and fast can I get a professional headshot delivered to someone?
The answer I landed on: 30 seconds, £4.99. Below is the architecture and flow I built to achieve this.

Tech Stack

ComponentService
Front‑end & routingNext.js 14 (App Router) deployed on Netlify
Image generationfal.ai – FLUX AI model
PaymentsStripe – one‑time Checkout (no subscriptions)
Temporary storageVercel Blob
Cost per headshot£0.04 (infrastructure only)

Workflow

  1. Upload – User uploads any clear face photo.
  2. Store temporarily – The image is saved in Vercel Blob, which returns a public URL.
  3. Select plan – User chooses either a single headshot (£4.99) or a 5‑pack (£14.99).
  4. Checkout – Redirect to Stripe Checkout.
  5. Success callback – After payment, Stripe redirects back with the photo URL and plan metadata via the success URL.
  6. Generatefal.ai (FLUX /dev model) creates the professional headshot(s) using the supplied URL and the plan’s instructions.
  7. Download – The generated image is returned instantly for the user to download.

The entire flow is stateless: no database, no user accounts, and no long‑term storage of photos beyond the generation window.

Getting Consistent Professional Results

The key to reliable headshots was adding explicit prompts:

  • Lighting – e.g., “soft, even lighting”.
  • Background colour – e.g., “plain white background”.
  • Attire context – e.g., “business casual”.
  • Use‑case anchor – e.g., “LinkedIn profile photo”.

Without these cues, the model defaults to a generic portrait.

Performance Comparison

ProviderAvg. generation time
fal.ai (FLUX /dev)8–12 s
Replicate (same model)18–25 s

fal.ai proved consistently faster, and its SDK felt cleaner to integrate.

Stripe Integration Details

  • Used dynamic price_data instead of pre‑created Stripe Price objects.
  • Keeps pricing logic in code, eliminating the need for dashboard configuration.
  • After checkout, retrieve the session by its ID to obtain the metadata (photo URL, selected plan).

Pricing & Live Demo

The service is intentionally priced lower than competitors (most charge £15–£50 for comparable quality).

Live demo:

Feel free to try it out and ask any questions in the comments.

0 views
Back to Blog

Related posts

Read more »