Overview
Catafract uses a node-based visual interface powered by ReactFlow to create AI image generation workflows. Nodes can be connected together to form a pipeline where images flow through transformations.Node Types
Upload Node
The Upload node allows you to add images to your canvas workflow. These images can serve as inputs for AI generation nodes. Features:- Upload images from your local computer
- Automatic upload to Azure Blob Storage
- Dynamic sizing based on image aspect ratio
- Output handle to connect to other nodes
- Square (1:1) - 256x256px
- Landscape (4:3) - 341x256px
- Landscape (16:9) - 455x256px
- Landscape (2:1) - 512x256px
- Portrait (4:5) - 256x320px
- Portrait (3:4) - 256x341px
- Portrait (2:3) - 256x384px
- Portrait (9:16) - 256x455px
- Portrait (1:2) - 256x512px
- Right-click on the canvas
- Select “Upload” from the context menu
- Choose an image file from your computer
- The image will be uploaded and displayed in the node
/api/upload
Generation Node
The Generation node uses Google’s Gemini AI model to generate new images based on input images and text prompts. Features:- Text prompt input for image transformation
- Accepts multiple input images via connections
- Real-time generation status with countdown timer
- Automatic result storage in Azure Blob Storage
- Output handle to chain with more nodes
- Model:
gemini-3-pro-image-preview - Input: Requires at least one connected image node
- Prompt: Text description of desired transformation
- Right-click on the canvas
- Select “Image Generator” from the Nodes section
- Connect one or more Upload or Generation nodes to its input handle (left side)
- Type your prompt in the text area
- Press Enter to start generation
- Wait 30 seconds for the AI to generate your image
- “Make this image look like a watercolor painting”
- “Transform this into a cyberpunk style illustration”
- “Convert this photo to a sketch drawing”
- “Add dramatic sunset lighting to this scene”
/api/image
Canvas Features
Context Menus
Canvas Context Menu (Right-click on empty space):- Upload - Add a new upload node
- Nodes section with Image Generator option
- Download - Save the node’s image to your computer
- Favorite - Mark the node as a favorite (coming soon)
Node Connections
Connect nodes by clicking and dragging from one node’s output handle (right side) to another node’s input handle (left side). This creates a visual workflow where:- Upload nodes provide source images
- Generation nodes transform images based on prompts
- Multiple inputs can feed into a single generation node
Auto-Save
Your canvas state is automatically saved every second (with a 1-second debounce) to Azure Cosmos DB. This includes:- Node positions
- Node data (images, prompts, etc.)
- Edge connections
- Project metadata
Keyboard Shortcuts
- Enter - When focused on a Generation node prompt, starts image generation
- Right-click - Opens context menu
- Click + Drag - Creates connections between nodes
- Mouse wheel - Zoom in/out on canvas
- Click + Drag (empty space) - Pan the canvas
Node State Management
Nodes use React’s local state and Zustand stores for state management:- Local State: Prompt text, generation status, image dimensions
- Canvas Store: Global canvas data, nodes, edges, loading state
- Project Store: Project metadata, user information
Technical Details
Node Data Structure
Event System
Nodes communicate with the canvas using custom window events:nodeDataUpdate- Triggered when a node’s data changes (e.g., image upload)generateImage- Triggered when generation is requested
Best Practices
- Always connect at least one input before generating images
- Use descriptive prompts for better generation results
- Chain multiple generations to refine results progressively
- Download important results as the canvas is session-based
Limitations
- Generation nodes require at least one connected input image
- Generation takes approximately 30 seconds per image
- The Gemini model works best with clear, descriptive prompts
- Node canvas state is saved per project