# ai-ad-gen

An agentic ad generator that keeps product details intact, used in production by a Pixis enterprise client.

- Client: Pixis
- Role: Creator and lead developer
- Team: Solo, then with a teammate
- Period: Apr – Jul 2026
- Stack: TypeScript, Hono, React 19, Postgres + Drizzle, Vercel AI SDK, Claude, Gemini, GPT Image 2, Langfuse, Pulumi on AWS

| Result | Baseline | Now | Change |
| --- | --- | --- | --- |
| Generated images that kept the product and its details intact, across eval batches I reviewed | – | 8 in 10 | Human-judged |
| Ads a Pixis enterprise client had generated by handover, and it kept using it after | – | 25+ | Ongoing use |
| Commits of mine, from an empty template to production | – | ~320 | Apr → Jul |

## Context

Pixis is an enterprise AI marketing platform. I was engineering lead on Pixis products from April to October 2026.

**ai-ad-gen** is a product I created there: it turns product photos and brand guidelines into finished, on-brand ads, through an agentic chat UI or a public API.

## My role

Creator and lead developer, from an empty template to a production AWS deployment with a public API, writing most of the code myself. A teammate later extended the pipeline with new ad modes and legibility checks, and I reviewed and merged that work.

## The problem

Generating an ad image is easy. Keeping the product looking like the product is hard: image models change labels, shift proportions and drop details.

Pixis needed ads that keep product details intact and consistent across every output, through an API as well as a UI.

## What I built

ai-ad-gen is a TypeScript monorepo: a Hono API, a React 19 app, a headless-browser rendering service and Pulumi infrastructure, on Postgres. Generation is a pipeline that separates creative decisions from execution.

- **Product understanding.** Photos become detail and multi-angle reference sheets, with a manifest of the micro-details the output must keep.
- **Planner → Brief → Producer.** One planner call makes every creative decision in a structured brief; the producer renders it. It's stateless, so every stage can be mocked for evaluation.
- **Generation and critique.** Claude and Gemini plan and write copy, image models including GPT Image 2 generate scenes, critic loops check the output, and the product is composited in.
- **Typography.** Ad text is HTML/CSS rendered by a self-hosted Playwright service, not drawn by the image model.
- **Public API.** A Postgres job queue, HMAC-signed webhooks with retries, and generated OpenAPI docs.
- **LLMOps and infrastructure.** Langfuse tracing, versioned prompts and LLM-as-judge evals; Pulumi on AWS (ECS Fargate, RDS, CloudFront) with GitHub Actions OIDC deploys.

## Results

- **About 8 in 10 images kept the product intact.** I judged many batches of eval output by hand; most images came out with the product and its details preserved, where generic image generators needed round after round of re-prompting.
- **In production with an enterprise client.** Pixis gave one of its enterprise clients access to ai-ad-gen, and the client had generated 25+ ads for its products with it by the time I handed it over. It kept using it after that, as an ongoing tool rather than a one-off. Pixis owned the relationship; I built the product.
- **A public generation API** with async jobs, signed webhooks and OpenAPI docs, so Pixis products and partners could call it without the UI.
- **Evaluation built in.** Langfuse traces, versioned prompts and an LLM-as-judge suite cover every stage of the pipeline.

## What I'd do differently

- **Start with the deterministic pipeline.** The first version was an agentic chat that made creative decisions as it went. The stateless pipeline came about six weeks later and is what made evaluation practical. I'd build that core first and put the chat on top.
- **Treat long generations as jobs from day one.** Streaming chat hit persistence problems, and I moved the client to polling. The public API already used a queue and webhooks; one async model for both would have saved the rework.
- **Score product fidelity directly.** The judge scored pipeline stages, while the 8-in-10 fidelity figure came from my own review of eval batches. I'd turn those human judgements into a labelled set early and calibrate an automated fidelity judge against it.

Contact: arslanjs.dev@gmail.com · https://arslanjs.dev
