# dsolonenko/financisto architecture

> Architecture diagram of the GitHub repository dsolonenko/financisto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dsolonenko/financisto
- Repository: https://github.com/dsolonenko/financisto

## Overview

##### Main Components Identification

The system should be divided into these key components:

a) User Interface Layer:
- Activities (under ru.orangesoftware.financisto.activity)
- Adapters (under ru.orangesoftware.financisto.adapter)
- Widgets (under ru.orangesoftware.financisto.widget)

b) Business Logic Layer:
- Model (under ru.orangesoftware.financisto.model)
- Services (under ru.orangesoftware.financisto.service)
- Utils (under ru.orangesoftware.financisto.utils)

c) Data Layer:
- Database (under ru.orangesoftware.financisto.db)
- Export/Import modules (under ru.orangesoftware.financisto.export)
- Backup system (under ru.orangesoftware.financisto.backup)

d) External Services:
- Exchange Rate Services (under ru.orangesoftware.financisto.rates)
- Cloud Storage (Dropbox, Google Drive)

##### Component Relationships

Following interactions:

a) Data Flow:
- UI → Business Logic → Database
- Export/Import → External Storage
- Exchange Rates → External Services

b) Key Processes:
- Transaction Management
- Budget Tracking
- Report Generation
- Backup/Restore
- Currency Exchange

##### Detailed Elements

Specific components:

a) Core Features:
- Transaction Manager
- Category Manager
- Budget Manager
- Account Manager
- Currency Manager
- Report Generator

b) Database Structure:
- Main SQLite Database
- Backup Database
- Exchange Rates Cache

c) External Integrations:
- Exchange Rate Services
- Cloud Backup Services
- QIF/CSV Import/Export

##### Architecture Patterns

Following patterns:

a) MVC Pattern:
- Activities as Controllers
- XML layouts as Views
- Model classes for data

b) Observer Pattern:
- For currency rate updates
- For transaction notifications

c) Builder Pattern:
- For complex object construction (visible in test builders)

##### Security Layer

Security components:
- PIN protection
- Backup encryption
- Secure storage

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef data fill:#90EE90,stroke:#333,stroke-width:2px
    classDef logic fill:#FFE5B4,stroke:#333,stroke-width:2px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef security fill:#FFB6C1,stroke:#333,stroke-width:2px

    %% UI Layer
    subgraph UI
        Activities["Activities"]:::ui
        Adapters["Adapters"]:::ui
        Widgets["Widgets"]:::ui
    end

    %% Business Logic Layer
    subgraph BusinessLogic
        Model["Model"]:::logic
        Services["Services"]:::logic
        Utils["Utils"]:::logic
        Reports["Reports"]:::logic
        RecurEngine["Recurrence Engine"]:::logic
        FilterSystem["Filter System"]:::logic
        GraphComp["Graph Components"]:::logic
    end

    %% Data Layer
    subgraph DataLayer
        Database[(Database)]:::data
        ExportImport["Export/Import"]:::data
        BackupSystem["Backup System"]:::data
        SQLScripts["SQL Scripts"]:::data
    end

    %% External Services
    subgraph External
        ExchangeRates>Exchange Rates]:::external
        CloudStorage>Cloud Storage]:::external
        subgraph CloudProviders
            Dropbox>Dropbox]:::external
            GoogleDrive>Google Drive]:::external
        end
    end

    %% Security Layer
    subgraph Security
        PinProtection["PIN Protection"]:::security
        BackupEncryption["Backup Encryption"]:::security
    end

    %% Relationships
    Activities --> Model
    Activities --> Services
    Adapters --> Model
    Widgets --> Model
    Model --> Database
    Services --> Database
    ExportImport --> CloudStorage
    BackupSystem --> CloudStorage
    Services --> ExchangeRates
    CloudStorage --> Dropbox
    CloudStorage --> GoogleDrive
    Database --> SQLScripts
    BackupSystem --> BackupEncryption
    Activities --> PinProtection

    %% Click Events
    click Activities "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/activity/"
    click Adapters "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/adapter/"
    click Widgets "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/widget/"
    click Model "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/model/"
    click Services "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/service/"
    click Utils "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/utils/"
    click Database "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/db/"
    click ExportImport "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/export/"
    click BackupSystem "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/backup/"
    click ExchangeRates "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/rates/"
    click Dropbox "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/export/dropbox/"
    click GoogleDrive "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/export/drive/"
    click Reports "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/report/"
    click RecurEngine "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/recur/"
    click FilterSystem "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/filter/"
    click GraphComp "https://github.com/dsolonenko/financisto/tree/master/app/src/main/java/ru/orangesoftware/financisto/graph/"
    click SQLScripts "https://github.com/dsolonenko/financisto/tree/master/app/src/main/assets/database/"
```
