# hari-haran-a/genai-image-editor architecture

> Architecture diagram of the GitHub repository hari-haran-a/genai-image-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hari-haran-a/genai-image-editor
- Repository: https://github.com/hari-haran-a/genai-image-editor

## Overview

This is a browser-based AI image editor. A user selects or drops an image, enters an edit prompt, chooses a provider and credentials, and requests a generated edit; the app displays the result and manages a local session history with favorites, labels, undo/redo, and download. The React app owns these workflows and calls a service that handles Gemini generation or OpenAI image edits. The README identifies the app as an AI Studio project, but sampled evidence does not establish persistence or additional capabilities beyond the shown code.

Main entry points: [`App.tsx`](https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx) (Editor and controls), [`services/geminiService.ts`](https://github.com/hari-haran-a/genai-image-editor/blob/main/services/geminiService.ts) (Edit generation service), [`types.ts`](https://github.com/hari-haran-a/genai-image-editor/blob/main/types.ts) (Image and edit types), [`index.tsx`](https://github.com/hari-haran-a/genai-image-editor/blob/main/index.tsx) (React app entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Editor experience"]
  node_editor["Editor and controls<br/>[App.tsx]"]
  node_image_workflow["Image and prompt workflow<br/>[App.tsx]"]
  node_history["Result history<br/>[App.tsx]"]
  node_button["Button component<br/>[Button.tsx]"]
  node_mount["React app entry<br/>[index.tsx]"]
end

subgraph group_generation["Image generation"]
  node_generation_service["Edit generation service<br/>[geminiService.ts]"]
  node_gemini{{"Google Gemini API"}}
  node_openai{{"OpenAI Images API"}}
end

subgraph group_contracts["Shared contracts"]
  node_edit_types["Image and edit types<br/>[types.ts]"]
end

node_user(("Image editor user"))

node_user -->|"uses"| node_editor
node_mount -->|"mounts"| node_editor
node_editor -->|"handles"| node_image_workflow
node_editor -->|"manages"| node_history
node_editor -->|"renders"| node_button
node_editor -->|"requests edit"| node_generation_service
node_generation_service -->|"generates with"| node_gemini
node_generation_service -->|"edits with"| node_openai
node_editor -->|"uses types"| node_edit_types
node_generation_service -->|"uses provider type"| node_edit_types

click node_editor "https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx"
click node_image_workflow "https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx"
click node_history "https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx"
click node_button "https://github.com/hari-haran-a/genai-image-editor/blob/main/components/Button.tsx"
click node_generation_service "https://github.com/hari-haran-a/genai-image-editor/blob/main/services/geminiService.ts"
click node_edit_types "https://github.com/hari-haran-a/genai-image-editor/blob/main/types.ts"
click node_mount "https://github.com/hari-haran-a/genai-image-editor/blob/main/index.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_editor,node_image_workflow,node_history,node_button,node_mount,node_user toneBlue
class node_generation_service,node_gemini,node_openai toneAmber
class node_edit_types toneMint
```

## Components

### Editor experience

- [Editor and controls](https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx): `App.tsx`
- [Image and prompt workflow](https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx): `App.tsx`
- [Result history](https://github.com/hari-haran-a/genai-image-editor/blob/main/App.tsx): `App.tsx`
- [Button component](https://github.com/hari-haran-a/genai-image-editor/blob/main/components/Button.tsx): `components/Button.tsx`
- [React app entry](https://github.com/hari-haran-a/genai-image-editor/blob/main/index.tsx): `index.tsx`

### Image generation

- [Edit generation service](https://github.com/hari-haran-a/genai-image-editor/blob/main/services/geminiService.ts): `services/geminiService.ts`
- **Google Gemini API**
- **OpenAI Images API**

### Shared contracts

- [Image and edit types](https://github.com/hari-haran-a/genai-image-editor/blob/main/types.ts): `types.ts`

### Other components

- **Image editor user**

## Connections

- Image editor user → Editor and controls: uses
- React app entry → Editor and controls: mounts (evidence: `index.tsx`)
- Editor and controls → Image and prompt workflow: handles (evidence: `App.tsx`)
- Editor and controls → Result history: manages (evidence: `App.tsx`)
- Editor and controls → Button component: renders (evidence: `App.tsx`)
- Editor and controls → Edit generation service: requests edit (evidence: `App.tsx`)
- Edit generation service → Google Gemini API: generates with (evidence: `services/geminiService.ts`)
- Edit generation service → OpenAI Images API: edits with (evidence: `services/geminiService.ts`)
- Editor and controls → Image and edit types: uses types (evidence: `App.tsx`)
- Edit generation service → Image and edit types: uses provider type (evidence: `services/geminiService.ts`)
