# mlomb/chat-analytics architecture

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

- Interactive diagram: https://gitdiagram.com/mlomb/chat-analytics
- Repository: https://github.com/mlomb/chat-analytics

## Overview

Chat Analytics turns exports from Discord, Messenger, Telegram, or WhatsApp into a downloadable interactive HTML report, with chat data processed locally. The web workflow selects a platform and files, starts generation in a worker, and presents progress and the report for download or local viewing. The repository also documents CLI generation and report areas for messages, language, emoji, links, calls, interaction, sentiment, and timeline. Worker and pipeline excerpts show key generation and report-analysis responsibilities; several connections to unsampled UI and pipeline modules are left unverified.

Main entry points: [`app/components/Steps.tsx`](https://github.com/mlomb/chat-analytics/blob/main/app/components/Steps.tsx) (Generation steps), [`app/WorkerApp.ts`](https://github.com/mlomb/chat-analytics/blob/main/app/WorkerApp.ts) (Generation worker), [`report/WorkerReport.ts`](https://github.com/mlomb/chat-analytics/blob/main/report/WorkerReport.ts) (Report analysis worker), [`pipeline/process/DatabaseBuilder.ts`](https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/DatabaseBuilder.ts) (Database builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflow"]
  node_steps["Generation steps<br/>[Steps.tsx]"]
  node_platform["Platform selection"]
  node_instructions["Export instructions"]
  node_file_selection["File selection<br/>[FilesSelection.tsx]"]
  node_progress_ui["Generation progress"]
  node_download_ui["Report download"]
end

subgraph group_generation["Report generation"]
  node_web_worker["Generation worker<br/>[WorkerApp.ts]"]
  node_cli["CLI generation<br/>[CLI.ts]"]
  node_pipeline_api["Pipeline entry<br/>[index.ts]"]
  node_platform_parsers["Platform parsers"]
  node_parser_contract["Parser contract<br/>[Parser.ts]"]
  node_database_builder["Database builder<br/>[DatabaseBuilder.ts]"]
  node_message_processing["Message processing"]
  node_nlp["Language and sentiment"]
  node_database[("Report database<br/>[Types.ts]")]
  node_compression["Database compression<br/>[Compression.ts]"]
end

subgraph group_analysis["Report analysis"]
  node_report_worker["Report analysis worker<br/>[WorkerReport.ts]"]
  node_aggregates["Statistics blocks"]
  node_filters["Report filters<br/>[Filters.ts]"]
end

subgraph group_presentation["Interactive report"]
  node_report_ui["Report interface<br/>[ReportPage.tsx]"]
  node_cards["Statistics cards"]
  node_visualizations["Charts and visualizations"]
end

node_user(("Report user"))

node_user -->|"starts workflow"| node_steps
node_steps -->|"shows step"| node_platform
node_steps -->|"shows step"| node_instructions
node_steps -->|"shows step"| node_file_selection
node_steps -->|"shows progress"| node_progress_ui
node_steps -->|"shows result"| node_download_ui
node_steps -.->|"starts generation"| node_web_worker
node_web_worker -->|"calls generation"| node_pipeline_api
node_web_worker -.->|"generates database"| node_database_builder
node_web_worker -.->|"generates report"| node_compression
node_cli -.->|"runs generation"| node_pipeline_api
node_database_builder -.->|"selects parser"| node_platform_parsers
node_platform_parsers -.->|"implements contract"| node_parser_contract
node_database_builder -.->|"builds database"| node_database
node_message_processing -.->|"uses language analysis"| node_nlp
node_report_worker -->|"decompresses database"| node_compression
node_report_worker -.->|"requests statistics"| node_aggregates
node_report_worker -->|"updates filters"| node_filters
node_report_ui -.->|"requests analysis"| node_report_worker
node_report_ui -.->|"presents statistics"| node_cards
node_cards -.->|"renders charts"| node_visualizations
node_user -->|"downloads report"| node_download_ui

click node_steps "https://github.com/mlomb/chat-analytics/blob/main/app/components/Steps.tsx"
click node_platform "https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/PlatformSelection.tsx"
click node_instructions "https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/ExportInstructions.tsx"
click node_file_selection "https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/FilesSelection.tsx"
click node_progress_ui "https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/GenerationProgress.tsx"
click node_download_ui "https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/ViewDownloadReport.tsx"
click node_web_worker "https://github.com/mlomb/chat-analytics/blob/main/app/WorkerApp.ts"
click node_cli "https://github.com/mlomb/chat-analytics/blob/main/lib/CLI.ts"
click node_pipeline_api "https://github.com/mlomb/chat-analytics/blob/main/pipeline/index.ts"
click node_platform_parsers "https://github.com/mlomb/chat-analytics/tree/main/pipeline/parse/parsers"
click node_parser_contract "https://github.com/mlomb/chat-analytics/blob/main/pipeline/parse/Parser.ts"
click node_database_builder "https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/DatabaseBuilder.ts"
click node_message_processing "https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/MessageProcessor.ts"
click node_nlp "https://github.com/mlomb/chat-analytics/tree/main/pipeline/process/nlp"
click node_database "https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/Types.ts"
click node_compression "https://github.com/mlomb/chat-analytics/blob/main/pipeline/compression/Compression.ts"
click node_report_worker "https://github.com/mlomb/chat-analytics/blob/main/report/WorkerReport.ts"
click node_aggregates "https://github.com/mlomb/chat-analytics/tree/main/pipeline/aggregate/blocks"
click node_filters "https://github.com/mlomb/chat-analytics/blob/main/pipeline/aggregate/Filters.ts"
click node_report_ui "https://github.com/mlomb/chat-analytics/blob/main/report/ReportPage.tsx"
click node_cards "https://github.com/mlomb/chat-analytics/tree/main/report/components/cards"
click node_visualizations "https://github.com/mlomb/chat-analytics/tree/main/report/components/viz"

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_steps,node_platform,node_instructions,node_file_selection,node_progress_ui,node_download_ui,node_user toneBlue
class node_web_worker,node_cli,node_pipeline_api,node_platform_parsers,node_parser_contract,node_database_builder,node_message_processing,node_nlp,node_database,node_compression toneAmber
class node_report_worker,node_aggregates,node_filters toneMint
class node_report_ui,node_cards,node_visualizations toneRose
```

## Components

### Web workflow

- [Generation steps](https://github.com/mlomb/chat-analytics/blob/main/app/components/Steps.tsx): `app/components/Steps.tsx`
- [Platform selection](https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/PlatformSelection.tsx): `app/components/steps/PlatformSelection.tsx`
- [Export instructions](https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/ExportInstructions.tsx): `app/components/steps/ExportInstructions.tsx`
- [File selection](https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/FilesSelection.tsx): `app/components/steps/FilesSelection.tsx`
- [Generation progress](https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/GenerationProgress.tsx): `app/components/steps/GenerationProgress.tsx`
- [Report download](https://github.com/mlomb/chat-analytics/blob/main/app/components/steps/ViewDownloadReport.tsx): `app/components/steps/ViewDownloadReport.tsx`

### Report generation

- [Generation worker](https://github.com/mlomb/chat-analytics/blob/main/app/WorkerApp.ts): `app/WorkerApp.ts`
- [CLI generation](https://github.com/mlomb/chat-analytics/blob/main/lib/CLI.ts): `lib/CLI.ts`
- [Pipeline entry](https://github.com/mlomb/chat-analytics/blob/main/pipeline/index.ts): `pipeline/index.ts`
- [Platform parsers](https://github.com/mlomb/chat-analytics/tree/main/pipeline/parse/parsers): `pipeline/parse/parsers`
- [Parser contract](https://github.com/mlomb/chat-analytics/blob/main/pipeline/parse/Parser.ts): `pipeline/parse/Parser.ts`
- [Database builder](https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/DatabaseBuilder.ts): `pipeline/process/DatabaseBuilder.ts`
- [Message processing](https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/MessageProcessor.ts): `pipeline/process/MessageProcessor.ts`
- [Language and sentiment](https://github.com/mlomb/chat-analytics/tree/main/pipeline/process/nlp): `pipeline/process/nlp`
- [Report database](https://github.com/mlomb/chat-analytics/blob/main/pipeline/process/Types.ts): `pipeline/process/Types.ts`
- [Database compression](https://github.com/mlomb/chat-analytics/blob/main/pipeline/compression/Compression.ts): `pipeline/compression/Compression.ts`

### Report analysis

- [Report analysis worker](https://github.com/mlomb/chat-analytics/blob/main/report/WorkerReport.ts): `report/WorkerReport.ts`
- [Statistics blocks](https://github.com/mlomb/chat-analytics/tree/main/pipeline/aggregate/blocks): `pipeline/aggregate/blocks`
- [Report filters](https://github.com/mlomb/chat-analytics/blob/main/pipeline/aggregate/Filters.ts): `pipeline/aggregate/Filters.ts`

### Interactive report

- [Report interface](https://github.com/mlomb/chat-analytics/blob/main/report/ReportPage.tsx): `report/ReportPage.tsx`
- [Statistics cards](https://github.com/mlomb/chat-analytics/tree/main/report/components/cards): `report/components/cards`
- [Charts and visualizations](https://github.com/mlomb/chat-analytics/tree/main/report/components/viz): `report/components/viz`

### Other components

- **Report user**

## Connections

- Report user → Generation steps: starts workflow (evidence: `README.md`)
- Generation steps → Platform selection: shows step (evidence: `app/components/Steps.tsx`)
- Generation steps → Export instructions: shows step (evidence: `app/components/Steps.tsx`)
- Generation steps → File selection: shows step (evidence: `app/components/Steps.tsx`)
- Generation steps → Generation progress: shows progress (evidence: `app/components/Steps.tsx`)
- Generation steps → Report download: shows result (evidence: `app/components/Steps.tsx`)
- Generation steps → Generation worker: starts generation
- Generation worker → Pipeline entry: calls generation (evidence: `app/WorkerApp.ts`)
- Generation worker → Database builder: generates database
- Generation worker → Database compression: generates report
- CLI generation → Pipeline entry: runs generation
- Database builder → Platform parsers: selects parser
- Platform parsers → Parser contract: implements contract
- Database builder → Report database: builds database
- Message processing → Language and sentiment: uses language analysis
- Report analysis worker → Database compression: decompresses database (evidence: `report/WorkerReport.ts`)
- Report analysis worker → Statistics blocks: requests statistics
- Report analysis worker → Report filters: updates filters (evidence: `report/WorkerReport.ts`)
- Report interface → Report analysis worker: requests analysis
- Report interface → Statistics cards: presents statistics
- Statistics cards → Charts and visualizations: renders charts
- Report user → Report download: downloads report (evidence: `README.md`)
