# fneell-byte/server-zip- architecture

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

- Interactive diagram: https://gitdiagram.com/fneell-byte/server-zip-
- Repository: https://github.com/fneell-byte/server-zip-

## Overview

This is a Telegram-connected SMS collection and delivery service. Android-side clients submit SMS batches over HTTP; the server deduplicates them, notifies administrators and workers, and serves saved delivery-note text. Telegram users can create or view delivery notes, while administrators can manage admin status. The graph separates HTTP handling, bot workflows, SQLite state, and Telegram messaging. Source excerpts show the main calls; the SQLite file is identified by the tree, but its schema and contents were not inspected.

Main entry points: [`db/database.db`](https://github.com/fneell-byte/server-zip-/blob/main/db/database.db) (Application database), [`bot.js`](https://github.com/fneell-byte/server-zip-/blob/main/bot.js) (Bot handlers), [`index.js`](https://github.com/fneell-byte/server-zip-/blob/main/index.js) (HTTP server), [`telegram.js`](https://github.com/fneell-byte/server-zip-/blob/main/telegram.js) (Message helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP service"]
  node_http_api["HTTP server<br/>[index.js]"]
  node_sms_ingest["SMS ingestion<br/>[index.js]"]
  node_note_lookup["Note lookup<br/>[index.js]"]
end

subgraph group_bot["Telegram bot"]
  node_bot_app["Bot handlers<br/>[bot.js]"]
  node_note_workflow["Note workflow<br/>[bot.js]"]
  node_admin_workflow["Admin workflow<br/>[bot.js]"]
end

subgraph group_state["SQLite state"]
  node_database[("Application database<br/>[database.db]")]
end

subgraph group_messaging["Telegram messaging"]
  node_message_helpers["Message helpers<br/>[telegram.js]"]
end

node_sms_client(("SMS client"))
node_telegram_user(("Telegram user"))
node_telegram_api["Telegram API"]

node_sms_client -->|"sends requests"| node_http_api
node_http_api -->|"routes POST"| node_sms_ingest
node_http_api -->|"routes GET"| node_note_lookup
node_sms_ingest -->|"checks and saves"| node_database
node_note_lookup -->|"reads note"| node_database
node_sms_ingest -->|"sends alerts"| node_message_helpers
node_note_lookup -->|"sends logs"| node_message_helpers
node_telegram_user -->|"sends updates"| node_bot_app
node_bot_app -->|"enters workflow"| node_note_workflow
node_bot_app -->|"enters workflow"| node_admin_workflow
node_bot_app -->|"reads and writes"| node_database
node_note_workflow -->|"saves note"| node_database
node_admin_workflow -->|"updates admins"| node_database
node_message_helpers -->|"posts messages"| node_telegram_api

click node_http_api "https://github.com/fneell-byte/server-zip-/blob/main/index.js"
click node_sms_ingest "https://github.com/fneell-byte/server-zip-/blob/main/index.js"
click node_note_lookup "https://github.com/fneell-byte/server-zip-/blob/main/index.js"
click node_bot_app "https://github.com/fneell-byte/server-zip-/blob/main/bot.js"
click node_note_workflow "https://github.com/fneell-byte/server-zip-/blob/main/bot.js"
click node_admin_workflow "https://github.com/fneell-byte/server-zip-/blob/main/bot.js"
click node_database "https://github.com/fneell-byte/server-zip-/blob/main/db/database.db"
click node_message_helpers "https://github.com/fneell-byte/server-zip-/blob/main/telegram.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_http_api,node_sms_ingest,node_note_lookup,node_sms_client,node_telegram_user toneBlue
class node_bot_app,node_note_workflow,node_admin_workflow toneAmber
class node_database,node_telegram_api toneMint
class node_message_helpers toneRose
```

## Components

### HTTP service

- [HTTP server](https://github.com/fneell-byte/server-zip-/blob/main/index.js): `index.js`
- [SMS ingestion](https://github.com/fneell-byte/server-zip-/blob/main/index.js): `index.js`
- [Note lookup](https://github.com/fneell-byte/server-zip-/blob/main/index.js): `index.js`

### Telegram bot

- [Bot handlers](https://github.com/fneell-byte/server-zip-/blob/main/bot.js): `bot.js`
- [Note workflow](https://github.com/fneell-byte/server-zip-/blob/main/bot.js): `bot.js`
- [Admin workflow](https://github.com/fneell-byte/server-zip-/blob/main/bot.js): `bot.js`

### SQLite state

- [Application database](https://github.com/fneell-byte/server-zip-/blob/main/db/database.db): `db/database.db`

### Telegram messaging

- [Message helpers](https://github.com/fneell-byte/server-zip-/blob/main/telegram.js): `telegram.js`

### Other components

- **SMS client**
- **Telegram user**
- **Telegram API**

## Connections

- SMS client → HTTP server: sends requests (evidence: `index.js`)
- HTTP server → SMS ingestion: routes POST (evidence: `index.js`)
- HTTP server → Note lookup: routes GET (evidence: `index.js`)
- SMS ingestion → Application database: checks and saves (evidence: `index.js`)
- Note lookup → Application database: reads note (evidence: `index.js`)
- SMS ingestion → Message helpers: sends alerts (evidence: `index.js`)
- Note lookup → Message helpers: sends logs (evidence: `index.js`)
- Telegram user → Bot handlers: sends updates (evidence: `bot.js`)
- Bot handlers → Note workflow: enters workflow (evidence: `bot.js`)
- Bot handlers → Admin workflow: enters workflow (evidence: `bot.js`)
- Bot handlers → Application database: reads and writes (evidence: `bot.js`)
- Note workflow → Application database: saves note (evidence: `bot.js`)
- Admin workflow → Application database: updates admins (evidence: `bot.js`)
- Message helpers → Telegram API: posts messages (evidence: `telegram.js`)
