# eyucoder/chatgpt-pro architecture

> Architecture diagram of the GitHub repository eyucoder/chatgpt-pro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eyucoder/chatgpt-pro
- Repository: https://github.com/eyucoder/chatgpt-pro

## Overview

ChatGPT-Pro is a browser chat UI for OpenAI text and DALL·E generation, with selectable GPT-3.5/GPT-4, conversation history in local storage, and browser-stored API-key settings. The main path is user prompt → ChatView dispatch → text or image generation → message collection/context → rendered chat. The sidebar also clears history and offers theme and key controls. Edges are limited to calls or relationships visible in excerpts and README; unsampled key validation and theme-rendering details are not inferred.

Main entry points: [`src/components/ChatView.jsx`](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/ChatView.jsx) (Prompt and dispatch), [`src/App.jsx`](https://github.com/eyucoder/chatgpt-pro/blob/main/src/App.jsx) (Application shell), [`src/components/SideBar.jsx`](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/SideBar.jsx) (Chat sidebar), [`src/context/chatContext.jsx`](https://github.com/eyucoder/chatgpt-pro/blob/main/src/context/chatContext.jsx) (Shared chat context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Chat workflow"]
  node_app["Application shell<br/>[App.jsx]"]
  node_chatview["Prompt and dispatch<br/>[ChatView.jsx]"]
end

subgraph group_generation["AI generation"]
  node_text_generation["GPT conversation chain<br/>[davinci.js]"]
  node_openai(("OpenAI API"))
  node_image_generation["DALL·E generator<br/>[dalle.js]"]
  node_key_check["Key validation<br/>[checkKeys.js]"]
end

subgraph group_state["State and preferences"]
  node_message_state["Message collection"]
  node_chat_context["Shared chat context<br/>[chatContext.jsx]"]
  node_browser_storage[("Browser local storage")]
  node_settings["API key settings<br/>[Setting.jsx]"]
  node_dark_mode["Dark mode state<br/>[useDarkMode.js]"]
  node_local_storage_hook["Preference persistence<br/>[useLocalStorage.js]"]
end

subgraph group_interface["Chat interface"]
  node_message_render["Message rendering<br/>[Message.jsx]"]
  node_markdown["Markdown display<br/>[Markdown.jsx]"]
  node_image_display["Generated image display<br/>[Image.jsx]"]
  node_thinking["Generation indicator<br/>[Thinking.jsx]"]
  node_sidebar["Chat sidebar<br/>[SideBar.jsx]"]
  node_settings_modal["Settings dialog<br/>[Modal.jsx]"]
  node_theme_toggle["Theme toggle<br/>[ToggleTheme.jsx]"]
end

node_user(("Chat user"))

node_user -->|"enters prompt"| node_chatview
node_app -->|"renders"| node_chatview
node_app -->|"renders"| node_sidebar
node_app -->|"provides context"| node_chat_context
node_chat_context -->|"uses collection"| node_message_state
node_message_state -->|"reads and writes"| node_browser_storage
node_chat_context -->|"shares messages"| node_chatview
node_chatview -->|"calls for GPT"| node_text_generation
node_chatview -->|"calls for DALL·E"| node_image_generation
node_text_generation -->|"requests completion"| node_openai
node_image_generation -.->|"requests image"| node_openai
node_chatview -->|"renders messages"| node_message_render
node_message_render -->|"renders text"| node_markdown
node_message_render -->|"renders DALL·E"| node_image_display
node_chatview -->|"shows while waiting"| node_thinking
node_sidebar -->|"clears chat"| node_chat_context
node_sidebar -->|"opens settings"| node_settings_modal
node_app -->|"renders settings"| node_settings_modal
node_settings_modal -->|"contains form"| node_settings
node_settings -->|"checks key"| node_key_check
node_settings -->|"saves key"| node_browser_storage
node_chatview -->|"opens missing-key dialog"| node_settings_modal
node_sidebar -->|"renders toggle"| node_theme_toggle
node_theme_toggle -->|"uses theme hook"| node_dark_mode
node_dark_mode -->|"persists theme"| node_local_storage_hook
node_local_storage_hook -->|"reads and writes"| node_browser_storage

click node_app "https://github.com/eyucoder/chatgpt-pro/blob/main/src/App.jsx"
click node_chatview "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/ChatView.jsx"
click node_message_state "https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useMessageCollection.js"
click node_chat_context "https://github.com/eyucoder/chatgpt-pro/blob/main/src/context/chatContext.jsx"
click node_text_generation "https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/davinci.js"
click node_image_generation "https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/dalle.js"
click node_message_render "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Message.jsx"
click node_markdown "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Markdown.jsx"
click node_image_display "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Image.jsx"
click node_thinking "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Thinking.jsx"
click node_sidebar "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/SideBar.jsx"
click node_settings_modal "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Modal.jsx"
click node_settings "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Setting.jsx"
click node_key_check "https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/checkKeys.js"
click node_theme_toggle "https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/ToggleTheme.jsx"
click node_dark_mode "https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useDarkMode.js"
click node_local_storage_hook "https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useLocalStorage.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_chatview,node_user toneBlue
class node_text_generation,node_openai,node_image_generation,node_key_check toneAmber
class node_message_state,node_chat_context,node_browser_storage,node_settings,node_dark_mode,node_local_storage_hook toneMint
class node_message_render,node_markdown,node_image_display,node_thinking,node_sidebar,node_settings_modal,node_theme_toggle toneRose
```

## Components

### Chat workflow

- [Application shell](https://github.com/eyucoder/chatgpt-pro/blob/main/src/App.jsx): `src/App.jsx`
- [Prompt and dispatch](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/ChatView.jsx): `src/components/ChatView.jsx`

### AI generation

- [GPT conversation chain](https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/davinci.js): `src/utils/davinci.js`
- **OpenAI API**
- [DALL·E generator](https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/dalle.js): `src/utils/dalle.js`
- [Key validation](https://github.com/eyucoder/chatgpt-pro/blob/main/src/utils/checkKeys.js): `src/utils/checkKeys.js`

### State and preferences

- [Message collection](https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useMessageCollection.js): `src/hooks/useMessageCollection.js`
- [Shared chat context](https://github.com/eyucoder/chatgpt-pro/blob/main/src/context/chatContext.jsx): `src/context/chatContext.jsx`
- **Browser local storage**
- [API key settings](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Setting.jsx): `src/components/Setting.jsx`
- [Dark mode state](https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useDarkMode.js): `src/hooks/useDarkMode.js`
- [Preference persistence](https://github.com/eyucoder/chatgpt-pro/blob/main/src/hooks/useLocalStorage.js): `src/hooks/useLocalStorage.js`

### Chat interface

- [Message rendering](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Message.jsx): `src/components/Message.jsx`
- [Markdown display](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Markdown.jsx): `src/components/Markdown.jsx`
- [Generated image display](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Image.jsx): `src/components/Image.jsx`
- [Generation indicator](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Thinking.jsx): `src/components/Thinking.jsx`
- [Chat sidebar](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/SideBar.jsx): `src/components/SideBar.jsx`
- [Settings dialog](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/Modal.jsx): `src/components/Modal.jsx`
- [Theme toggle](https://github.com/eyucoder/chatgpt-pro/blob/main/src/components/ToggleTheme.jsx): `src/components/ToggleTheme.jsx`

### Other components

- **Chat user**

## Connections

- Chat user → Prompt and dispatch: enters prompt (evidence: `src/components/ChatView.jsx`)
- Application shell → Prompt and dispatch: renders (evidence: `src/App.jsx`)
- Application shell → Chat sidebar: renders (evidence: `src/App.jsx`)
- Application shell → Shared chat context: provides context (evidence: `src/App.jsx`)
- Shared chat context → Message collection: uses collection (evidence: `src/context/chatContext.jsx`)
- Message collection → Browser local storage: reads and writes (evidence: `src/hooks/useMessageCollection.js`)
- Shared chat context → Prompt and dispatch: shares messages (evidence: `src/components/ChatView.jsx`)
- Prompt and dispatch → GPT conversation chain: calls for GPT (evidence: `src/components/ChatView.jsx`)
- Prompt and dispatch → DALL·E generator: calls for DALL·E (evidence: `src/components/ChatView.jsx`)
- GPT conversation chain → OpenAI API: requests completion (evidence: `src/utils/davinci.js`)
- DALL·E generator → OpenAI API: requests image (evidence: `README.md`)
- Prompt and dispatch → Message rendering: renders messages (evidence: `src/components/ChatView.jsx`)
- Message rendering → Markdown display: renders text (evidence: `src/components/Message.jsx`)
- Message rendering → Generated image display: renders DALL·E (evidence: `src/components/Message.jsx`)
- Prompt and dispatch → Generation indicator: shows while waiting (evidence: `src/components/ChatView.jsx`)
- Chat sidebar → Shared chat context: clears chat (evidence: `src/components/SideBar.jsx`)
- Chat sidebar → Settings dialog: opens settings (evidence: `src/components/SideBar.jsx`)
- Application shell → Settings dialog: renders settings (evidence: `src/App.jsx`)
- Settings dialog → API key settings: contains form (evidence: `src/App.jsx`)
- API key settings → Key validation: checks key (evidence: `src/components/Setting.jsx`)
- API key settings → Browser local storage: saves key (evidence: `src/components/Setting.jsx`)
- Prompt and dispatch → Settings dialog: opens missing-key dialog (evidence: `src/components/ChatView.jsx`)
- Chat sidebar → Theme toggle: renders toggle (evidence: `src/components/SideBar.jsx`)
- Theme toggle → Dark mode state: uses theme hook (evidence: `src/components/ToggleTheme.jsx`)
- Dark mode state → Preference persistence: persists theme (evidence: `src/hooks/useDarkMode.js`)
- Preference persistence → Browser local storage: reads and writes (evidence: `src/hooks/useLocalStorage.js`)
