# natawun/stock-pormarine architecture

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

- Interactive diagram: https://gitdiagram.com/natawun/stock-pormarine
- Repository: https://github.com/natawun/stock-pormarine

## Overview

This is a Google Apps Script inventory dashboard for Pormarine, backed by a Google Spreadsheet. The principal workflow is a browser request reaching the web-app entry point, which loads dashboard data from the spreadsheet and either renders the dashboard template or returns JSON. The server also transforms three distinct report sheets into stock, inbound, and outbound data. The HTML file is present in the tree, but its contents were not provided, so its internal behavior and client-side calls are not represented.

Main entry points: [`google-apps-script.js`](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js) (Dashboard data loader), [`index.html`](https://github.com/natawun/stock-pormarine/blob/main/index.html) (Dashboard template)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_dashboard["Dashboard template<br/>[index.html]"]
  node_json["JSON response"]
end

subgraph group_server["Apps Script service"]
  node_entry["Web request handler"]
  node_loader["Dashboard data loader"]
  node_spreadsheet_access["Spreadsheet access"]
end

subgraph group_data["Inventory data"]
  node_sheets[("Google Spreadsheet")]
  node_stock["Stock report"]
  node_inbound["Inbound report"]
  node_outbound["Outbound report"]
end

node_browser(("Browser user"))

node_browser -->|"requests page or API"| node_entry
node_entry -->|"loads dashboard data"| node_loader
node_entry -->|"renders template"| node_dashboard
node_entry -->|"returns JSON"| node_json
node_loader -->|"gets spreadsheet"| node_spreadsheet_access
node_spreadsheet_access -->|"opens or gets active"| node_sheets
node_loader -->|"reads stock report"| node_stock
node_loader -->|"reads inbound report"| node_inbound
node_loader -->|"reads outbound report"| node_outbound
node_stock -->|"reads sheet rows"| node_sheets
node_inbound -->|"reads sheet rows"| node_sheets
node_outbound -->|"reads sheet rows"| node_sheets

click node_entry "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_dashboard "https://github.com/natawun/stock-pormarine/blob/main/index.html"
click node_json "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_loader "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_spreadsheet_access "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_stock "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_inbound "https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js"
click node_outbound "https://github.com/natawun/stock-pormarine/blob/main/google-apps-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_dashboard,node_json,node_browser toneBlue
class node_entry,node_loader,node_spreadsheet_access toneAmber
class node_sheets,node_stock,node_inbound,node_outbound toneMint
```

## Components

### Web interface

- [Dashboard template](https://github.com/natawun/stock-pormarine/blob/main/index.html): `index.html`
- [JSON response](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`

### Apps Script service

- [Web request handler](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`
- [Dashboard data loader](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`
- [Spreadsheet access](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`

### Inventory data

- **Google Spreadsheet**
- [Stock report](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`
- [Inbound report](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`
- [Outbound report](https://github.com/natawun/stock-pormarine/blob/main/google-apps-script.js): `google-apps-script.js`

### Other components

- **Browser user**

## Connections

- Browser user → Web request handler: requests page or API (evidence: `google-apps-script.js`)
- Web request handler → Dashboard data loader: loads dashboard data (evidence: `google-apps-script.js`)
- Web request handler → Dashboard template: renders template (evidence: `google-apps-script.js`)
- Web request handler → JSON response: returns JSON (evidence: `google-apps-script.js`)
- Dashboard data loader → Spreadsheet access: gets spreadsheet (evidence: `google-apps-script.js`)
- Spreadsheet access → Google Spreadsheet: opens or gets active (evidence: `google-apps-script.js`)
- Dashboard data loader → Stock report: reads stock report (evidence: `google-apps-script.js`)
- Dashboard data loader → Inbound report: reads inbound report (evidence: `google-apps-script.js`)
- Dashboard data loader → Outbound report: reads outbound report (evidence: `google-apps-script.js`)
- Stock report → Google Spreadsheet: reads sheet rows (evidence: `google-apps-script.js`)
- Inbound report → Google Spreadsheet: reads sheet rows (evidence: `google-apps-script.js`)
- Outbound report → Google Spreadsheet: reads sheet rows (evidence: `google-apps-script.js`)
