# terragodnone17-dev/prototypemco-cs303- architecture

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

- Interactive diagram: https://gitdiagram.com/terragodnone17-dev/prototypemco-cs303-
- Repository: https://github.com/terragodnone17-dev/prototypemco-cs303-

## Overview

WRSMS is an offline, administrator-operated water-station management application. Its principal workflow is administrator sign-in, then recording counter or delivery orders and managing the related customer, stock, payment, and container records, followed by delivery reconciliation and daily cash closing. The README also describes dashboards, expenses, audit logs, and backups. The sampled excerpts establish the UI controller’s database use, authentication’s database and hashing use, and the SQLite-backed persistence layer; finer feature-level calls are not visible in the excerpts.

Main entry points: [`js/App.js`](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js) (Application controller), [`js/db.js`](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/db.js) (Database layer), [`js/auth.js`](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/auth.js) (Admin authentication), [`js/crypto-util.js`](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/crypto-util.js) (Password hashing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Station operations"]
  node_app["Application controller<br/>[App.js]"]
  node_dashboard["Dashboard<br/>[App.js]"]
  node_orders["Sales and orders<br/>[App.js]"]
  node_customers["Customer accounts<br/>[App.js]"]
  node_inventory["Stock and containers<br/>[App.js]"]
  node_delivery["Delivery trips<br/>[App.js]"]
end

subgraph group_money["Cash and oversight"]
  node_cash["Expenses and closing<br/>[App.js]"]
  node_audit["Audit and backup<br/>[App.js]"]
end

subgraph group_security["Access security"]
  node_auth["Admin authentication<br/>[auth.js]"]
  node_crypto["Password hashing<br/>[crypto-util.js]"]
end

subgraph group_storage["Local persistence"]
  node_db["Database layer<br/>[db.js]"]
  node_sqlite["SQLite engine<br/>[sql-wasm.js]"]
  node_wasm["SQLite WebAssembly<br/>[sql-wasm.wasm]"]
  node_schema["Relational schema<br/>[schema.sql]"]
end

node_admin(("Administrator"))
node_browser["Browser workstation"]

node_admin -->|"uses"| node_app
node_app -->|"restores session"| node_auth
node_app -->|"reads and writes"| node_db
node_auth -->|"reads and updates"| node_db
node_auth -->|"hashes passwords"| node_crypto
node_app -.->|"renders"| node_dashboard
node_app -.->|"manages"| node_orders
node_app -.->|"manages"| node_customers
node_app -.->|"manages"| node_inventory
node_app -->|"reconciles"| node_delivery
node_app -->|"manages"| node_cash
node_app -->|"records"| node_audit
node_db -->|"initializes"| node_sqlite
node_db -.->|"defines tables"| node_schema
node_browser -.->|"runs"| node_app
node_db -->|"persists locally"| node_browser

click node_app "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_dashboard "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_orders "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_customers "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_inventory "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_delivery "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_cash "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_audit "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js"
click node_auth "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/auth.js"
click node_crypto "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/crypto-util.js"
click node_db "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/db.js"
click node_sqlite "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/sql-wasm.js"
click node_wasm "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/sql-wasm.wasm"
click node_schema "https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/schema.sql"

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_dashboard,node_orders,node_customers,node_inventory,node_delivery,node_browser toneBlue
class node_cash,node_audit toneAmber
class node_auth,node_crypto toneMint
class node_db,node_sqlite,node_wasm,node_schema toneRose
class node_admin toneIndigo
```

## Components

### Station operations

- [Application controller](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Dashboard](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Sales and orders](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Customer accounts](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Stock and containers](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Delivery trips](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`

### Cash and oversight

- [Expenses and closing](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`
- [Audit and backup](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/App.js): `js/App.js`

### Access security

- [Admin authentication](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/auth.js): `js/auth.js`
- [Password hashing](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/crypto-util.js): `js/crypto-util.js`

### Local persistence

- [Database layer](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/db.js): `js/db.js`
- [SQLite engine](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/sql-wasm.js): `js/sql-wasm.js`
- [SQLite WebAssembly](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/js/sql-wasm.wasm): `js/sql-wasm.wasm`
- [Relational schema](https://github.com/terragodnone17-dev/prototypemco-cs303-/blob/main/schema.sql): `schema.sql`

### Other components

- **Administrator**
- **Browser workstation**

## Connections

- Administrator → Application controller: uses (evidence: `README.md`)
- Application controller → Admin authentication: restores session (evidence: `js/App.js`)
- Application controller → Database layer: reads and writes (evidence: `js/App.js`)
- Admin authentication → Database layer: reads and updates (evidence: `js/auth.js`)
- Admin authentication → Password hashing: hashes passwords (evidence: `js/auth.js`)
- Application controller → Dashboard: renders (evidence: `js/App.js`)
- Application controller → Sales and orders: manages (evidence: `js/App.js`)
- Application controller → Customer accounts: manages (evidence: `js/App.js`)
- Application controller → Stock and containers: manages (evidence: `js/App.js`)
- Application controller → Delivery trips: reconciles (evidence: `js/App.js`)
- Application controller → Expenses and closing: manages (evidence: `js/App.js`)
- Application controller → Audit and backup: records (evidence: `js/App.js`)
- Database layer → SQLite engine: initializes (evidence: `js/db.js`)
- Database layer → Relational schema: defines tables
- Browser workstation → Application controller: runs
- Database layer → Browser workstation: persists locally (evidence: `js/db.js`)
