A user uploads a photograph of a room, picks a design style and a room type, and gets back a redesigned photograph. The image is encoded client-side and posted to a serverless function that calls a Gemini image model with a long, specific prompt: preserve camera angle, room footprint, wall, window and door positions, and the real exterior view through the windows, while replacing every finish, fixture, appliance and furnishing to match the chosen aesthetic.
Netlify ends synchronous functions at 26 seconds, so generation runs against a
fixed internal budget: most of it on gemini-2.5-flash-image, falling back to
gemini-3-pro-image-preview with what remains, with headroom left for the
credit-refund path. Credits are deducted with an optimistic-locking update guarded
on the user’s current balance, and refunded from a finally block if generation
fails.
Anonymous users get three free generations; creating an account adds ten credits. Paid tiers run through Stripe Checkout with a webhook granting credits on completion. The free path has two daily caps: one per identity, and a site-wide circuit breaker on zero-credit generations that bounds total daily model spend.
Supabase provides Postgres, magic-link auth, and row-level security.