# cassidoo/todometer architecture

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

- Interactive diagram: https://gitdiagram.com/cassidoo/todometer
- Repository: https://github.com/cassidoo/todometer

## Overview

##### Project type and purpose
- This is a desktop‐only, full‐stack Electron application that bundles a React based UI (the “renderer” process) together with a Node/Electron “main” process and a “preload” script to safely bridge between them.
- Purpose: a simple meter‐based to-do list that persists data locally (via browser localStorage or file) and can fire reminder notifications.

##### File structure
- Top‐level directories:
- src/main – Electron’s Main process code (creates BrowserWindow, handles app events)
- src/preload – Electron Preload script (exposes a controlled IPC API to the renderer)
- src/renderer – React application (UI, components, state, styling, hooks)
- src/scripts – build and watch scripts for packaging and hot‐reload
- Config files:
- vite.config.js in main, preload, and renderer subfolders—each bundling code for its respective process
- package.json with scripts for dev vs. production, packaging (electron‐pack)
- Tests: a single App.test.jsx for smoke testing of core UI

##### Key insights from README
- Uses Electron + React + Vite
- Development flow: “npm run dev” spawns the Electron shell with hot‐reload
- Packaging flow: postinstall + pre‐electron-pack + electron-pack to produce distributables for Windows/Mac/Linux

## Diagram (Mermaid)

```mermaid
graph TD
    %% Electron Processes
    subgraph "Electron Processes"
        Main["Electron Main Process"]:::main
        Preload["Electron Preload Script"]:::preload
        subgraph "Renderer Process"
            Renderer["React Renderer Process"]:::renderer
            subgraph "Renderer Files"
                MainJS["main.jsx"]:::renderer
                Template["index.html"]:::renderer
                Components["UI Components"]:::renderer
                Hooks["Custom Hooks"]:::renderer
                AppShell["App.jsx & Context"]:::renderer
                LocalStorageFile["local-storage.js"]:::renderer
                NotificationAssets["Notification Assets"]:::renderer
                Styling["Styling & CSS"]:::renderer
                Test["UI Smoke Test"]:::renderer
            end
        end
    end

    %% Persistence & External Services
    subgraph "Persistence & OS Services"
        LocalStorage["Browser localStorage"]:::external
        OSNotif["OS Notification Service"]:::external
        FileSys["File System"]:::external
    end

    %% Build & Packaging Pipeline
    subgraph "Build & Packaging Pipeline"
        ViteMain["Main Vite Config"]:::build
        VitePreload["Preload Vite Config"]:::build
        ViteRend["Renderer Vite Config"]:::build
        Scripts["Build & Watch Scripts"]:::build
        Package["Packaging (electron-pack)"]:::build
    end

    %% Runtime Flows
    Main -->|launchWindow| Renderer
    Renderer -->|window.api calls| Preload
    Preload -->|IPC channels| Main
    Main -->|Notification API| OSNotif
    Renderer -->|localStorage read/write| LocalStorage
    Main -->|filesystem access| FileSys

    %% Build Flows
    ViteMain -->|bundles| Main
    VitePreload -->|bundles| Preload
    ViteRend -->|bundles| Renderer
    ViteMain --> Scripts
    VitePreload --> Scripts
    ViteRend --> Scripts
    Scripts --> Package
    Package -->|distributable| Main
    Package -->|distributable| Preload
    Package -->|distributable| Renderer

    %% Click Events
    click Main "https://github.com/cassidoo/todometer/blob/main/src/main/index.js"
    click ViteMain "https://github.com/cassidoo/todometer/blob/main/src/main/vite.config.js"
    click Preload "https://github.com/cassidoo/todometer/blob/main/src/preload/index.js"
    click VitePreload "https://github.com/cassidoo/todometer/blob/main/src/preload/vite.config.js"
    click MainJS "https://github.com/cassidoo/todometer/blob/main/src/renderer/src/main.jsx"
    click Template "https://github.com/cassidoo/todometer/blob/main/src/renderer/index.html"
    click ViteRend "https://github.com/cassidoo/todometer/blob/main/src/renderer/vite.config.js"
    click Components "https://github.com/cassidoo/todometer/tree/main/src/renderer/src/components/"
    click Hooks "https://github.com/cassidoo/todometer/tree/main/src/renderer/src/hooks/"
    click AppShell "https://github.com/cassidoo/todometer/blob/main/src/renderer/src/App.jsx"
    click LocalStorageFile "https://github.com/cassidoo/todometer/blob/main/src/renderer/src/local-storage.js"
    click NotificationAssets "https://github.com/cassidoo/todometer/tree/main/src/renderer/src/notification/"
    click Styling "https://github.com/cassidoo/todometer/blob/main/src/renderer/src/index.css"
    click Test "https://github.com/cassidoo/todometer/blob/main/src/renderer/src/App.test.jsx"
    click Scripts "https://github.com/cassidoo/todometer/tree/main/src/scripts/"
    click Package "https://github.com/cassidoo/todometer/blob/main/package.json"

    %% Styles
    classDef main fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef preload fill:#b3e6b3,stroke:#333,stroke-width:1px
    classDef renderer fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef external fill:#ffcc99,stroke:#333,stroke-width:1px
    classDef build fill:#e0e0e0,stroke:#333,stroke-width:1px
```
