# jmancentral/finazapp architecture

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

- Interactive diagram: https://gitdiagram.com/jmancentral/finazapp
- Repository: https://github.com/jmancentral/finazapp

## Overview

##### Project Type & Purpose
- This is an Android mobile app (note the AndroidManifest.xml, gradle configuration files, and Android resource directories) with a focus on financial management (“finazapp” appears in package names).
- The project seems to manage financial entities such as expenses (“Gasto”), incomes (“Ingreso”), user data (“Usuario”), and other financial features (e.g., alerts, reports, dashboards).

##### Analyzing the File Structure
- The project is organized under an “app” directory with modular layers:
- Build & configuration: build.gradle.kts, proguard-rules.pro.
- Source code (“src/main/java”): Follows package “com.practica.finazapp” and is further divided into subpackages:
◦ DAOS: Contains classes relating to database access components for various entities.
◦ Entidades: Holds the definitions of the core domain models.
◦ Repositorios: Implements repositories for managing data (alerts, expenses, incomes, users).
◦ ViewModel: Contains view model classes, likely following the MVVM pattern which is popular in Android.
◦ Vista: Contains UI components such as Activities, Fragments, Adapters, and Listeners which together constitute the user interface.
◦ ui/Estilos: Houses styling resources and classes.
- Other standard directories for resources (layouts, drawables, menus, values, etc.) and tests are also present.

##### Key Components
a. UI Layer (Vista):
- Activities (e.g., MainActivity, Login, Registro, Dashboard).
- Fragments (e.g., FragmentAlertas, FragmentCategorias, FragmentDashboard, etc.)
- UI Adapters and Listeners.
b. ViewModel Layer:
- Classes like AlertaViewModel, GastosViewModel, IngresoViewModel, UsuarioViewModel, and a SharedViewModel.
- This layer acts as a mediator between the UI and the business/data layers.
c. Repository Layer:
- Repositories such as AlertaRepository, GastoRepository, IngresoRepository, UsuarioRepository.
- They encapsulate the business logic and data retrieval strategies, and communicate with DAO and data sources.
d. Data Access Layer (DAOS & Schemas):
- DAOS classes (AppDatabase.kt, CategoriaTotal.kt, etc.) and JSON schema files which define the database.
- Likely representing the local SQLite or other persistence solution.
e. External Dependencies:
- Third-party libraries such as the “hellocharts-library” for UI/charting needs.
- Gradle configuration files indicate dependency management and build scripts.

##### Relationships and Interactions
- The UI components (Activities/Fragments) interact with corresponding ViewModels.
- ViewModels fetch/manage data via Repository classes.
- Repositories communicate with DAOs to perform data CRUD operations against the underlying database.
- Schemas indicate the mapping and versioning of your database structure that DAOs rely on.
- External libraries (like hellocharts) are used by the UI for enhanced functionality.

##### Architectural Patterns Highlighted
- Model-View-ViewModel (MVVM): Clear separation of UI (Vista) and business logic (ViewModel).
- Repository Pattern: Data access is abstracted through various repositories.
- Data Access Object (DAO) pattern: DAOS interact with the database layer.
- Modular separation of concerns is achieved through distinct packages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        UI["Activities/Fragments/Adapters/Listeners"]:::ui
    end

    subgraph "ViewModel Layer"
        VM["ViewModels (MVVM)"]:::viewModel
    end

    subgraph "Repository Layer"
        REP["Repositories"]:::repository
    end

    subgraph "Data Layer"
        DAOS["DAOs"]:::data
        DS["Database Schema Definitions"]:::data
    end

    EX["HelloCharts Library"]:::external

    UI -->|"interacts"| VM
    VM -->|"fetches_data_from"| REP
    REP -->|"CRUD_ops_on"| DAOS
    DAOS -->|"based_on"| DS
    UI -->|"renders_charts_using"| EX

    click UI "https://github.com/jmancentral/finazapp/tree/master/app/src/main/java/com/practica/finazapp/Vista"
    click VM "https://github.com/jmancentral/finazapp/tree/master/app/src/main/java/com/practica/finazapp/ViewModel"
    click REP "https://github.com/jmancentral/finazapp/tree/master/app/src/main/java/com/practica/finazapp/Repositorios"
    click DAOS "https://github.com/jmancentral/finazapp/tree/master/app/src/main/java/com/practica/finazapp/DAOS"
    click DS "https://github.com/jmancentral/finazapp/blob/master/app/schemas/com.practica.finazapp.AppDatabase"
    click EX "https://github.com/jmancentral/finazapp/blob/master/app/libs/hellocharts-library-1.5.8.jar"

    classDef ui fill:#ffebcc,stroke:#333,stroke-width:2px;
    classDef viewModel fill:#cfe2f3,stroke:#333,stroke-width:2px;
    classDef repository fill:#d9ead3,stroke:#333,stroke-width:2px;
    classDef data fill:#ead1dc,stroke:#333,stroke-width:2px;
    classDef external fill:#fff2cc,stroke:#333,stroke-width:2px;
```
