# bariskisir/aichat architecture

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

- Interactive diagram: https://gitdiagram.com/bariskisir/aichat
- Repository: https://github.com/bariskisir/aichat

## Overview

AI Chat is an Electron desktop client for OpenAI-compatible APIs, ChatGPT, and Claude Web. The main workflow is selecting or creating a conversation, composing a request, streaming a provider response into the chat workspace, and retaining conversation data locally. Settings, provider authentication/model management, attachments, web search, rich Markdown rendering, and desktop updates are additional product capabilities. The graph follows documented IPC and service ownership; sampled excerpts do not expose every renderer action or provider protocol detail, so uncertain links are omitted.

Main entry points: [`src/main/ipc/ipc.service.ts`](https://github.com/bariskisir/aichat/blob/master/src/main/ipc/ipc.service.ts) (IPC service), [`src/main/chat/chat.service.ts`](https://github.com/bariskisir/aichat/blob/master/src/main/chat/chat.service.ts) (Chat service), [`src/main/index.ts`](https://github.com/bariskisir/aichat/blob/master/src/main/index.ts) (Main lifecycle), [`src/renderer/src/App.tsx`](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/App.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_main["Main lifecycle<br/>[index.ts]"]
  node_window["Window service<br/>[window.service.ts]"]
  node_preload["Preload bridge<br/>[index.ts]"]
  node_ipc["IPC service<br/>[ipc.service.ts]"]
end

subgraph group_chat["Chat experience"]
  node_app["App shell<br/>[App.tsx]"]
  node_workspace["Chat workspace<br/>[ChatWorkspace.tsx]"]
  node_sidebar["Conversation sidebar"]
  node_markdown["Markdown rendering"]
  node_chatservice["Chat service<br/>[chat.service.ts]"]
end

subgraph group_providers["Provider access"]
  node_providersettings["Provider settings"]
  node_registry["Provider registry"]
  node_families["Provider families<br/>[index.ts]"]
  node_providerapis(("Provider APIs"))
end

subgraph group_state["Local state"]
  node_storage[("Conversation storage<br/>[storage.service.ts]")]
  node_attachments["Attachment service"]
  node_settings["Settings page<br/>[SettingsPage.tsx]"]
end

subgraph group_capabilities["Desktop features"]
  node_search["Web search"]
  node_searchwindow["Search window"]
  node_updates["Update service<br/>[app.updater.ts]"]
  node_github(("GitHub releases"))
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_workspace
node_app -->|"renders"| node_settings
node_workspace -->|"shows conversations"| node_sidebar
node_workspace -->|"renders messages"| node_markdown
node_app -->|"requests desktop actions"| node_preload
node_preload -->|"invokes channels"| node_ipc
node_main -->|"creates window"| node_window
node_main -->|"initializes providers"| node_registry
node_main -->|"composes"| node_chatservice
node_main -->|"registers handlers"| node_ipc
node_ipc -->|"loads and saves"| node_storage
node_ipc -->|"manages providers"| node_registry
node_ipc -->|"starts chat"| node_chatservice
node_chatservice -->|"resolves provider"| node_registry
node_registry -->|"dispatches provider"| node_families
node_chatservice -->|"sends requests"| node_providerapis
node_providerapis -->|"streams responses"| node_chatservice
node_chatservice -->|"persists conversations"| node_storage
node_ipc -->|"handles attachment actions"| node_attachments
node_providersettings -->|"requests provider actions"| node_preload
node_settings -->|"requests settings actions"| node_preload
node_search -->|"extracts search results"| node_searchwindow
node_chatservice -.->|"requests web search"| node_search
node_ipc -->|"checks and installs"| node_updates
node_updates -->|"checks releases"| node_github
node_github -->|"provides release data"| node_updates

click node_main "https://github.com/bariskisir/aichat/blob/master/src/main/index.ts"
click node_window "https://github.com/bariskisir/aichat/blob/master/src/main/window/window.service.ts"
click node_preload "https://github.com/bariskisir/aichat/blob/master/src/preload/index.ts"
click node_ipc "https://github.com/bariskisir/aichat/blob/master/src/main/ipc/ipc.service.ts"
click node_app "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/App.tsx"
click node_workspace "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/chat/ChatWorkspace.tsx"
click node_sidebar "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/sidebar/ConversationsSidebar.tsx"
click node_markdown "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/chat/markdown/markdownComponents.tsx"
click node_providersettings "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/pages/settings/sections/ProviderSettingsSection.tsx"
click node_registry "https://github.com/bariskisir/aichat/blob/master/src/main/providers/provider.registry.ts"
click node_families "https://github.com/bariskisir/aichat/blob/master/src/main/providers/index.ts"
click node_chatservice "https://github.com/bariskisir/aichat/blob/master/src/main/chat/chat.service.ts"
click node_storage "https://github.com/bariskisir/aichat/blob/master/src/main/persistence/storage.service.ts"
click node_attachments "https://github.com/bariskisir/aichat/blob/master/src/main/attachments/attachment.service.ts"
click node_settings "https://github.com/bariskisir/aichat/blob/master/src/renderer/src/pages/settings/SettingsPage.tsx"
click node_search "https://github.com/bariskisir/aichat/blob/master/src/main/search/web.search.service.ts"
click node_searchwindow "https://github.com/bariskisir/aichat/blob/master/src/main/search/hidden.window.service.ts"
click node_updates "https://github.com/bariskisir/aichat/blob/master/src/main/updates/app.updater.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_main,node_window,node_preload,node_ipc,node_user toneBlue
class node_app,node_workspace,node_sidebar,node_markdown,node_chatservice toneAmber
class node_providersettings,node_registry,node_families,node_providerapis toneMint
class node_storage,node_attachments,node_settings toneRose
class node_search,node_searchwindow,node_updates,node_github toneIndigo
```

## Components

### Desktop runtime

- [Main lifecycle](https://github.com/bariskisir/aichat/blob/master/src/main/index.ts): `src/main/index.ts`
- [Window service](https://github.com/bariskisir/aichat/blob/master/src/main/window/window.service.ts): `src/main/window/window.service.ts`
- [Preload bridge](https://github.com/bariskisir/aichat/blob/master/src/preload/index.ts): `src/preload/index.ts`
- [IPC service](https://github.com/bariskisir/aichat/blob/master/src/main/ipc/ipc.service.ts): `src/main/ipc/ipc.service.ts`

### Chat experience

- [App shell](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Chat workspace](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/chat/ChatWorkspace.tsx): `src/renderer/src/components/chat/ChatWorkspace.tsx`
- [Conversation sidebar](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/sidebar/ConversationsSidebar.tsx): `src/renderer/src/components/sidebar/ConversationsSidebar.tsx`
- [Markdown rendering](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/components/chat/markdown/markdownComponents.tsx): `src/renderer/src/components/chat/markdown/markdownComponents.tsx`
- [Chat service](https://github.com/bariskisir/aichat/blob/master/src/main/chat/chat.service.ts): `src/main/chat/chat.service.ts`

### Provider access

- [Provider settings](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/pages/settings/sections/ProviderSettingsSection.tsx): `src/renderer/src/pages/settings/sections/ProviderSettingsSection.tsx`
- [Provider registry](https://github.com/bariskisir/aichat/blob/master/src/main/providers/provider.registry.ts): `src/main/providers/provider.registry.ts`
- [Provider families](https://github.com/bariskisir/aichat/blob/master/src/main/providers/index.ts): `src/main/providers/index.ts`
- **Provider APIs**

### Local state

- [Conversation storage](https://github.com/bariskisir/aichat/blob/master/src/main/persistence/storage.service.ts): `src/main/persistence/storage.service.ts`
- [Attachment service](https://github.com/bariskisir/aichat/blob/master/src/main/attachments/attachment.service.ts): `src/main/attachments/attachment.service.ts`
- [Settings page](https://github.com/bariskisir/aichat/blob/master/src/renderer/src/pages/settings/SettingsPage.tsx): `src/renderer/src/pages/settings/SettingsPage.tsx`

### Desktop features

- [Web search](https://github.com/bariskisir/aichat/blob/master/src/main/search/web.search.service.ts): `src/main/search/web.search.service.ts`
- [Search window](https://github.com/bariskisir/aichat/blob/master/src/main/search/hidden.window.service.ts): `src/main/search/hidden.window.service.ts`
- [Update service](https://github.com/bariskisir/aichat/blob/master/src/main/updates/app.updater.ts): `src/main/updates/app.updater.ts`
- **GitHub releases**

### Other components

- **User**

## Connections

- User → App shell: uses
- App shell → Chat workspace: renders
- App shell → Settings page: renders
- Chat workspace → Conversation sidebar: shows conversations
- Chat workspace → Markdown rendering: renders messages
- App shell → Preload bridge: requests desktop actions
- Preload bridge → IPC service: invokes channels
- Main lifecycle → Window service: creates window
- Main lifecycle → Provider registry: initializes providers
- Main lifecycle → Chat service: composes
- Main lifecycle → IPC service: registers handlers
- IPC service → Conversation storage: loads and saves
- IPC service → Provider registry: manages providers
- IPC service → Chat service: starts chat
- Chat service → Provider registry: resolves provider
- Provider registry → Provider families: dispatches provider
- Chat service → Provider APIs: sends requests
- Provider APIs → Chat service: streams responses
- Chat service → Conversation storage: persists conversations
- IPC service → Attachment service: handles attachment actions
- Provider settings → Preload bridge: requests provider actions
- Settings page → Preload bridge: requests settings actions
- Web search → Search window: extracts search results
- Chat service → Web search: requests web search
- IPC service → Update service: checks and installs
- Update service → GitHub releases: checks releases
- GitHub releases → Update service: provides release data
