# zainaali/nano-banana-image-generator architecture

> Architecture diagram of the GitHub repository zainaali/nano-banana-image-generator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zainaali/nano-banana-image-generator
- Repository: https://github.com/zainaali/nano-banana-image-generator

## Overview

Real Image Generator is a React application for creating and retouching images with Gemini, paired with an Express service that compresses, stores, serves, and expires generated files. The user selects reference images, supplies a prompt, receives generated variants, and can revisit or download them from the gallery. The excerpts show generation and gallery-list loading; README documents the upload API and nightly retention. Upload wiring within the omitted component lines is not independently verified.

Main entry points: [`src/components/RealImageGenerator.jsx`](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx) (Gemini generation), [`server.js`](https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js) (Upload and listing API), [`src/App.jsx`](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/App.jsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Image workspace"]
  node_app["Application shell<br/>[App.jsx]"]
  node_generator["Generator workspace"]
end

subgraph group_generation["Generation workflow"]
  node_reference["Reference selection"]
  node_prompt["Prompt and quota"]
  node_gemini["Gemini generation"]
  node_results["Variants and downloads"]
end

subgraph group_storage["Image storage"]
  node_storage_api["Upload and listing API<br/>[server.js]"]
  node_compression["WebP compression<br/>[server.js]"]
  node_disk[("Image files<br/>[server.js]")]
  node_retention["Daily cleanup<br/>[server.js]"]
end

node_user(("User"))
node_google["Google Gemini API"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_generator
node_user -->|"selects images"| node_reference
node_user -->|"enters prompt"| node_prompt
node_reference -->|"provides images"| node_gemini
node_prompt -->|"supplies request"| node_gemini
node_gemini -->|"calls model"| node_google
node_gemini -->|"returns variants"| node_results
node_generator -->|"uploads and lists"| node_storage_api
node_storage_api -->|"compresses upload"| node_compression
node_compression -->|"writes WebP"| node_disk
node_storage_api -->|"lists and serves"| node_disk
node_retention -->|"deletes expired files"| node_disk

click node_app "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/App.jsx"
click node_generator "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx"
click node_reference "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx"
click node_prompt "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx"
click node_gemini "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx"
click node_results "https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx"
click node_storage_api "https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js"
click node_compression "https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js"
click node_disk "https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js"
click node_retention "https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js"

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_app,node_generator,node_user toneBlue
class node_reference,node_prompt,node_gemini,node_results toneAmber
class node_storage_api,node_compression,node_disk,node_retention,node_google toneMint
```

## Components

### Image workspace

- [Application shell](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/App.jsx): `src/App.jsx`
- [Generator workspace](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx): `src/components/RealImageGenerator.jsx`

### Generation workflow

- [Reference selection](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx): `src/components/RealImageGenerator.jsx`
- [Prompt and quota](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx): `src/components/RealImageGenerator.jsx`
- [Gemini generation](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx): `src/components/RealImageGenerator.jsx`
- [Variants and downloads](https://github.com/zainaali/nano-banana-image-generator/blob/main/src/components/RealImageGenerator.jsx): `src/components/RealImageGenerator.jsx`

### Image storage

- [Upload and listing API](https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js): `server.js`
- [WebP compression](https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js): `server.js`
- [Image files](https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js): `server.js`
- [Daily cleanup](https://github.com/zainaali/nano-banana-image-generator/blob/main/server.js): `server.js`

### Other components

- **User**
- **Google Gemini API**

## Connections

- User → Application shell: uses (evidence: `README.md`)
- Application shell → Generator workspace: renders (evidence: `src/App.jsx`)
- User → Reference selection: selects images (evidence: `src/components/RealImageGenerator.jsx`)
- User → Prompt and quota: enters prompt (evidence: `src/components/RealImageGenerator.jsx`)
- Reference selection → Gemini generation: provides images (evidence: `src/components/RealImageGenerator.jsx`)
- Prompt and quota → Gemini generation: supplies request (evidence: `src/components/RealImageGenerator.jsx`)
- Gemini generation → Google Gemini API: calls model (evidence: `src/components/RealImageGenerator.jsx`)
- Gemini generation → Variants and downloads: returns variants (evidence: `src/components/RealImageGenerator.jsx`)
- Generator workspace → Upload and listing API: uploads and lists (evidence: `README.md`)
- Upload and listing API → WebP compression: compresses upload (evidence: `server.js`)
- WebP compression → Image files: writes WebP (evidence: `server.js`)
- Upload and listing API → Image files: lists and serves (evidence: `server.js`)
- Daily cleanup → Image files: deletes expired files (evidence: `server.js`)
