# hubertantoniewicz/cop5818-team10-stocklog architecture

> Architecture diagram of the GitHub repository hubertantoniewicz/cop5818-team10-stocklog, 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/hubertantoniewicz/cop5818-team10-stocklog
- Repository: https://github.com/hubertantoniewicz/cop5818-team10-stocklog

## Overview

StockLog is a beginner-investor portfolio tracker. Users add securities and manually maintained prices, record account-labeled buys and sells, then view transaction history and a calculated portfolio summary. The runtime divides into browser pages and shared API helpers, Express routing, portfolio calculations, and SQLite persistence. README-described capabilities are represented even where HTML, schema, and some source were not excerpted; those subsystems are linked only where the excerpts or README support the relationship.

Main entry points: [`db/database.js`](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/db/database.js) (SQLite database), [`server.js`](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/server.js) (Express server), [`public/js/api.js`](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/api.js) (API helpers), [`routes/portfolio.js`](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/portfolio.js) (Summary route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser app"]
  node_dashboard["Dashboard view<br/>[dashboard.js]"]
  node_transactions_ui["Transactions view<br/>[transactions.js]"]
  node_prices_ui["Prices view<br/>[prices.js]"]
  node_api_helpers["API helpers<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_server["Express server<br/>[server.js]"]
  node_securities_routes["Securities routes<br/>[securities.js]"]
  node_transactions_routes["Transaction routes<br/>[transactions.js]"]
  node_portfolio_routes["Summary route<br/>[portfolio.js]"]
end

subgraph group_domain["Portfolio domain"]
  node_summary_math["Portfolio calculations<br/>[portfolio.js]"]
end

subgraph group_storage["SQLite storage"]
  node_securities_store[("Securities records<br/>[securities.js]")]
  node_transactions_store[("Transaction records<br/>[transactions.js]")]
  node_sqlite[("SQLite database<br/>[database.js]")]
end

node_investor(("Investor"))

node_investor -->|"views"| node_dashboard
node_investor -->|"records trades"| node_transactions_ui
node_investor -->|"manages prices"| node_prices_ui
node_dashboard -->|"requests summary"| node_api_helpers
node_transactions_ui -->|"loads and submits"| node_api_helpers
node_prices_ui -->|"loads and updates"| node_api_helpers
node_api_helpers -.->|"sends JSON"| node_server
node_server -->|"mounts"| node_securities_routes
node_server -->|"mounts"| node_transactions_routes
node_server -->|"mounts"| node_portfolio_routes
node_securities_routes -->|"reads and writes"| node_sqlite
node_transactions_routes -->|"reads and writes"| node_sqlite
node_portfolio_routes -->|"loads prices and trades"| node_sqlite
node_portfolio_routes -->|"calculates summary"| node_summary_math
node_sqlite -.->|"stores"| node_securities_store
node_sqlite -.->|"stores"| node_transactions_store

click node_dashboard "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/dashboard.js"
click node_transactions_ui "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/transactions.js"
click node_prices_ui "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/prices.js"
click node_api_helpers "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/api.js"
click node_server "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/server.js"
click node_securities_routes "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/securities.js"
click node_transactions_routes "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/transactions.js"
click node_portfolio_routes "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/portfolio.js"
click node_summary_math "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/lib/portfolio.js"
click node_securities_store "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/securities.js"
click node_transactions_store "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/transactions.js"
click node_sqlite "https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/db/database.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_transactions_ui,node_prices_ui,node_api_helpers toneBlue
class node_server,node_securities_routes,node_transactions_routes,node_portfolio_routes toneAmber
class node_summary_math toneMint
class node_securities_store,node_transactions_store,node_sqlite toneRose
class node_investor toneIndigo
```

## Components

### Browser app

- [Dashboard view](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/dashboard.js): `public/js/dashboard.js`
- [Transactions view](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/transactions.js): `public/js/transactions.js`
- [Prices view](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/prices.js): `public/js/prices.js`
- [API helpers](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/public/js/api.js): `public/js/api.js`

### REST API

- [Express server](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/server.js): `server.js`
- [Securities routes](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/securities.js): `routes/securities.js`
- [Transaction routes](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/transactions.js): `routes/transactions.js`
- [Summary route](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/portfolio.js): `routes/portfolio.js`

### Portfolio domain

- [Portfolio calculations](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/lib/portfolio.js): `lib/portfolio.js`

### SQLite storage

- [Securities records](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/securities.js): `routes/securities.js`
- [Transaction records](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/routes/transactions.js): `routes/transactions.js`
- [SQLite database](https://github.com/hubertantoniewicz/cop5818-team10-stocklog/blob/main/db/database.js): `db/database.js`

### Other components

- **Investor**

## Connections

- Investor → Dashboard view: views (evidence: `README.md`)
- Investor → Transactions view: records trades (evidence: `README.md`)
- Investor → Prices view: manages prices (evidence: `README.md`)
- Dashboard view → API helpers: requests summary (evidence: `public/js/dashboard.js`)
- Transactions view → API helpers: loads and submits (evidence: `public/js/transactions.js`)
- Prices view → API helpers: loads and updates (evidence: `public/js/prices.js`)
- API helpers → Express server: sends JSON
- Express server → Securities routes: mounts (evidence: `server.js`)
- Express server → Transaction routes: mounts (evidence: `server.js`)
- Express server → Summary route: mounts (evidence: `server.js`)
- Securities routes → SQLite database: reads and writes (evidence: `routes/securities.js`)
- Transaction routes → SQLite database: reads and writes (evidence: `routes/transactions.js`)
- Summary route → SQLite database: loads prices and trades (evidence: `routes/portfolio.js`)
- Summary route → Portfolio calculations: calculates summary (evidence: `routes/portfolio.js`)
- SQLite database → Securities records: stores (evidence: `routes/securities.js`)
- SQLite database → Transaction records: stores (evidence: `routes/transactions.js`)
