# santioch/expenses architecture

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

- Interactive diagram: https://gitdiagram.com/santioch/expenses
- Repository: https://github.com/santioch/expenses

## Overview

- Main Application ("Expenses"):
- Interface & Views: Represented by the Views directory (e.g., CardView, ChartTabView, CustomTextField, FaceIDLock, etc.). These are the screens and components the user interacts with.
- Business Logic & Models: Found in the Model folder (e.g., Transaction, Category, ChartGroup, TintColor) and Helpers folder (DateExtensions, TransactionSortOption, ViewExtensions). These modules handle the underlying data structures and business logic.
- App Coordination and Configuration: The ExpensesApp.swift file (entry point) and Info.plist indicate app initialization, configuration (like entitlements), and navigation flow.
- Widget Extension ("ExpensesWidget"):
- Standalone Widget Code: The ExpensesWidget directory contains its own assets, Swift files, and Info.plist. This extension displays a summary (or selected aspects) of the main expense data.
- Security/Biometric Authentication:
- Specialized Component: The FaceIDLock sub-folder details a custom Face ID/Touch ID mechanism to lock the app when necessary. This includes LockView and SecurityManager.

- Within the main application block, break it down further into:
- User Interface Layer (Views): This layer interacts with the user, capturing input (new expenses, filter/sort requests, etc.) and presenting outputs (expense lists, charts, search results).
- Business Logic / Models: The Model and Helpers layers encapsulate the core application logic such as managing transactions, categorizing expenses, sorting/filtering, and handling date formats.
- Security Layer: Represent the FaceID/TouchID components that safeguard sensitive data.
- Data flow between these components. For example:
- User actions in the Views trigger events that flow into business logic/model classes.
- Filtered or sorted expense data is returned to the view for rendering.
- Assets management (Assets.xcassets) being a shared resource for UI styling in both the main app and widget.

##### Architectural patterns and design principles
- Modularity: Each major feature (expense management, biometric lock, widget summary) is encapsulated in its own module or set of files.

##### Specific technologies and frameworks
- Swift is the programming language, and UIKit/SwiftUI is likely used for the user interface (given the .swift files and asset catalogs).
- Biometric authentication is integrated using Face ID/Touch ID APIs.
- The widget is implemented per iOS WidgetKit architecture, as indicated by the separate widget target.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Main Application"
        UI["Interface & Views"]:::views
        logic["Business Logic & Models"]:::logic
        config["App Coordination & Configuration"]:::config
        assets["Assets & Resources"]:::assets
        security["Biometric Lock Module"]:::security
    end

    subgraph "Widget Extension"
        widget["Widget Extension"]:::widget
    end

    UI -->|"triggers"| logic
    logic -->|"rendersData"| UI
    config -->|"initializes"| UI
    config -->|"initializes"| logic
    assets -->|"providesAssets"| UI
    assets -->|"providesAssets"| widget
    UI -->|"integrates"| security
    logic -->|"sharesData"| widget

    click UI "https://github.com/santioch/expenses/tree/main/Expenses/Views"
    click logic "https://github.com/santioch/expenses/tree/main/Expenses/Model and Expenses/Helpers"
    click config "https://github.com/santioch/expenses/blob/main/Expenses/ExpensesApp.swift"
    click assets "https://github.com/santioch/expenses/blob/main/Expenses/Assets.xcassets"
    click security "https://github.com/santioch/expenses/tree/main/Expenses/Views/FaceIDLock"
    click widget "https://github.com/santioch/expenses/tree/main/ExpensesWidget"

    classDef views fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef logic fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef config fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef assets fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef widget fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef security fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
