# xernosz/dashcalc architecture

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

- Interactive diagram: https://gitdiagram.com/xernosz/dashcalc
- Repository: https://github.com/xernosz/dashcalc

## Overview

DashCalc is a browser-only delivery-earnings calculator and tracker. Drivers configure vehicle and tax inputs, enter an offer, review estimated costs and a grade, then optionally record the offer for later summaries and editing. The journal also supports backup and restore. The README documents privacy-focused local data and optional visit tracking; sampled code shows local storage and a GoatCounter image request. Page wiring is not shown, so links between page scripts and HTML entry points are not inferred.

Main entry points: [`offers.js`](https://github.com/xernosz/dashcalc/blob/main/offers.js) (Offer records), [`calculator.js`](https://github.com/xernosz/dashcalc/blob/main/calculator.js) (Offer calculator), [`shared.js`](https://github.com/xernosz/dashcalc/blob/main/shared.js) (Settings persistence), [`setup.js`](https://github.com/xernosz/dashcalc/blob/main/setup.js) (Vehicle setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_offers["Offer workflow"]
  node_setup["Vehicle setup<br/>[setup.js]"]
  node_calculator["Offer calculator<br/>[calculator.js]"]
end

subgraph group_journal["Journal and records"]
  node_offerrecords["Offer records<br/>[offers.js]"]
  node_journalview["Journal and summaries<br/>[journal.js]"]
  node_backup["Backup and restore<br/>[journal.js]"]
end

subgraph group_shared["Shared app services"]
  node_estimator["Cost and grade engine<br/>[shared.js]"]
  node_settings["Settings persistence<br/>[shared.js]"]
  node_browserstore[("Browser local storage")]
  node_theme["Theme and version display<br/>[theme.js]"]
end

subgraph group_engagement["Landing and measurement"]
  node_landing["Interactive landing page<br/>[front.js]"]
  node_visitcounter["Privacy-aware visit counter<br/>[counter.js]"]
end

node_driver(("Driver"))
node_counterservice["GoatCounter"]

node_driver -->|"sets vehicle"| node_setup
node_setup -->|"saves settings"| node_settings
node_setup -->|"loads settings"| node_settings
node_settings -->|"reads and writes"| node_browserstore
node_driver -->|"enters offer"| node_calculator
node_calculator -->|"loads settings"| node_settings
node_calculator -->|"evaluates offer"| node_estimator
node_calculator -->|"records decision"| node_offerrecords
node_offerrecords -->|"recalculates edits"| node_estimator
node_offerrecords -->|"loads settings"| node_settings
node_offerrecords -->|"reads and writes"| node_browserstore
node_journalview -->|"lists and edits"| node_offerrecords
node_journalview -->|"opens backup tools"| node_backup
node_backup -->|"imports records"| node_offerrecords
node_driver -->|"views example"| node_landing
node_landing -->|"evaluates example"| node_estimator
node_calculator -->|"dispatches offer changes"| node_visitcounter
node_visitcounter -->|"sends counts"| node_counterservice
node_visitcounter -->|"stores opt-out state"| node_browserstore
node_driver -.->|"switches theme"| node_theme

click node_setup "https://github.com/xernosz/dashcalc/blob/main/setup.js"
click node_calculator "https://github.com/xernosz/dashcalc/blob/main/calculator.js"
click node_estimator "https://github.com/xernosz/dashcalc/blob/main/shared.js"
click node_settings "https://github.com/xernosz/dashcalc/blob/main/shared.js"
click node_offerrecords "https://github.com/xernosz/dashcalc/blob/main/offers.js"
click node_journalview "https://github.com/xernosz/dashcalc/blob/main/journal.js"
click node_backup "https://github.com/xernosz/dashcalc/blob/main/journal.js"
click node_landing "https://github.com/xernosz/dashcalc/blob/main/front.js"
click node_theme "https://github.com/xernosz/dashcalc/blob/main/theme.js"
click node_visitcounter "https://github.com/xernosz/dashcalc/blob/main/counter.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_setup,node_calculator toneBlue
class node_offerrecords,node_journalview,node_backup toneAmber
class node_estimator,node_settings,node_browserstore,node_theme toneMint
class node_landing,node_visitcounter toneRose
class node_driver,node_counterservice toneIndigo
```

## Components

### Offer workflow

- [Vehicle setup](https://github.com/xernosz/dashcalc/blob/main/setup.js): `setup.js`
- [Offer calculator](https://github.com/xernosz/dashcalc/blob/main/calculator.js): `calculator.js`

### Journal and records

- [Offer records](https://github.com/xernosz/dashcalc/blob/main/offers.js): `offers.js`
- [Journal and summaries](https://github.com/xernosz/dashcalc/blob/main/journal.js): `journal.js`
- [Backup and restore](https://github.com/xernosz/dashcalc/blob/main/journal.js): `journal.js`

### Shared app services

- [Cost and grade engine](https://github.com/xernosz/dashcalc/blob/main/shared.js): `shared.js`
- [Settings persistence](https://github.com/xernosz/dashcalc/blob/main/shared.js): `shared.js`
- **Browser local storage**
- [Theme and version display](https://github.com/xernosz/dashcalc/blob/main/theme.js): `theme.js`

### Landing and measurement

- [Interactive landing page](https://github.com/xernosz/dashcalc/blob/main/front.js): `front.js`
- [Privacy-aware visit counter](https://github.com/xernosz/dashcalc/blob/main/counter.js): `counter.js`

### Other components

- **Driver**
- **GoatCounter**

## Connections

- Driver → Vehicle setup: sets vehicle (evidence: `README.md`)
- Vehicle setup → Settings persistence: saves settings (evidence: `setup.js`)
- Vehicle setup → Settings persistence: loads settings (evidence: `setup.js`)
- Settings persistence → Browser local storage: reads and writes (evidence: `shared.js`)
- Driver → Offer calculator: enters offer (evidence: `README.md`)
- Offer calculator → Settings persistence: loads settings (evidence: `calculator.js`)
- Offer calculator → Cost and grade engine: evaluates offer (evidence: `calculator.js`)
- Offer calculator → Offer records: records decision (evidence: `calculator.js`)
- Offer records → Cost and grade engine: recalculates edits (evidence: `offers.js`)
- Offer records → Settings persistence: loads settings (evidence: `offers.js`)
- Offer records → Browser local storage: reads and writes (evidence: `offers.js`)
- Journal and summaries → Offer records: lists and edits (evidence: `journal.js`)
- Journal and summaries → Backup and restore: opens backup tools (evidence: `journal.js`)
- Backup and restore → Offer records: imports records (evidence: `journal.js`)
- Driver → Interactive landing page: views example (evidence: `README.md`)
- Interactive landing page → Cost and grade engine: evaluates example (evidence: `front.js`)
- Offer calculator → Privacy-aware visit counter: dispatches offer changes (evidence: `calculator.js`)
- Privacy-aware visit counter → GoatCounter: sends counts (evidence: `counter.js`)
- Privacy-aware visit counter → Browser local storage: stores opt-out state (evidence: `counter.js`)
- Driver → Theme and version display: switches theme
