# lluis6/esitiron architecture

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

- Interactive diagram: https://gitdiagram.com/lluis6/esitiron
- Repository: https://github.com/lluis6/esitiron

## Overview

Esitiron is a receipt-management platform: users authenticate, upload an image or PDF, review OCR-extracted receipt data, confirm it, and build searchable purchase history. The web server coordinates OCR, persistence, product curation, and collaborative groups; OCR normalizes Gemini results, while MySQL stores application data behind ProxySQL. The README documents security, OpenFoodFacts enrichment, replication, and observability. Some capabilities are documented but their implementation was not sampled, so those links are documented relationships rather than claims of source inspection.

Main entry points: [`web/server.js`](https://github.com/lluis6/esitiron/blob/main/web/server.js) (Web application), [`ocr/main.py`](https://github.com/lluis6/esitiron/blob/main/ocr/main.py) (OCR service), [`proxysql.cnf`](https://github.com/lluis6/esitiron/blob/main/proxysql.cnf) (ProxySQL), [`nginx.conf`](https://github.com/lluis6/esitiron/blob/main/nginx.conf) (Nginx proxy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_webapp["Web application"]
  node_web["Web application<br/>[server.js]"]
  node_views["Web views"]
  node_groups["Collaborative groups<br/>[grupos.js]"]
end

subgraph group_processing["Receipt processing"]
  node_ocr["OCR service<br/>[main.py]"]
end

subgraph group_data["Persistence and curation"]
  node_proxysql["ProxySQL<br/>[proxysql.cnf]"]
  node_mysql[("MySQL data<br/>[schema.sql]")]
end

subgraph group_operations["Access and observability"]
  node_nginx["Nginx proxy<br/>[nginx.conf]"]
  node_metrics["Web metrics<br/>[metrics.js]"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_grafana["Grafana<br/>[dashboard.json]"]
  node_logs["Log collection<br/>[config.yml]"]
  node_loki["Loki<br/>[config.yml]"]
end

node_user(("Receipt user"))
node_gemini["Gemini API"]
node_off["OpenFoodFacts"]

node_user -->|"opens app"| node_nginx
node_nginx -->|"proxies requests"| node_web
node_web -->|"renders pages"| node_views
node_web -->|"sends receipt"| node_ocr
node_ocr -->|"analyzes image"| node_gemini
node_ocr -->|"returns results"| node_web
node_web -->|"queries data"| node_proxysql
node_proxysql -->|"routes SQL"| node_mysql
node_web -.->|"enriches products"| node_off
node_web -->|"mounts routes"| node_groups
node_prometheus -->|"scrapes metrics"| node_metrics
node_grafana -->|"queries metrics"| node_prometheus
node_logs -->|"ships logs"| node_loki

click node_nginx "https://github.com/lluis6/esitiron/blob/main/nginx.conf"
click node_web "https://github.com/lluis6/esitiron/blob/main/web/server.js"
click node_views "https://github.com/lluis6/esitiron/tree/main/web/views"
click node_groups "https://github.com/lluis6/esitiron/blob/main/web/grupos.js"
click node_ocr "https://github.com/lluis6/esitiron/blob/main/ocr/main.py"
click node_proxysql "https://github.com/lluis6/esitiron/blob/main/proxysql.cnf"
click node_mysql "https://github.com/lluis6/esitiron/blob/main/db_base/schema.sql"
click node_metrics "https://github.com/lluis6/esitiron/blob/main/web/metrics.js"
click node_prometheus "https://github.com/lluis6/esitiron/blob/main/monitoring/prometheus/prometheus.yml"
click node_grafana "https://github.com/lluis6/esitiron/blob/main/monitoring/grafana/grafana_exports/dashboard.json"
click node_logs "https://github.com/lluis6/esitiron/blob/main/monitoring/promtail/config.yml"
click node_loki "https://github.com/lluis6/esitiron/blob/main/monitoring/loki/config.yml"

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_web,node_views,node_groups,node_user toneBlue
class node_ocr toneAmber
class node_proxysql,node_mysql,node_gemini toneMint
class node_nginx,node_metrics,node_prometheus,node_grafana,node_logs,node_loki toneRose
class node_off toneIndigo
```

## Components

### Web application

- [Web application](https://github.com/lluis6/esitiron/blob/main/web/server.js): `web/server.js`
- [Web views](https://github.com/lluis6/esitiron/tree/main/web/views): `web/views`
- [Collaborative groups](https://github.com/lluis6/esitiron/blob/main/web/grupos.js): `web/grupos.js`

### Receipt processing

- [OCR service](https://github.com/lluis6/esitiron/blob/main/ocr/main.py): `ocr/main.py`

### Persistence and curation

- [ProxySQL](https://github.com/lluis6/esitiron/blob/main/proxysql.cnf): `proxysql.cnf`
- [MySQL data](https://github.com/lluis6/esitiron/blob/main/db_base/schema.sql): `db_base/schema.sql`

### Access and observability

- [Nginx proxy](https://github.com/lluis6/esitiron/blob/main/nginx.conf): `nginx.conf`
- [Web metrics](https://github.com/lluis6/esitiron/blob/main/web/metrics.js): `web/metrics.js`
- [Prometheus](https://github.com/lluis6/esitiron/blob/main/monitoring/prometheus/prometheus.yml): `monitoring/prometheus/prometheus.yml`
- [Grafana](https://github.com/lluis6/esitiron/blob/main/monitoring/grafana/grafana_exports/dashboard.json): `monitoring/grafana/grafana_exports/dashboard.json`
- [Log collection](https://github.com/lluis6/esitiron/blob/main/monitoring/promtail/config.yml): `monitoring/promtail/config.yml`
- [Loki](https://github.com/lluis6/esitiron/blob/main/monitoring/loki/config.yml): `monitoring/loki/config.yml`

### Other components

- **Receipt user**
- **Gemini API**
- **OpenFoodFacts**

## Connections

- Receipt user → Nginx proxy: opens app (evidence: `README.md`)
- Nginx proxy → Web application: proxies requests (evidence: `README.md`)
- Web application → Web views: renders pages (evidence: `web/server.js`)
- Web application → OCR service: sends receipt (evidence: `README.md`)
- OCR service → Gemini API: analyzes image (evidence: `ocr/main.py`)
- OCR service → Web application: returns results (evidence: `README.md`)
- Web application → ProxySQL: queries data (evidence: `README.md`)
- ProxySQL → MySQL data: routes SQL (evidence: `README.md`)
- Web application → OpenFoodFacts: enriches products (evidence: `README.md`)
- Web application → Collaborative groups: mounts routes (evidence: `web/server.js`)
- Prometheus → Web metrics: scrapes metrics (evidence: `README.md`)
- Grafana → Prometheus: queries metrics
- Log collection → Loki: ships logs (evidence: `README.md`)
