ChromaDish API

AI-powered food imagery and manipulation backend.

README & Overview

This backend runs an Express.js server providing programmatic access to Google's Gemini Flash AI alongside Supabase storage for long-running image generation tasks.

By default, this server hosts the API for ChromaDish on port 3005. Below is a comprehensive list of all exposed endpoints, their required payloads, and behaviors.

Endpoints

GET

/health

Returns the operational status of the API.

{ "status": "ok", "timestamp": "2026-03-05T..." }
POST

/api/generate

Submits a request to generate a single food mockup from a provided image.

Payload (multipart/form-data):

  • image: The source food photo file.
  • targetDesign: Instruction string for how to rebuild/mockup the food.
  • additionalRequirements (Optional): Extra visual constraints.
Returns: { "jobId": "..." }
GET

/api/jobs/:id

Polls the status of a specific background generation job.

Returns: { "status": "processing" | "completed" | "failed", "result_url"?: "...", "error"?: "..." }
POST

/api/batch-variants

Concurrently generates multiple styling variants off a single source image.

Payload (multipart/form-data):

  • image: The source food photo file.
  • targetDesign: Base instruction for layout/content.
  • variants: JSON array of strings defining variant conditions (e.g., ["dark mode", "lunch special"]).
Returns: { "jobId": "..." } # A master job encapsulating child variant jobs.
GET

/api/presets

Fetches standard styling presets available for menu items.

GET

/library

Serves the independent media gallery HTML interface for managing generated pictures.