Build reliable batch image processing with Supabase Edge functions and a jobs system. Learn how to run long background tasks, track progress in a jobs table, and update the front end with AI-renamed photos—even when work exceeds the 1.2-minute connection limit. Clear flow, real-time status, and practical UI tips included.
Why use Supabase Edge functions and jobs for batch processing?
Edge functions let you run server code with secrets and call APIs like OpenAI. They already power a photo renaming app that uploads, renames in the cloud, and sends results to the front end. The challenge is the connection limit: about 1.2 minutes. For many images or larger workloads, a background job system keeps work going while you inform users.
What is an Edge function?
- An Edge function is server-side code that can call services like OpenAI.
- It returns data safely to the front end.
- It uses server secrets to access APIs.
How does a jobs table track status and progress?
How to implement batch AI analysis with Supabase?
The plan starts with data, adds a background function, and finishes with a UI that kicks off and tracks work. It evolves the existing photo renaming app with AI-powered batch features.
Which steps enable batch image processing?
- Create a jobs table to store status, progress counts, and inputs.
- Build an Edge function named batch AI analysis to process multiple photos.
- Update the job in real time and expose the job ID to the front end.
- Add management and status helper functions to simplify updates.
- Extend the UI with a batch analyze action for selected photos.
- Show progress on photo cards and allow users to start analysis easily.
How does the AI rename flow work?
What challenges and UI improvements were noted?
There was an initial error when testing batch rename. It was fixed and a richer UI appeared with rename options and previews. However, AI renaming was missing at first; after a reminder, the system added AI batch rename. The job then started with a visible job ID and processed images in the background.
Which fixes and improvements matter most?
- Fix early errors by reading messages and iterating quickly.
- Keep AI features aligned with the original goal: AI-driven batch rename.
- In Supabase, observe the job with status, totals, and processed counts.
- Push final results back to the front end to update names.
- Future UI ideas.
- Show progress bars and remaining items.
- Display current phase: pending, processing, completed, or error.
- Provide clearer feedback per photo card during processing.
Have ideas to enhance the jobs table, progress UI, or the AI rename flow? Share your questions and suggestions below.