# goekss/goai-chatlab architecture

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

- Interactive diagram: https://gitdiagram.com/goekss/goai-chatlab
- Repository: https://github.com/goekss/goai-chatlab

## Overview

GoAI ChatLab is a browser-based multimodal AI chat app. Users choose a model and system instruction, compose a message with optional documents or images, and receive an assistant reply through a server-side OpenRouter proxy; chat history is stored locally. The graph distinguishes UI, message preparation, proxying, and model inference, and includes the documented history and settings capabilities. Express and Cloudflare Worker are alternative proxy implementations. The serverless API file is present, but its implementation and wiring were not excerpted, so its relationship is left unverified.

Main entry points: [`src/App.js`](https://github.com/goekss/goai-chatlab/blob/main/src/App.js) (Chat orchestration), [`src/aiService/aiService.js`](https://github.com/goekss/goai-chatlab/blob/main/src/aiService/aiService.js) (Model selection and failover), [`src/Components/SettingsPanel/SettingsPanel.jsx`](https://github.com/goekss/goai-chatlab/blob/main/src/Components/SettingsPanel/SettingsPanel.jsx) (Chat settings), [`src/Components/InputArea/InputArea.jsx`](https://github.com/goekss/goai-chatlab/blob/main/src/Components/InputArea/InputArea.jsx) (Message composer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Chat experience"]
  node_app["Chat orchestration<br/>[App.js]"]
  node_header["Theme header<br/>[Header.jsx]"]
  node_settings["Chat settings<br/>[SettingsPanel.jsx]"]
  node_input["Message composer<br/>[InputArea.jsx]"]
  node_chatview["Conversation view<br/>[ChatBox.jsx]"]
  node_history[("Browser chat history<br/>[App.js]")]
end

subgraph group_preparation["Message preparation"]
  node_parser["Document extraction<br/>[fileParser.js]"]
  node_aiservice["Model selection and failover<br/>[aiService.js]"]
end

subgraph group_proxy["Secure proxy"]
  node_express["Express proxy<br/>[server.js]"]
  node_worker["Cloudflare proxy<br/>[worker.js]"]
  node_serverless["Serverless chat API<br/>[chat.mjs]"]
end

subgraph group_inference["Model inference"]
  node_openrouter{{"OpenRouter API"}}
end

node_user(("Chat user"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_header
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_input
node_app -->|"renders"| node_chatview
node_input -->|"submits input"| node_app
node_settings -->|"updates settings"| node_app
node_app -->|"reads and writes"| node_history
node_app -->|"extracts documents"| node_parser
node_app -->|"sends chat"| node_aiservice
node_settings -->|"loads model options"| node_aiservice
node_aiservice -.->|"posts chat"| node_express
node_aiservice -.->|"posts chat"| node_worker
node_express -->|"forwards request"| node_openrouter
node_worker -->|"forwards request"| node_openrouter
node_serverless -.->|"proxy relationship unverified"| node_openrouter

click node_app "https://github.com/goekss/goai-chatlab/blob/main/src/App.js"
click node_header "https://github.com/goekss/goai-chatlab/blob/main/src/Components/Header/Header.jsx"
click node_settings "https://github.com/goekss/goai-chatlab/blob/main/src/Components/SettingsPanel/SettingsPanel.jsx"
click node_input "https://github.com/goekss/goai-chatlab/blob/main/src/Components/InputArea/InputArea.jsx"
click node_chatview "https://github.com/goekss/goai-chatlab/blob/main/src/Components/ChatBox/ChatBox.jsx"
click node_history "https://github.com/goekss/goai-chatlab/blob/main/src/App.js"
click node_parser "https://github.com/goekss/goai-chatlab/blob/main/src/aiService/fileParser.js"
click node_aiservice "https://github.com/goekss/goai-chatlab/blob/main/src/aiService/aiService.js"
click node_express "https://github.com/goekss/goai-chatlab/blob/main/server/server.js"
click node_worker "https://github.com/goekss/goai-chatlab/blob/main/worker/worker.js"
click node_serverless "https://github.com/goekss/goai-chatlab/blob/main/api/chat.mjs"

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_header,node_settings,node_input,node_chatview,node_history,node_user toneBlue
class node_parser,node_aiservice toneAmber
class node_express,node_worker,node_serverless toneMint
class node_openrouter toneRose
```

## Components

### Chat experience

- [Chat orchestration](https://github.com/goekss/goai-chatlab/blob/main/src/App.js): `src/App.js`
- [Theme header](https://github.com/goekss/goai-chatlab/blob/main/src/Components/Header/Header.jsx): `src/Components/Header/Header.jsx`
- [Chat settings](https://github.com/goekss/goai-chatlab/blob/main/src/Components/SettingsPanel/SettingsPanel.jsx): `src/Components/SettingsPanel/SettingsPanel.jsx`
- [Message composer](https://github.com/goekss/goai-chatlab/blob/main/src/Components/InputArea/InputArea.jsx): `src/Components/InputArea/InputArea.jsx`
- [Conversation view](https://github.com/goekss/goai-chatlab/blob/main/src/Components/ChatBox/ChatBox.jsx): `src/Components/ChatBox/ChatBox.jsx`
- [Browser chat history](https://github.com/goekss/goai-chatlab/blob/main/src/App.js): `src/App.js`

### Message preparation

- [Document extraction](https://github.com/goekss/goai-chatlab/blob/main/src/aiService/fileParser.js): `src/aiService/fileParser.js`
- [Model selection and failover](https://github.com/goekss/goai-chatlab/blob/main/src/aiService/aiService.js): `src/aiService/aiService.js`

### Secure proxy

- [Express proxy](https://github.com/goekss/goai-chatlab/blob/main/server/server.js): `server/server.js`
- [Cloudflare proxy](https://github.com/goekss/goai-chatlab/blob/main/worker/worker.js): `worker/worker.js`
- [Serverless chat API](https://github.com/goekss/goai-chatlab/blob/main/api/chat.mjs): `api/chat.mjs`

### Model inference

- **OpenRouter API**

### Other components

- **Chat user**

## Connections

- Chat user → Chat orchestration: uses (evidence: `README.md`)
- Chat orchestration → Theme header: renders (evidence: `src/App.js`)
- Chat orchestration → Chat settings: renders (evidence: `src/App.js`)
- Chat orchestration → Message composer: renders (evidence: `src/App.js`)
- Chat orchestration → Conversation view: renders (evidence: `src/App.js`)
- Message composer → Chat orchestration: submits input (evidence: `src/App.js`)
- Chat settings → Chat orchestration: updates settings (evidence: `src/App.js`)
- Chat orchestration → Browser chat history: reads and writes (evidence: `src/App.js`)
- Chat orchestration → Document extraction: extracts documents (evidence: `src/App.js`)
- Chat orchestration → Model selection and failover: sends chat (evidence: `src/App.js`)
- Chat settings → Model selection and failover: loads model options (evidence: `src/Components/SettingsPanel/SettingsPanel.jsx`)
- Model selection and failover → Express proxy: posts chat (evidence: `src/aiService/aiService.js`)
- Model selection and failover → Cloudflare proxy: posts chat (evidence: `README.md`)
- Express proxy → OpenRouter API: forwards request (evidence: `server/server.js`)
- Cloudflare proxy → OpenRouter API: forwards request (evidence: `worker/worker.js`)
- Serverless chat API → OpenRouter API: proxy relationship unverified
