# exalex/ciphertalk architecture

> Architecture diagram of the GitHub repository exalex/ciphertalk, 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/exalex/ciphertalk
- Repository: https://github.com/exalex/ciphertalk

## Overview

CipherTalk is an Electron desktop application for viewing, searching, analyzing, and exporting WeChat chat history, with AI summaries and an MCP interface for agent clients. The main workflow is user → chat interface → Electron data services → rendered messages; separate branches support analytics, export, AI, and MCP access. The sampled excerpts confirm several service implementations and frontend calls, but do not expose the full IPC dispatch or all page-to-service wiring; those links are omitted or marked unverified.

Main entry points: [`electron/services/mcp/readService.ts`](https://github.com/exalex/ciphertalk/blob/main/electron/services/mcp/readService.ts) (MCP data tools), [`electron/services/ai/aiService.ts`](https://github.com/exalex/ciphertalk/blob/main/electron/services/ai/aiService.ts) (AI summary service), [`electron/services/chatService.ts`](https://github.com/exalex/ciphertalk/blob/main/electron/services/chatService.ts) (Chat history service), [`src/App.tsx`](https://github.com/exalex/ciphertalk/blob/main/src/App.tsx) (App routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Desktop interface"]
  node_app["App routing<br/>[App.tsx]"]
  node_chatui["Chat and search<br/>[ChatPage.tsx]"]
  node_configui["Settings and AI options<br/>[SettingsPage.tsx]"]
  node_ipc["Frontend IPC services<br/>[ipc.ts]"]
end

subgraph group_data["Chat data"]
  node_chat["Chat history service<br/>[chatService.ts]"]
  node_db[("Chat database<br/>[wcdbService.ts]")]
  node_config[("Application configuration<br/>[config.ts]")]
end

subgraph group_insights["Analysis and export"]
  node_analytics["Chat analytics"]
  node_groupanalytics["Group analytics"]
  node_annual["Annual reports"]
  node_export["Chat export<br/>[exportService.ts]"]
end

subgraph group_ai["AI summaries"]
  node_ai["AI summary service<br/>[aiService.ts]"]
  node_aiproviders["AI provider integrations"]
  node_aidb[("AI history database<br/>[aiDatabase.ts]")]
end

subgraph group_mcp["MCP access"]
  node_mcpserver["MCP server<br/>[server.ts]"]
  node_mcpread["MCP data tools<br/>[readService.ts]"]
end

node_user(("CipherTalk user"))
node_mcpclient(("MCP host"))

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_chatui
node_chatui -.->|"requests data"| node_ipc
node_ipc -.->|"dispatches requests"| node_chat
node_chat -.->|"reads chat data"| node_db
node_user -->|"views insights"| node_analytics
node_user -->|"views group insights"| node_groupanalytics
node_user -.->|"views reports"| node_annual
node_user -->|"exports history"| node_export
node_user -->|"requests summary"| node_ai
node_ai -->|"selects provider"| node_aiproviders
node_ai -->|"stores history"| node_aidb
node_configui -.->|"configures options"| node_config
node_mcpclient -->|"starts server"| node_mcpserver
node_mcpserver -->|"registers tools"| node_mcpread
node_mcpread -->|"reads conversations"| node_chat
node_mcpread -->|"requests statistics"| node_analytics
node_mcpread -->|"requests exports"| node_export

click node_app "https://github.com/exalex/ciphertalk/blob/main/src/App.tsx"
click node_chatui "https://github.com/exalex/ciphertalk/blob/main/src/pages/ChatPage.tsx"
click node_configui "https://github.com/exalex/ciphertalk/blob/main/src/pages/SettingsPage.tsx"
click node_ipc "https://github.com/exalex/ciphertalk/blob/main/src/services/ipc.ts"
click node_chat "https://github.com/exalex/ciphertalk/blob/main/electron/services/chatService.ts"
click node_db "https://github.com/exalex/ciphertalk/blob/main/electron/services/wcdbService.ts"
click node_config "https://github.com/exalex/ciphertalk/blob/main/electron/services/config.ts"
click node_analytics "https://github.com/exalex/ciphertalk/blob/main/electron/services/analyticsService.ts"
click node_groupanalytics "https://github.com/exalex/ciphertalk/blob/main/electron/services/groupAnalyticsService.ts"
click node_annual "https://github.com/exalex/ciphertalk/blob/main/electron/services/annualReportService.ts"
click node_export "https://github.com/exalex/ciphertalk/blob/main/electron/services/exportService.ts"
click node_ai "https://github.com/exalex/ciphertalk/blob/main/electron/services/ai/aiService.ts"
click node_aiproviders "https://github.com/exalex/ciphertalk/tree/main/electron/services/ai/providers"
click node_aidb "https://github.com/exalex/ciphertalk/blob/main/electron/services/ai/aiDatabase.ts"
click node_mcpserver "https://github.com/exalex/ciphertalk/blob/main/electron/services/mcp/server.ts"
click node_mcpread "https://github.com/exalex/ciphertalk/blob/main/electron/services/mcp/readService.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_chatui,node_configui,node_ipc,node_user toneBlue
class node_chat,node_db,node_config toneAmber
class node_analytics,node_groupanalytics,node_annual,node_export toneMint
class node_ai,node_aiproviders,node_aidb toneRose
class node_mcpserver,node_mcpread,node_mcpclient toneIndigo
```

## Components

### Desktop interface

- [App routing](https://github.com/exalex/ciphertalk/blob/main/src/App.tsx): `src/App.tsx`
- [Chat and search](https://github.com/exalex/ciphertalk/blob/main/src/pages/ChatPage.tsx): `src/pages/ChatPage.tsx`
- [Settings and AI options](https://github.com/exalex/ciphertalk/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`
- [Frontend IPC services](https://github.com/exalex/ciphertalk/blob/main/src/services/ipc.ts): `src/services/ipc.ts`

### Chat data

- [Chat history service](https://github.com/exalex/ciphertalk/blob/main/electron/services/chatService.ts): `electron/services/chatService.ts`
- [Chat database](https://github.com/exalex/ciphertalk/blob/main/electron/services/wcdbService.ts): `electron/services/wcdbService.ts`
- [Application configuration](https://github.com/exalex/ciphertalk/blob/main/electron/services/config.ts): `electron/services/config.ts`

### Analysis and export

- [Chat analytics](https://github.com/exalex/ciphertalk/blob/main/electron/services/analyticsService.ts): `electron/services/analyticsService.ts`
- [Group analytics](https://github.com/exalex/ciphertalk/blob/main/electron/services/groupAnalyticsService.ts): `electron/services/groupAnalyticsService.ts`
- [Annual reports](https://github.com/exalex/ciphertalk/blob/main/electron/services/annualReportService.ts): `electron/services/annualReportService.ts`
- [Chat export](https://github.com/exalex/ciphertalk/blob/main/electron/services/exportService.ts): `electron/services/exportService.ts`

### AI summaries

- [AI summary service](https://github.com/exalex/ciphertalk/blob/main/electron/services/ai/aiService.ts): `electron/services/ai/aiService.ts`
- [AI provider integrations](https://github.com/exalex/ciphertalk/tree/main/electron/services/ai/providers): `electron/services/ai/providers`
- [AI history database](https://github.com/exalex/ciphertalk/blob/main/electron/services/ai/aiDatabase.ts): `electron/services/ai/aiDatabase.ts`

### MCP access

- [MCP server](https://github.com/exalex/ciphertalk/blob/main/electron/services/mcp/server.ts): `electron/services/mcp/server.ts`
- [MCP data tools](https://github.com/exalex/ciphertalk/blob/main/electron/services/mcp/readService.ts): `electron/services/mcp/readService.ts`

### Other components

- **CipherTalk user**
- **MCP host**

## Connections

- CipherTalk user → App routing: opens app
- App routing → Chat and search: routes to (evidence: `src/App.tsx`)
- Chat and search → Frontend IPC services: requests data
- Frontend IPC services → Chat history service: dispatches requests
- Chat history service → Chat database: reads chat data
- CipherTalk user → Chat analytics: views insights
- CipherTalk user → Group analytics: views group insights
- CipherTalk user → Annual reports: views reports
- CipherTalk user → Chat export: exports history
- CipherTalk user → AI summary service: requests summary
- AI summary service → AI provider integrations: selects provider (evidence: `electron/services/ai/aiService.ts`)
- AI summary service → AI history database: stores history (evidence: `electron/services/ai/aiService.ts`)
- Settings and AI options → Application configuration: configures options
- MCP host → MCP server: starts server
- MCP server → MCP data tools: registers tools (evidence: `electron/services/mcp/server.ts`)
- MCP data tools → Chat history service: reads conversations (evidence: `electron/services/mcp/readService.ts`)
- MCP data tools → Chat analytics: requests statistics (evidence: `electron/services/mcp/readService.ts`)
- MCP data tools → Chat export: requests exports (evidence: `electron/services/mcp/readService.ts`)
