# poomsaks/excel-to-db architecture

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

- Interactive diagram: https://gitdiagram.com/poomsaks/excel-to-db
- Repository: https://github.com/poomsaks/excel-to-db

## Overview

This is a small Express application for importing spreadsheet rows into a MySQL database. A user opens the served page, submits an Excel file to the upload endpoint, and the route stores the file, parses its first worksheet, and inserts each row into the lowcarb table. The app also initializes the database pool and serves the static view. The source excerpts establish these main relationships; the page's submission behavior is not shown, so no client-to-endpoint edge is asserted.

Main entry points: [`routes.js`](https://github.com/poomsaks/excel-to-db/blob/main/routes.js) (Upload route), [`app.js`](https://github.com/poomsaks/excel-to-db/blob/main/app.js) (Express server), [`db.js`](https://github.com/poomsaks/excel-to-db/blob/main/db.js) (MySQL pool), [`view/index.html`](https://github.com/poomsaks/excel-to-db/blob/main/view/index.html) (Upload page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_server["Express server<br/>[app.js]"]
  node_page["Upload page<br/>[index.html]"]
end

subgraph group_import["Spreadsheet import"]
  node_upload["Upload route<br/>[routes.js]"]
  node_file["Stored spreadsheet"]
  node_parser["Workbook parser<br/>[routes.js]"]
end

subgraph group_persistence["Persistence"]
  node_pool["MySQL pool<br/>[db.js]"]
  node_database[("MySQL database")]
end

node_user(("User"))

node_server -->|"serves"| node_page
node_server -->|"mounts routes"| node_upload
node_upload -->|"stores upload"| node_file
node_upload -->|"reads workbook"| node_parser
node_upload -->|"inserts rows"| node_pool
node_pool -->|"queries"| node_database

click node_server "https://github.com/poomsaks/excel-to-db/blob/main/app.js"
click node_page "https://github.com/poomsaks/excel-to-db/blob/main/view/index.html"
click node_upload "https://github.com/poomsaks/excel-to-db/blob/main/routes.js"
click node_file "https://github.com/poomsaks/excel-to-db/tree/main/uploads"
click node_parser "https://github.com/poomsaks/excel-to-db/blob/main/routes.js"
click node_pool "https://github.com/poomsaks/excel-to-db/blob/main/db.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_server,node_page,node_user toneBlue
class node_upload,node_file,node_parser toneAmber
class node_pool,node_database toneMint
```

## Components

### Web entry

- [Express server](https://github.com/poomsaks/excel-to-db/blob/main/app.js): `app.js`
- [Upload page](https://github.com/poomsaks/excel-to-db/blob/main/view/index.html): `view/index.html`

### Spreadsheet import

- [Upload route](https://github.com/poomsaks/excel-to-db/blob/main/routes.js): `routes.js`
- [Stored spreadsheet](https://github.com/poomsaks/excel-to-db/tree/main/uploads): `uploads`
- [Workbook parser](https://github.com/poomsaks/excel-to-db/blob/main/routes.js): `routes.js`

### Persistence

- [MySQL pool](https://github.com/poomsaks/excel-to-db/blob/main/db.js): `db.js`
- **MySQL database**

### Other components

- **User**

## Connections

- Express server → Upload page: serves (evidence: `app.js`)
- Express server → Upload route: mounts routes (evidence: `app.js`)
- Upload route → Stored spreadsheet: stores upload (evidence: `routes.js`)
- Upload route → Workbook parser: reads workbook (evidence: `routes.js`)
- Upload route → MySQL pool: inserts rows (evidence: `routes.js`)
- MySQL pool → MySQL database: queries (evidence: `db.js`)
