# adt109119/jijun architecture

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

- Interactive diagram: https://gitdiagram.com/adt109119/jijun
- Repository: https://github.com/adt109119/jijun

## Overview

##### Project type and purpose
- This is a purely front-end, offline-first Progressive Web App (PWA) for personal expense tracking (“輕鬆記帳 2.0”).
- It uses native HTML/CSS/JS (no framework), Tailwind CSS, Chart.js, Font Awesome, IndexedDB for storage, and a Service Worker for caching and updates.

##### File structure
- src/
– index.html → entry point
– css/main.css → Tailwind-generated styling
– js/ → modular features: main.js (controller/initializer), dataService.js (storage abstraction), budgetManager.js, categoryManager.js, recordsList.js, statistics.js, datePickerModal.js, changelog.js, quickSelectManager.js, utils.js
- public/
– manifest.json → PWA metadata
– serviceWorker.js → caching & update logic
- index.html, manifest.json, sitemap.txt, public/.well-known → deployment artifacts
- vite.config.js, package.json, ESLint & Prettier configs → build & dev environment

##### README for additional insights
- Architecture is client-only, structured in “modules” that map to feature areas (UI views, data storage, utilities).
- Emphasizes offline support, smart caching, automatic IndexedDB migration, data export/import, and PWA update flow.

– Blue for UI/presentation
– Green for data/storage
– Orange for PWA/caching
– Purple for external libraries

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Browser
    subgraph "User & Browser"
        User["User"]:::external
        Browser["Browser Runtime"]:::external
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        HTML["index.html"]:::frontend
        CSS["main.css"]:::frontend
    end

    %% Application Logic Layer
    subgraph "Application Logic Layer"
        Main["main.js"]:::frontend
        Quick["quickSelectManager.js"]:::frontend
        Budget["budgetManager.js"]:::frontend
        Category["categoryManager.js"]:::frontend
        Records["recordsList.js"]:::frontend
        Stats["statistics.js"]:::frontend
        Changelog["changelog.js"]:::frontend
        DatePicker["datePickerModal.js"]:::frontend
        Utils["utils.js"]:::frontend
    end

    %% Data Layer
    subgraph "Data Layer"
        DataService["dataService.js"]:::data
        IndexedDB[(IndexedDB)]:::data
        LocalStorage[(localStorage)]:::data
    end

    %% PWA Runtime
    subgraph "PWA Runtime"
        SW["Service Worker"]:::pwa
        Manifest["Web App Manifest"]:::pwa
    end

    %% External Libraries
    subgraph "External Libraries"
        ChartJS["Chart.js"]:::ext
        FontAwesome["Font Awesome"]:::ext
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        Vite["vite.config.js"]:::config
        NPM["package.json"]:::config
    end

    %% Connections
    User --> Browser
    Browser --> HTML
    HTML --> CSS
    HTML --> Main
    Main --> Quick
    Main --> Budget
    Main --> Category
    Main --> Records
    Main --> Stats
    Main --> Changelog
    Main --> DatePicker
    Main --> Utils

    Quick --> DataService
    Budget --> DataService
    Category --> DataService
    Records --> DataService
    Stats --> DataService
    Changelog --> DataService
    DatePicker --> DataService
    Utils --> DataService

    DataService --> IndexedDB
    DataService --> LocalStorage

    Browser --> SW
    SW -->|caches/serves assets| HTML
    SW -->|caches/serves assets| CSS
    SW -->|caches/serves assets| Main

    Manifest --> Browser
    Stats --> ChartJS
    Category --> FontAwesome

    Vite --> Main
    Vite --> CSS
    Vite --> HTML
    NPM --> Vite

    %% Click Events
    click HTML "https://github.com/adt109119/jijun/blob/main/src/index.html"
    click CSS "https://github.com/adt109119/jijun/blob/main/src/css/main.css"
    click Main "https://github.com/adt109119/jijun/blob/main/src/js/main.js"
    click Quick "https://github.com/adt109119/jijun/blob/main/src/js/quickSelectManager.js"
    click Budget "https://github.com/adt109119/jijun/blob/main/src/js/budgetManager.js"
    click Category "https://github.com/adt109119/jijun/blob/main/src/js/categoryManager.js"
    click Records "https://github.com/adt109119/jijun/blob/main/src/js/recordsList.js"
    click Stats "https://github.com/adt109119/jijun/blob/main/src/js/statistics.js"
    click Changelog "https://github.com/adt109119/jijun/blob/main/src/js/changelog.js"
    click DatePicker "https://github.com/adt109119/jijun/blob/main/src/js/datePickerModal.js"
    click DataService "https://github.com/adt109119/jijun/blob/main/src/js/dataService.js"
    click Utils "https://github.com/adt109119/jijun/blob/main/src/js/utils.js"
    click Manifest "https://github.com/adt109119/jijun/blob/main/public/manifest.json"
    click SW "https://github.com/adt109119/jijun/blob/main/public/serviceWorker.js"
    click Vite "https://github.com/adt109119/jijun/blob/main/vite.config.js"
    click NPM "https://github.com/adt109119/jijun/blob/main/package.json"

    %% Styles
    classDef frontend fill:#cfe2f3,stroke:#2a5783,stroke-width:1px;
    classDef data fill:#d9ead3,stroke:#38761d,stroke-width:1px;
    classDef pwa fill:#f9cb9c,stroke:#b45f06,stroke-width:1px;
    classDef ext fill:#e1d5e7,stroke:#5f497a,stroke-width:1px;
    classDef config fill:#f2f2f2,stroke:#7a7a7a,stroke-width:1px;
    classDef external fill:#ffffff,stroke:#000000,stroke-width:1px;
```
