# rasta26/chatgpt-web architecture

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

- Interactive diagram: https://gitdiagram.com/rasta26/chatgpt-web
- Repository: https://github.com/rasta26/chatgpt-web

## Overview

ChatGPT Web is a Vue chat client backed by an Express service, with selectable OpenAI API or unofficial access-token modes. The main workflow is user prompt → chat view and request client → service authorization/rate limiting → model response stream → chat state and rendered messages. The README also documents multi-session context, prompt-template import/export, image export, themes, multilingual UI, and access control. Several frontend modules and integrations are represented by their documented responsibilities; unsampled connections are omitted or marked unverified.

Main entry points: [`src/views/chat/index.vue`](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/index.vue) (Chat view), [`service/src/index.ts`](https://github.com/rasta26/chatgpt-web/blob/main/service/src/index.ts) (HTTP endpoints), [`src/App.vue`](https://github.com/rasta26/chatgpt-web/blob/main/src/App.vue) (App shell), [`src/store/modules/chat/index.ts`](https://github.com/rasta26/chatgpt-web/blob/main/src/store/modules/chat/index.ts) (Sessions and messages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat Client"]
  node_app["App shell<br/>[App.vue]"]
  node_router["Page routing<br/>[index.ts]"]
  node_permission["Route guard<br/>[permission.ts]"]
  node_chatview["Chat view<br/>[index.vue]"]
  node_chatrequest["Chat request hook<br/>[useChat.ts]"]
  node_scroll["Chat scrolling<br/>[useScroll.ts]"]
  node_context["Context toggle<br/>[useUsingContext.ts]"]
  node_messages["Message display<br/>[Text.vue]"]
  node_api["API client<br/>[index.ts]"]
  node_axios["HTTP transport<br/>[axios.ts]"]
end

subgraph group_state["Client State"]
  node_chatstore["Sessions and messages<br/>[index.ts]"]
  node_localstore[("Local persistence<br/>[index.ts]")]
end

subgraph group_service["Chat Service"]
  node_serviceentry["HTTP endpoints<br/>[index.ts]"]
  node_auth["Access control<br/>[auth.ts]"]
  node_limiter["Request limiter<br/>[limiter.ts]"]
  node_guards["Input checks<br/>[is.ts]"]
  node_models["Dual model adapter<br/>[index.ts]"]
end

subgraph group_shared["UI and Preferences"]
  node_settings["App settings UI<br/>[General.vue]"]
  node_promptstore["Prompt templates<br/>[index.vue]"]
  node_theme["Theme preference<br/>[useTheme.ts]"]
  node_language["Language preference<br/>[useLanguage.ts]"]
  node_assets["UI plugins<br/>[assets.ts]"]
end

node_user(("Chat user"))
node_openai{{"OpenAI API"}}
node_proxy{{"Unofficial proxy"}}

node_user -->|"sends prompt"| node_chatview
node_app -->|"renders routes"| node_router
node_router -->|"registers guard"| node_permission
node_user -->|"uses interface"| node_chatview
node_chatview -->|"uses request hook"| node_chatrequest
node_chatview -->|"uses scrolling"| node_scroll
node_chatview -->|"toggles context"| node_context
node_chatview -->|"calls API"| node_api
node_chatview -->|"updates sessions"| node_chatstore
node_chatview -.->|"renders messages"| node_messages
node_chatrequest -->|"reads state"| node_chatstore
node_context -->|"sets context"| node_chatstore
node_chatstore -->|"persists sessions"| node_localstore
node_settings -.->|"configures theme"| node_theme
node_app -->|"applies theme"| node_theme
node_app -->|"applies language"| node_language
node_promptstore -.->|"stores templates"| node_localstore
node_promptstore -->|"imports exports"| node_user
node_chatview -->|"exports image"| node_user
node_assets -.->|"initializes UI"| node_app
node_api -->|"uses transport"| node_axios
node_api -.->|"sends requests"| node_serviceentry
node_serviceentry -->|"applies auth"| node_auth
node_serviceentry -->|"limits chat"| node_limiter
node_serviceentry -->|"dispatches chat"| node_models
node_serviceentry -->|"checks session"| node_guards
node_models -.->|"calls API mode"| node_openai
node_models -.->|"calls token mode"| node_proxy

click node_app "https://github.com/rasta26/chatgpt-web/blob/main/src/App.vue"
click node_router "https://github.com/rasta26/chatgpt-web/blob/main/src/router/index.ts"
click node_permission "https://github.com/rasta26/chatgpt-web/blob/main/src/router/permission.ts"
click node_chatview "https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/index.vue"
click node_chatrequest "https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useChat.ts"
click node_scroll "https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useScroll.ts"
click node_context "https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useUsingContext.ts"
click node_messages "https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/components/Message/Text.vue"
click node_api "https://github.com/rasta26/chatgpt-web/blob/main/src/api/index.ts"
click node_chatstore "https://github.com/rasta26/chatgpt-web/blob/main/src/store/modules/chat/index.ts"
click node_localstore "https://github.com/rasta26/chatgpt-web/blob/main/src/utils/storage/index.ts"
click node_settings "https://github.com/rasta26/chatgpt-web/blob/main/src/components/common/Setting/General.vue"
click node_promptstore "https://github.com/rasta26/chatgpt-web/blob/main/src/components/common/PromptStore/index.vue"
click node_theme "https://github.com/rasta26/chatgpt-web/blob/main/src/hooks/useTheme.ts"
click node_language "https://github.com/rasta26/chatgpt-web/blob/main/src/hooks/useLanguage.ts"
click node_assets "https://github.com/rasta26/chatgpt-web/blob/main/src/plugins/assets.ts"
click node_axios "https://github.com/rasta26/chatgpt-web/blob/main/src/utils/request/axios.ts"
click node_serviceentry "https://github.com/rasta26/chatgpt-web/blob/main/service/src/index.ts"
click node_auth "https://github.com/rasta26/chatgpt-web/blob/main/service/src/middleware/auth.ts"
click node_limiter "https://github.com/rasta26/chatgpt-web/blob/main/service/src/middleware/limiter.ts"
click node_guards "https://github.com/rasta26/chatgpt-web/blob/main/service/src/utils/is.ts"
click node_models "https://github.com/rasta26/chatgpt-web/blob/main/service/src/chatgpt/index.ts"

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_router,node_permission,node_chatview,node_chatrequest,node_scroll,node_context,node_messages,node_api,node_axios,node_user toneBlue
class node_chatstore,node_localstore toneAmber
class node_serviceentry,node_auth,node_limiter,node_guards,node_models,node_openai toneMint
class node_settings,node_promptstore,node_theme,node_language,node_assets toneRose
class node_proxy toneIndigo
```

## Components

### Chat Client

- [App shell](https://github.com/rasta26/chatgpt-web/blob/main/src/App.vue): `src/App.vue`
- [Page routing](https://github.com/rasta26/chatgpt-web/blob/main/src/router/index.ts): `src/router/index.ts`
- [Route guard](https://github.com/rasta26/chatgpt-web/blob/main/src/router/permission.ts): `src/router/permission.ts`
- [Chat view](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/index.vue): `src/views/chat/index.vue`
- [Chat request hook](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useChat.ts): `src/views/chat/hooks/useChat.ts`
- [Chat scrolling](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useScroll.ts): `src/views/chat/hooks/useScroll.ts`
- [Context toggle](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/hooks/useUsingContext.ts): `src/views/chat/hooks/useUsingContext.ts`
- [Message display](https://github.com/rasta26/chatgpt-web/blob/main/src/views/chat/components/Message/Text.vue): `src/views/chat/components/Message/Text.vue`
- [API client](https://github.com/rasta26/chatgpt-web/blob/main/src/api/index.ts): `src/api/index.ts`
- [HTTP transport](https://github.com/rasta26/chatgpt-web/blob/main/src/utils/request/axios.ts): `src/utils/request/axios.ts`

### Client State

- [Sessions and messages](https://github.com/rasta26/chatgpt-web/blob/main/src/store/modules/chat/index.ts): `src/store/modules/chat/index.ts`
- [Local persistence](https://github.com/rasta26/chatgpt-web/blob/main/src/utils/storage/index.ts): `src/utils/storage/index.ts`

### Chat Service

- [HTTP endpoints](https://github.com/rasta26/chatgpt-web/blob/main/service/src/index.ts): `service/src/index.ts`
- [Access control](https://github.com/rasta26/chatgpt-web/blob/main/service/src/middleware/auth.ts): `service/src/middleware/auth.ts`
- [Request limiter](https://github.com/rasta26/chatgpt-web/blob/main/service/src/middleware/limiter.ts): `service/src/middleware/limiter.ts`
- [Input checks](https://github.com/rasta26/chatgpt-web/blob/main/service/src/utils/is.ts): `service/src/utils/is.ts`
- [Dual model adapter](https://github.com/rasta26/chatgpt-web/blob/main/service/src/chatgpt/index.ts): `service/src/chatgpt/index.ts`

### UI and Preferences

- [App settings UI](https://github.com/rasta26/chatgpt-web/blob/main/src/components/common/Setting/General.vue): `src/components/common/Setting/General.vue`
- [Prompt templates](https://github.com/rasta26/chatgpt-web/blob/main/src/components/common/PromptStore/index.vue): `src/components/common/PromptStore/index.vue`
- [Theme preference](https://github.com/rasta26/chatgpt-web/blob/main/src/hooks/useTheme.ts): `src/hooks/useTheme.ts`
- [Language preference](https://github.com/rasta26/chatgpt-web/blob/main/src/hooks/useLanguage.ts): `src/hooks/useLanguage.ts`
- [UI plugins](https://github.com/rasta26/chatgpt-web/blob/main/src/plugins/assets.ts): `src/plugins/assets.ts`

### Other components

- **Chat user**
- **OpenAI API**
- **Unofficial proxy**

## Connections

- Chat user → Chat view: sends prompt
- App shell → Page routing: renders routes (evidence: `src/App.vue`)
- Page routing → Route guard: registers guard (evidence: `src/router/index.ts`)
- Chat user → Chat view: uses interface (evidence: `src/views/chat/index.vue`)
- Chat view → Chat request hook: uses request hook (evidence: `src/views/chat/index.vue`)
- Chat view → Chat scrolling: uses scrolling (evidence: `src/views/chat/index.vue`)
- Chat view → Context toggle: toggles context (evidence: `src/views/chat/index.vue`)
- Chat view → API client: calls API (evidence: `src/views/chat/index.vue`)
- Chat view → Sessions and messages: updates sessions (evidence: `src/views/chat/index.vue`)
- Chat view → Message display: renders messages
- Chat request hook → Sessions and messages: reads state (evidence: `src/views/chat/hooks/useChat.ts`)
- Context toggle → Sessions and messages: sets context (evidence: `src/views/chat/hooks/useUsingContext.ts`)
- Sessions and messages → Local persistence: persists sessions (evidence: `src/store/modules/chat/index.ts`)
- App settings UI → Theme preference: configures theme
- App shell → Theme preference: applies theme (evidence: `src/App.vue`)
- App shell → Language preference: applies language (evidence: `src/App.vue`)
- Prompt templates → Local persistence: stores templates
- Prompt templates → Chat user: imports exports
- Chat view → Chat user: exports image
- UI plugins → App shell: initializes UI
- API client → HTTP transport: uses transport (evidence: `src/api/index.ts`)
- API client → HTTP endpoints: sends requests
- HTTP endpoints → Access control: applies auth (evidence: `service/src/index.ts`)
- HTTP endpoints → Request limiter: limits chat (evidence: `service/src/index.ts`)
- HTTP endpoints → Dual model adapter: dispatches chat (evidence: `service/src/index.ts`)
- HTTP endpoints → Input checks: checks session (evidence: `service/src/index.ts`)
- Dual model adapter → OpenAI API: calls API mode
- Dual model adapter → Unofficial proxy: calls token mode
