๐ฌ Generate and store Supabase images with Claude and Cloudflare Workers AI
โก 14 views ยท ๐ฌ Content Creation & Video
Description
Quick Overview
This workflow listens for new rows in a Supabase image_jobs table, uses Anthropic Claude to expand each prompt, generates an image with Cloudflare Workers AI (FLUX), uploads the image to Supabase Storage, and writes the public image URL back to the original Supabase record.
How it works
- Receives a webhook call from a Supabase Database Webhook when a new row is inserted into the
image_jobstable. - Extracts the inserted record ID and
promptvalue from the webhook payload and stops early with a JSON response if the prompt is empty. - Sends the prompt idea to Anthropic Claude to produce a single, detailed image-generation prompt.
- Calls Cloudflare Workers AI (FLUX) to generate an image from the enhanced prompt.
- Converts the returned base64 image into binary data and uploads it to a public Supabase Storage bucket using the job ID as the filename.
- Builds the public Supabase Storage URL, updates the Supabase row with
status = doneandimage_url, and returns the URL in the webhook response.
Setup
- Create the
image_jobstable in Supabase (for example by running the providednew-workflows-setup.sql) and ensure it includes fields likeprompt,status,image_url, anderror_message. - Create a Supabase Storage bucket named
generated-images(or update the bucket name in the workflow) and enable Public access so the public URL works. - Add credentials for Supabase (project URL/host and
service_rolekey), Anthropic Claude (HTTP header authx-api-key), and Cloudflare Workers AI (HTTP header authAuthorization: Bearer <token>) and replace the placeholders in the workflow. - In the Config step, set
supabaseUrlto your Supabase project URL and confirm the bucket name and Claude model value. - In Cloudflare, set your account ID in the Workers AI request URL, then create a Supabase Database Webhook for
image_jobsinserts pointing to your n8n webhook URL/webhook/generate-image.
๐ Nodes Used
HTTP Request, Webhook, Supabase
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File