Kainguru
A Next.js prototype that turns a product's name and features into e-commerce photos across five scenes, through any image model.

Purpose
Produce e-commerce product photos from a short description — studio, lifestyle, natural setting, luxury and flat lay — without tying the product to one image provider.
The problem
Photographing a small catalogue is slow and costly, and image-generation tools tend to lock the user into one vendor's model and API. Switching models should be a configuration change, not a rewrite.
What I built
- A form-to-gallery flow: product name, category and features in; scene prompts generated from templates kept in one module; one image per selected scene out.
- Provider-independent generation through the AI SDK and Vercel AI Gateway: the model is a plain 'provider/model' string, so switching image models is one environment variable.
- A demo mode: without a gateway key the app draws deterministic SVG placeholders from the prompt, so the whole flow runs and can be tested with no API access.
- A screenshot-driven test agent in the same app: given a URL and a goal, a vision model picks one action per step and Playwright performs it, streamed live to the page; it stops to ask the user when it needs a password or a code, or before an irreversible action, and never tries to solve a CAPTCHA.
- A local variant of the agent on Apple MLX with an open GUI-agent model, and a fail-closed single-user sign-in with a signed httpOnly cookie.
Features
- A sign-in protected app that stays closed when its sign-in settings are missing.
- A product form, a choice of scenes and an image gallery.
- Demo mode without any key, with placeholders clearly labelled as demo.
- An aspect-ratio option for the images.
- A test-agent page with a switch between cloud and local mode.
- A live stream of each step with screenshot, reasoning and action.
- An in-page question box for when the agent needs you.
- A verdict for each test run.
- URL normalisation for the page under test.
- Per-step reports with screenshots, kept for a possible fine-tuning dataset later.
Stack
- Next.js
- React
- TypeScript
- Tailwind CSS
- Vercel AI Gateway
- Playwright
- Python
- GitHub Actions
AI in this project
In the product
- Image generation: five scene prompts (studio, lifestyle, nature, luxury, flat lay) are built from the product name, category and description, and one image per scene is generated in parallel through the Vercel AI Gateway. The default model is Google Imagen 4 and can be changed by a setting.
- Test agent, cloud mode: at each step a Claude model gets a screenshot, the goal and the history and returns one structured action with its reasoning, which Playwright then carries out, up to 15 steps. The agent pauses and asks you for passwords, two-factor codes, CAPTCHAs and irreversible actions.
- Test agent, local mode: a vision-language model (UI-TARS 1.5, 7B) runs on the device with Apple MLX. Its own README says it is reliable on single-step interactions and less consistent on multi-step flows.
- Without a key the image generator returns placeholders labelled as a demo, and every generation route needs a signed-in session.
In how it was built
- 3 of 4 commits carry a Claude co-author trailer.
- A 166-line rule file steers the assistant, with a "do not" list and agent-safety rules; CI runs lint, tests, a production build and a secret scan.
Key flows
Steps
Generating product photos
Step 1 of 4: Describe the product
Enter the product's name, category and key features and pick the scenes.
Step 2 of 4: Build the prompts
Each scene's template turns the description into its own prompt.
Step 3 of 4: Generate per scene
The API route sends each prompt to the configured image model through the gateway — or, in demo mode, draws a placeholder.
Step 4 of 4: Review the gallery
The images come back side by side, one per scene.
Limitations
- A single-user prototype: agent runs are kept in memory and lost on restart.
- The local agent is reliable for simple single-step interactions but less consistent than the cloud agent on multi-step scenarios.
Want something like this?
Tell me about your project — I reply within two working days.
Start a project