# selma-star/elecsa-platform architecture

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

- Interactive diagram: https://gitdiagram.com/selma-star/elecsa-platform
- Repository: https://github.com/selma-star/elecsa-platform

## Overview

ELECSA turns uploaded PDF quotations into editable, structured line items, then exports reviewed quotations as Excel or PDF. The browser handles login, extraction requests, review and pricing edits; the backend authenticates and relays requests to the Python service, which selects native-text parsing or scanned-document OCR and builds exports. Source excerpts show the main API and processing calls; deployment details and some implementation internals were not sampled, so the graph focuses on evidenced runtime relationships.

Main entry points: [`extraction-service/main.py`](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/main.py) (Extraction API), [`frontend/src/App.jsx`](https://github.com/selma-star/elecsa-platform/blob/main/frontend/src/App.jsx) (Review and pricing UI), [`backend/server.js`](https://github.com/selma-star/elecsa-platform/blob/main/backend/server.js) (Authenticated API relay), [`extraction-service/ocr_table.py`](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/ocr_table.py) (Scanned PDF OCR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Quotation workspace"]
  node_app["Review and pricing UI<br/>[App.jsx]"]
end

subgraph group_gateway["Authentication and API"]
  node_backend_auth["Login and JWT auth<br/>[server.js]"]
  node_api_relay["Authenticated API relay<br/>[server.js]"]
end

subgraph group_processing["PDF extraction"]
  node_extract_api["Extraction API<br/>[main.py]"]
  node_native_pdf["Native PDF parser<br/>[pdf_parser.py]"]
  node_scanned_pdf["Scanned PDF OCR<br/>[ocr_table.py]"]
  node_ocr_tools["OCR and PDF imaging"]
end

subgraph group_exports["Quotation exports"]
  node_workbook["Workbook builder<br/>[excel_builder.py]"]
  node_pdf_convert["Workbook to PDF<br/>[main.py]"]
end

node_user(("Quotation user"))
node_libreoffice["LibreOffice"]

node_user -->|"uses"| node_app
node_app -->|"logs in"| node_backend_auth
node_app -->|"uploads and exports"| node_api_relay
node_api_relay -->|"forwards requests"| node_extract_api
node_extract_api -->|"parses native PDFs"| node_native_pdf
node_extract_api -->|"processes scanned PDFs"| node_scanned_pdf
node_scanned_pdf -->|"uses OCR and imaging"| node_ocr_tools
node_extract_api -->|"builds workbook"| node_workbook
node_extract_api -->|"converts workbook"| node_pdf_convert
node_pdf_convert -->|"converts to PDF"| node_libreoffice

click node_app "https://github.com/selma-star/elecsa-platform/blob/main/frontend/src/App.jsx"
click node_backend_auth "https://github.com/selma-star/elecsa-platform/blob/main/backend/server.js"
click node_api_relay "https://github.com/selma-star/elecsa-platform/blob/main/backend/server.js"
click node_extract_api "https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/main.py"
click node_native_pdf "https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/pdf_parser.py"
click node_scanned_pdf "https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/ocr_table.py"
click node_workbook "https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/excel_builder.py"
click node_pdf_convert "https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/main.py"

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_user toneBlue
class node_backend_auth,node_api_relay toneAmber
class node_extract_api,node_native_pdf,node_scanned_pdf,node_ocr_tools toneMint
class node_workbook,node_pdf_convert toneRose
class node_libreoffice toneIndigo
```

## Components

### Quotation workspace

- [Review and pricing UI](https://github.com/selma-star/elecsa-platform/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Authentication and API

- [Login and JWT auth](https://github.com/selma-star/elecsa-platform/blob/main/backend/server.js): `backend/server.js`
- [Authenticated API relay](https://github.com/selma-star/elecsa-platform/blob/main/backend/server.js): `backend/server.js`

### PDF extraction

- [Extraction API](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/main.py): `extraction-service/main.py`
- [Native PDF parser](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/pdf_parser.py): `extraction-service/pdf_parser.py`
- [Scanned PDF OCR](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/ocr_table.py): `extraction-service/ocr_table.py`
- **OCR and PDF imaging**

### Quotation exports

- [Workbook builder](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/excel_builder.py): `extraction-service/excel_builder.py`
- [Workbook to PDF](https://github.com/selma-star/elecsa-platform/blob/main/extraction-service/main.py): `extraction-service/main.py`

### Other components

- **Quotation user**
- **LibreOffice**

## Connections

- Quotation user → Review and pricing UI: uses (evidence: `frontend/src/App.jsx`)
- Review and pricing UI → Login and JWT auth: logs in (evidence: `frontend/src/App.jsx`)
- Review and pricing UI → Authenticated API relay: uploads and exports (evidence: `frontend/src/App.jsx`)
- Authenticated API relay → Extraction API: forwards requests (evidence: `backend/server.js`)
- Extraction API → Native PDF parser: parses native PDFs (evidence: `extraction-service/main.py`)
- Extraction API → Scanned PDF OCR: processes scanned PDFs (evidence: `extraction-service/main.py`)
- Scanned PDF OCR → OCR and PDF imaging: uses OCR and imaging (evidence: `extraction-service/ocr_table.py`)
- Extraction API → Workbook builder: builds workbook (evidence: `extraction-service/main.py`)
- Extraction API → Workbook to PDF: converts workbook (evidence: `extraction-service/main.py`)
- Workbook to PDF → LibreOffice: converts to PDF (evidence: `extraction-service/main.py`)
