# yusuke-rakus/moneyhook-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/yusuke-rakus/moneyhook-mobile
- Repository: https://github.com/yusuke-rakus/moneyhook-mobile

## Overview

##### Main Components
- Mobile Client (Flutter App): This is the central part of the project, with all the common code in the lib directory. It is structured into submodules including components, organisms, views, screens, modals, and various helper classes.
- Presentation/UI Layer: Represent the screens (homeScreen, timelineScreen, analysis, login, etc.), widgets, and custom components (e.g., custom buttons, charts, accordions) under lib/src/components, lib/src/organisms, and lib/src/screens. These constitute the front-end user interaction elements.
- Domain/Business Logic Layer: Include the classes under lib/src/class (which model categories, transactions, users, responses, etc.) along with environmental configurations (lib/src/env) and any utilities that handle authentication (e.g., Google sign-in).
- Platform-Specific Layers: Represent the native code in the android and ios directories that allow the Flutter code to interface with native functionalities (including platform-specific configuration files, manifests, and Gradle or Xcode projects). Optionally, include the web folder to show multi-platform support.
- External Services and Configurations: Note the Firebase configuration files (firebase.json and the GitHub workflow for Firebase deploy) as a backend/deployment/service element if the app uses Firebase for hosting, authentication, or analytics.

##### Relationships and Interactions
- How configuration and environment classes (e.g., in lib/src/env) feed into shaping API interactions (like GoogleSignIn) and possibly into the authentication flow.

##### Architectural Patterns & Design Principles
- Separation of concerns – clearly delineate the UI components from business logic and data handling, which is in line with common patterns like MVVM or Clean Architecture.
- That the system is modularized: every module such as “login”, “transaction handling”, “data analysis”, and “savings calculation” has its dedicated code structure making it easier to extend or modify independently.
- That validation logic is kept separate (in the lib/src/api/validation directory) to ensure robust data processing and error handling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Client (Flutter App) and its Layers
    subgraph "Mobile Client (Flutter App)"
        MOBILE["Mobile Client"]:::flutter
        subgraph "Presentation/UI Layer"
            SCREENS["Screens"]:::ui
            COMPONENTS["Components/Widgets"]:::ui
            ORGANISMS["Organisms"]:::ui
            MODALS["Modals"]:::ui
        end
        subgraph "Domain/Business Logic"
            BUSINESS["Business Classes"]:::domain
            ENV["Env & Utilities"]:::domain
        end
        subgraph "Data Access Layer"
            API["API Modules"]:::data
            VALIDATION["Validation"]:::data
            LOADERS["Data Loaders"]:::data
            SEARCH["Search Storage"]:::data
        end
        MOBILE -->|"direct call"| SCREENS
        MOBILE -->|"direct call"| COMPONENTS
        MOBILE -->|"direct call"| ORGANISMS
        MOBILE -->|"direct call"| MODALS
        MOBILE -->|"logic"| BUSINESS
        MOBILE -->|"logic"| ENV
        MOBILE -->|"data fetch"| API
        MOBILE -->|"validation"| VALIDATION
        MOBILE -->|"data load"| LOADERS
        MOBILE -->|"search"| SEARCH
    end

    %% Relationships between Layers
    SCREENS -->|"userEvents"| BUSINESS
    COMPONENTS -->|"userActions"| BUSINESS
    ORGANISMS -->|"aggregateEvents"| SCREENS
    MODALS -->|"userInput"| BUSINESS

    BUSINESS -->|"submitData"| API
    ENV -->|"configures"| API
    BUSINESS -->|"loadTransactions"| LOADERS
    BUSINESS -->|"queryData"| SEARCH

    API -->|"externalCalls"| VALIDATION
    API -->|"firebaseIntegration"| firebase

    %% Platform-Specific Layers
    subgraph "Platform-Specific"
        ANDROID["Android"]:::platform
        IOS["iOS"]:::platform
        WEB["Web"]:::platform
    end
    MOBILE ---|"bridges"| ANDROID
    MOBILE ---|"bridges"| IOS
    MOBILE ---|"bridges"| WEB
    ANDROID ---|"nativeBridge"| MOBILE
    IOS ---|"nativeBridge"| MOBILE
    WEB ---|"nativeBridge"| MOBILE

    %% External Services
    subgraph "External Services"
        firebase["Firebase Config"]:::external
    end

    %% Asset Management
    subgraph "Asset Management"
        ASSETS["Assets & Images"]:::assets
    end
    ASSETS ---|"usedBy"| SCREENS
    ASSETS ---|"usedBy"| COMPONENTS
    ASSETS ---|"usedBy"| MODALS

    %% Click Events
    click MOBILE "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/"
    click SCREENS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/screens"
    click COMPONENTS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/components"
    click ORGANISMS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/organisms"
    click MODALS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/modals"
    click BUSINESS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/class"
    click ENV "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/env"
    click API "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/api"
    click VALIDATION "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/api/validation"
    click LOADERS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/dataLoader"
    click SEARCH "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/lib/src/searchStorage"
    click ANDROID "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/android/"
    click IOS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/ios/"
    click WEB "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/web/"
    click firebase "https://github.com/yusuke-rakus/moneyhook-mobile/blob/master/firebase.json"
    click ASSETS "https://github.com/yusuke-rakus/moneyhook-mobile/tree/master/assets/"

    %% Styles
    classDef flutter fill:#f4a582,stroke:#000,stroke-width:2px;
    classDef ui fill:#aed581,stroke:#000,stroke-width:2px;
    classDef domain fill:#81d4fa,stroke:#000,stroke-width:2px;
    classDef data fill:#ffcc80,stroke:#000,stroke-width:2px;
    classDef platform fill:#ce93d8,stroke:#000,stroke-width:2px;
    classDef external fill:#ffab91,stroke:#000,stroke-width:2px;
    classDef assets fill:#e6ee9c,stroke:#000,stroke-width:2px;
```
