# rays3353/raysdompetclaude architecture

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

- Interactive diagram: https://gitdiagram.com/rays3353/raysdompetclaude
- Repository: https://github.com/rays3353/raysdompetclaude

## Overview

Raysdompet is a personal-finance app backed by a Telegram bot running on Cloudflare Workers. The visible workflow is Telegram messages and receipt photos entering the Worker, which queues text or OCR results for the app; the app can fetch pending items, acknowledge them, and synchronize snapshots used for bot replies and scheduled summaries. The tree also includes a service worker with offline caching. The app source and parts of the Worker are unsampled, so the graph limits links to relationships shown in excerpts or explicitly described there.

Main entry points: [`worker.js`](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js) (Message intake), [`index.html`](https://github.com/rays3353/raysdompetclaude/blob/main/index.html) (Finance app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["App client"]
  node_app["Finance app<br/>[index.html]"]
  node_offline["Offline cache<br/>[sw.js]"]
end

subgraph group_worker["Worker runtime"]
  node_intake["Message intake<br/>[worker.js]"]
  node_telegram["Telegram replies<br/>[worker.js]"]
  node_ocr["Receipt OCR<br/>[worker.js]"]
  node_appapi["App endpoints<br/>[worker.js]"]
  node_scheduler["Scheduled summaries<br/>[worker.js]"]
end

subgraph group_state["Worker state"]
  node_queue[("Pending queue<br/>[worker.js]")]
  node_snapshot[("Synced snapshot<br/>[worker.js]")]
end

subgraph group_external["External services"]
  node_telegram_service["Telegram API"]
  node_gemini["Gemini"]
end

node_user(("User"))
node_kv[("Worker KV")]
node_cron(("Cron trigger"))

node_user -->|"sends message"| node_telegram_service
node_telegram_service -->|"delivers webhook"| node_intake
node_intake -->|"queues text"| node_queue
node_intake -->|"processes photos"| node_ocr
node_ocr -->|"analyzes image"| node_gemini
node_ocr -->|"queues result"| node_queue
node_telegram -->|"sends replies"| node_telegram_service
node_intake -->|"notifies user"| node_telegram
node_app -->|"fetches and syncs"| node_appapi
node_appapi -->|"reads and acknowledges"| node_queue
node_appapi -->|"writes snapshot"| node_snapshot
node_cron -.->|"triggers"| node_scheduler
node_scheduler -->|"reads snapshot"| node_snapshot
node_scheduler -->|"sends summaries"| node_telegram
node_intake -->|"stores state"| node_kv
node_appapi -->|"reads and writes"| node_kv
node_scheduler -->|"reads and writes"| node_kv

click node_app "https://github.com/rays3353/raysdompetclaude/blob/main/index.html"
click node_offline "https://github.com/rays3353/raysdompetclaude/blob/main/sw.js"
click node_intake "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_telegram "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_ocr "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_appapi "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_scheduler "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_queue "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"
click node_snapshot "https://github.com/rays3353/raysdompetclaude/blob/main/worker.js"

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_offline,node_user toneBlue
class node_intake,node_telegram,node_ocr,node_appapi,node_scheduler,node_kv toneAmber
class node_queue,node_snapshot toneMint
class node_telegram_service,node_gemini toneRose
class node_cron toneIndigo
```

## Components

### App client

- [Finance app](https://github.com/rays3353/raysdompetclaude/blob/main/index.html): `index.html`
- [Offline cache](https://github.com/rays3353/raysdompetclaude/blob/main/sw.js): `sw.js`

### Worker runtime

- [Message intake](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`
- [Telegram replies](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`
- [Receipt OCR](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`
- [App endpoints](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`
- [Scheduled summaries](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`

### Worker state

- [Pending queue](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`
- [Synced snapshot](https://github.com/rays3353/raysdompetclaude/blob/main/worker.js): `worker.js`

### External services

- **Telegram API**
- **Gemini**

### Other components

- **User**
- **Worker KV**
- **Cron trigger**

## Connections

- User → Telegram API: sends message
- Telegram API → Message intake: delivers webhook (evidence: `worker.js`)
- Message intake → Pending queue: queues text (evidence: `worker.js`)
- Message intake → Receipt OCR: processes photos (evidence: `worker.js`)
- Receipt OCR → Gemini: analyzes image (evidence: `worker.js`)
- Receipt OCR → Pending queue: queues result (evidence: `worker.js`)
- Telegram replies → Telegram API: sends replies (evidence: `worker.js`)
- Message intake → Telegram replies: notifies user (evidence: `worker.js`)
- Finance app → App endpoints: fetches and syncs (evidence: `worker.js`)
- App endpoints → Pending queue: reads and acknowledges (evidence: `worker.js`)
- App endpoints → Synced snapshot: writes snapshot (evidence: `worker.js`)
- Cron trigger → Scheduled summaries: triggers
- Scheduled summaries → Synced snapshot: reads snapshot (evidence: `worker.js`)
- Scheduled summaries → Telegram replies: sends summaries (evidence: `worker.js`)
- Message intake → Worker KV: stores state (evidence: `worker.js`)
- App endpoints → Worker KV: reads and writes (evidence: `worker.js`)
- Scheduled summaries → Worker KV: reads and writes (evidence: `worker.js`)
