# benrellick/day-progress architecture

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

- Interactive diagram: https://gitdiagram.com/benrellick/day-progress
- Repository: https://github.com/benrellick/day-progress

## Overview

##### Project’s Main Components
- User Interface Layer – Represented by index.html and styles.css. This is where all the UI elements (progress bar, stats, and theme settings) reside.
- JavaScript Application Logic – The src/suncalc.js file encapsulates the core logic: calculating the day’s progress, handling the live minute-to-minute updates, interacting with sunrise/sunset data, and processing query string parameters.
- Data Storage – Although there isn’t a dedicated backend, the app uses local storage (as noted in the README) to persist user-selected location data.
- External Services/Dependencies – While not part of a full API integration, the README references an external location API (and a potential Netlify function as a substitute) for location lookup purposes.

##### Depicting Relationships and Interactions
- That the UI (index.html) presents the progress bar and settings, while user interactions (changing the theme via query strings, specifying a location, etc.) trigger changes in the application state.
- That the JavaScript module (src/suncalc.js) acts as the controller which processes user inputs, computes time-related data (like sunrise and sunset adjustments), and updates the DOM accordingly.

##### Highlighting Architectural Patterns and Technologies
- The HTML/CSS play the role of the “View.”
- The JavaScript module (suncalc.js) acts as the “Controller” and also processes the “Model” (daytime data and user settings stored in local storage).
- Reliance on browser APIs: The app uses local storage and browser query string parsing.
- Use of standard web technologies (HTML, CSS, and vanilla JavaScript) without a heavy framework, which contributes to its simplicity and speed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UInteraction["User Interaction"]:::interaction

    subgraph "User Interface Layer"
        IndexHTML["index.html"]:::ui
        StylesCSS["styles.css"]:::ui
    end

    Logic["src/suncalc.js"]:::logic
    LocalStorage["Local Storage"]:::storage
    External["External Location Service"]:::external

    UInteraction -->|"triggers"| IndexHTML
    IndexHTML -->|"loads"| Logic
    Logic -->|"updates"| LocalStorage
    Logic -->|"calls"| External

    click IndexHTML "https://github.com/benrellick/day-progress/blob/master/index.html"
    click StylesCSS "https://github.com/benrellick/day-progress/blob/master/styles.css"
    click Logic "https://github.com/benrellick/day-progress/blob/master/src/suncalc.js"

    classDef ui fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef logic fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef storage fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef external fill:#ffdab9,stroke:#333,stroke-width:2px;
    classDef interaction fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
