# freightcognition/openquote architecture

> Architecture diagram of the GitHub repository freightcognition/openquote, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/freightcognition/openquote
- Repository: https://github.com/freightcognition/openquote

## Overview

##### Project type and purpose
- openQuote is an open-source Chromium browser extension used by freight brokers to generate spot quotes quickly.
- All code runs client-side in the browser: HTML/CSS for UI, JavaScript for logic and configuration.

##### File structure
- Top-level files:
- manifest.json – extension metadata and entry points
- sidepanel.html – the popup/side panel UI
- styles.css – styling for the UI
- calculator.js – core quoting logic
- settings.js – user preferences and persistence
- No backend or database directories; it is a purely client-side tool.
- .gitignore, LICENSE, README.md – repo metadata and docs.

##### README for additional insights
- Confirms it is a Chromium extension built with HTML/CSS/JS.
- No mention of server APIs, so assume all calculation happens locally.
- Extensible via open-source contributions; key integration point is the Chrome Extension API.

##### Main components and their interactions
a. Browser runtime (Chromium)
b. Extension configuration (manifest.json)
d. Business Logic (calculator.js)
e. Settings & Persistence (settings.js using chrome.storage)
f. Chrome Extension APIs (chrome.runtime, chrome.storage, chrome.browserAction)
g. (Optional) External freight-broker API or data sources, if added later

Relationships and data flow:
- Browser loads the extension per manifest.json.
- UI components collect input and invoke functions in calculator.js.
- calculator.js may read/write user preferences via settings.js (chrome.storage).
- Results are pushed back into the UI for display.
- If integrated, calculator.js could call external REST endpoints (external service) for live rate data.

##### Architectural patterns and design principles
- Modular separation: UI vs. business logic vs. settings.
- Single-page panel design for minimal overhead.
- Configuration via manifest.json and chrome.* APIs.
- Extensibility: static assets and scripts can be swapped or extended.

##### Elements to include for clarity
- A note callout for manifest.json to indicate entry points (popup, permissions).
- An area showing the Chrome Extension API boundary.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Chromium Browser" 
        class chromeContainer chrome
        browser_icon["Browser Icon"]:::chrome
        subgraph "openQuote Extension"
            manifest["Manifest (manifest.json)"]:::config
            subgraph "UI Layer"
                ui_html["sidepanel.html"]:::ui
                ui_styles["styles.css"]:::ui
                ui_fonts["fonts"]:::ui
                ui_icons["icons"]:::ui
            end
            logic["calculator.js"]:::logic
            settings["settings.js"]:::config
        end
    end

    external_api["External Freight API"]:::external

    browser_icon -->|"loads extension"| manifest
    browser_icon -->|"click icon"| ui_html
    ui_html -->|"input events"| logic
    logic -->|"chrome.storage.get/set"| settings
    logic -->|"display results"| ui_html
    logic -->|"HTTP request/response"| external_api

    click manifest "https://github.com/freightcognition/openquote/blob/main/manifest.json"
    click ui_html "https://github.com/freightcognition/openquote/blob/main/sidepanel.html"
    click ui_styles "https://github.com/freightcognition/openquote/blob/main/styles.css"
    click ui_fonts "https://github.com/freightcognition/openquote/tree/main/fonts/"
    click ui_icons "https://github.com/freightcognition/openquote/tree/main/icons/"
    click logic "https://github.com/freightcognition/openquote/blob/main/calculator.js"
    click settings "https://github.com/freightcognition/openquote/blob/main/settings.js"

    classDef ui fill:#cce5ff,stroke:#004085
    classDef logic fill:#d4edda,stroke:#155724
    classDef config fill:#e2e3e5,stroke:#6c757d
    classDef chrome fill:#fff3cd,stroke:#856404
    classDef external fill:#f8f9fa,stroke:#6c757d,stroke-dasharray:5 5
```
