# valaevdaniil565-ops/bottgai architecture

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

## Overview

«Дело в системе» is a business-process services website whose main workflow turns a visitor’s completed contact form into a PostgreSQL lead record and a Telegram notification for the owner. The browser also provides diagnostic choices and lets visitors select a service before submitting. Internally, the Node.js server validates requests, initializes the database schema, persists leads, and records successful Telegram delivery. The sampled source shows these runtime relationships; the page markup and styling are represented by their paths, but were not excerpted.

Main entry points: [`server.js`](https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js) (Lead API), [`public/index.html`](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/index.html) (Services website), [`public/script.js`](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/script.js) (Page interactions), [`schema.sql`](https://github.com/valaevdaniil565-ops/bottgai/blob/main/schema.sql) (PostgreSQL leads)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Website experience"]
  node_site["Services website<br/>[index.html]"]
  node_site_styles["Page styling<br/>[styles.css]"]
  node_site_interactions["Page interactions<br/>[script.js]"]
  node_lead_form["Lead form<br/>[index.html]"]
  node_form_feedback["Submission feedback<br/>[script.js]"]
end

subgraph group_backend["Lead processing"]
  node_lead_api["Lead API<br/>[server.js]"]
  node_lead_validation["Lead validation<br/>[server.js]"]
  node_schema_init["Schema initialization<br/>[server.js]"]
end

subgraph group_integrations["Storage and notifications"]
  node_schema["Lead schema<br/>[schema.sql]"]
  node_lead_store[("PostgreSQL leads<br/>[schema.sql]")]
  node_telegram_service["Telegram Bot API"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_site
node_site -.->|"uses styles"| node_site_styles
node_site -.->|"loads script"| node_site_interactions
node_site -.->|"presents"| node_lead_form
node_site_interactions -->|"handles input"| node_lead_form
node_site_interactions -->|"updates"| node_form_feedback
node_lead_form -->|"submits to"| node_lead_api
node_lead_api -->|"validates"| node_lead_validation
node_lead_api -->|"inserts lead"| node_lead_store
node_lead_api -->|"sends notification"| node_telegram_service
node_lead_api -->|"records delivery"| node_lead_store
node_lead_api -->|"returns result"| node_form_feedback
node_schema_init -->|"reads and runs"| node_schema
node_schema_init -->|"prepares tables"| node_lead_store

click node_site "https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/index.html"
click node_site_styles "https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/styles.css"
click node_site_interactions "https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/script.js"
click node_lead_form "https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/index.html"
click node_lead_api "https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js"
click node_lead_validation "https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js"
click node_schema_init "https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js"
click node_schema "https://github.com/valaevdaniil565-ops/bottgai/blob/main/schema.sql"
click node_lead_store "https://github.com/valaevdaniil565-ops/bottgai/blob/main/schema.sql"
click node_form_feedback "https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/script.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_site,node_site_styles,node_site_interactions,node_lead_form,node_form_feedback toneBlue
class node_lead_api,node_lead_validation,node_schema_init toneAmber
class node_schema,node_lead_store,node_telegram_service toneMint
class node_visitor toneIndigo
```

## Components

### Website experience

- [Services website](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/index.html): `public/index.html`
- [Page styling](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/styles.css): `public/styles.css`
- [Page interactions](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/script.js): `public/script.js`
- [Lead form](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/index.html): `public/index.html`
- [Submission feedback](https://github.com/valaevdaniil565-ops/bottgai/blob/main/public/script.js): `public/script.js`

### Lead processing

- [Lead API](https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js): `server.js`
- [Lead validation](https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js): `server.js`
- [Schema initialization](https://github.com/valaevdaniil565-ops/bottgai/blob/main/server.js): `server.js`

### Storage and notifications

- [Lead schema](https://github.com/valaevdaniil565-ops/bottgai/blob/main/schema.sql): `schema.sql`
- [PostgreSQL leads](https://github.com/valaevdaniil565-ops/bottgai/blob/main/schema.sql): `schema.sql`
- **Telegram Bot API**

### Other components

- **Visitor**

## Connections

- Visitor → Services website: opens (evidence: `README.md`)
- Services website → Page styling: uses styles
- Services website → Page interactions: loads script
- Services website → Lead form: presents
- Page interactions → Lead form: handles input (evidence: `public/script.js`)
- Page interactions → Submission feedback: updates (evidence: `public/script.js`)
- Lead form → Lead API: submits to
- Lead API → Lead validation: validates (evidence: `server.js`)
- Lead API → PostgreSQL leads: inserts lead (evidence: `server.js`)
- Lead API → Telegram Bot API: sends notification (evidence: `server.js`)
- Lead API → PostgreSQL leads: records delivery (evidence: `server.js`)
- Lead API → Submission feedback: returns result (evidence: `public/script.js`)
- Schema initialization → Lead schema: reads and runs (evidence: `server.js`)
- Schema initialization → PostgreSQL leads: prepares tables (evidence: `README.md`)
