One of the more useful internal tools I have built this year: a two-screen Retool app that replaces most of a small brand's product photography pipeline. Putting it here because the interesting part was not the UI, it was the job handling.
The screens
- Queue β a Table component over a Postgres table of garments waiting for a render, with status, SKU, attempts and the last error.
- Detail β selected row shows the flat product shot on the left, the returned on-model render on the right, plus a "regenerate with a different model" dropdown.
How the render happens
- A button triggers a REST query (resource with the API base URL and key in Retool's resource settings, so no key in the app).
- The API returns a job id immediately, so the query stores it in the row and sets status to 'running'.
- A second query polls the job endpoint every 4 seconds while the row is running. I used a JS query with a loop and a 20-iteration cap rather than a Retool "Run query on interval" toggle, because the interval version kept firing after the app tab lost focus.
- On success, the image URL is written back and status flips to 'done'. Failures retry twice, then park as 'needs attention' so nothing loops forever.
Things I would tell anyone doing this
- Never put the generation call in the same query chain as the UI's save button. It makes the app feel frozen on slow renders.
- Store the source photo in Retool Storage and pass a signed URL. Posting base64 through the resource was slow and made the request log unreadable.
- Add a per-day counter column. Without it, someone clicked regenerate 40 times on one garment and burned a month of credits in an hour.
The render endpoint is BananaKit (https://bananakit.ai/) β person photo plus garment photo, composite back. The polling shape above matches their async job API; if the API you use is synchronous, you will want a Workflow instead of a JS loop.
Happy to share the resource config if it is useful. Curious how others handle long-running jobs in Retool β polling in a JS query is fine but it is not exactly elegant.