# brunocarvalhs/paguei architecture

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

- Interactive diagram: https://gitdiagram.com/brunocarvalhs/paguei
- Repository: https://github.com/brunocarvalhs/paguei

## Overview

##### Project Type & Purpose
- Paguei is an Android application designed to centralize and organize bills and expenses. Users can register/login (via email/password or Google), add expenses/invoices, later share costs with others, and eventually view them by month, category, or payer.
- The multi-module structure and naming conventions (e.g., features, data, domain, commons) indicate a modular, Clean Architecture/MVVM or multi-layered project.

##### Main Components to Identify
a. Application Layer:
– The “app” module acts as the entry point of the application. It contains the AndroidManifest, application class (PagueiApplication.kt), and overall configuration specific to the Android platform.
b. Domain Layer:
– The “domain” module contains business logic, core entities (CostEntities, GroupEntities, UserEntities), use cases, and repository interfaces. This layer encapsulates the core business rules.
– It also provides interfaces for external services (e.g., Authentication, Analytics, Notification, SessionManager, UpdateVersion) and use cases for each feature (auth, cost, group, report, etc.).
c. Data Layer:
– The “data” module provides the implementation of the repository interfaces declared in the domain layer. It contains DI modules (DataModule, RepositoryModule, ServiceModule, UseCaseModule) and service implementations (AdsServiceImpl, AnalyticsServiceImpl, etc.).
– Data conversion models and integration with potential backend systems (or local storage) are likely performed here.
d. Features:
– Under the “features” directory, each submodule (auth, billet_registration, calculation, check_list, costs, extracts, groups, profile, report, splash) corresponds to a distinct feature.
– Each feature module includes its own presentation layer (fragments, view models, views, UI components, layouts, navigation, etc.) and sometimes its own DI configurations.
– They are designed using MVVM principles (with ViewModel, ViewState, and Fragment/View components).
e. Commons:
– The “commons” module hosts shared components, base activities/fragments, view models, utilities, themes, and components used across multiple features.
f. Build & Configuration:
– Various build configuration files (Gradle scripts at the root, gradle folder, buildSrc, .github workflows) indicate that this project relies on CI, automated tests, and possibly code quality/enforcement via Danger.
– The CI/CD pipelines and versioning (VERSION.md) are also part of the overall ecosystem.

##### Relationships and Interactions
- The App module serves as a container that ties together the feature modules, commons, domain, and data layers.
- Each feature module handles its own UI and local navigation. They invoke use cases from the domain layer.
- The domain layer coordinates the business logic and makes calls to repository interfaces, which are implemented in the data layer.
- The data layer manages data sources (could be local or remote) and services (e.g., ads, analytics, notifications) and provides dependency injection (using modules found in “data/di”, “buildSrc” or in individual modules).
- Shared utilities and components are centralized in “commons” to reduce duplication.

##### Important Architectural Patterns & Principles
- Clean Architecture: Separation among Data, Domain, and Presentation (features) layers.
- MVVM (Model–View–ViewModel): Evident in the presence of ViewModel classes, ViewState handling, and Fragment-based UI.
- Dependency Injection: Use of DI modules and separation of interface and implementation in domain and data.
- Modularization: Each feature resides in its own module giving clear boundaries and promoting scalability and isolatability.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Application Layer"
        A["App Module (PagueiApplication)"]:::app
    end

    subgraph "Features Layer"
        F1["Auth"]:::feature
        F2["Billet Registration"]:::feature
        F3["Calculation"]:::feature
        F4["Check List"]:::feature
        F5["Costs"]:::feature
        F6["Extracts"]:::feature
        F7["Groups"]:::feature
        F8["Profile"]:::feature
        F9["Report"]:::feature
        F10["Splash"]:::feature
    end

    subgraph "Domain Layer"
        D["Domain (Entities, Use Cases, Repo Interfaces)"]:::domain
    end

    subgraph "Data Layer"
        DA["Data (Repository Impl, DI Modules, Services)"]:::data
        DI["DI Modules"]:::data
    end

    subgraph "Commons Layer"
        C["Commons (Shared Components & Utilities)"]:::commons
    end

    subgraph "Build & Configuration"
        B["CI/CD & Build Scripts"]:::build
    end

    A -->|"initializes"| F1
    A -->|"initializes"| F2
    A -->|"initializes"| F3
    A -->|"initializes"| F4
    A -->|"initializes"| F5
    A -->|"initializes"| F6
    A -->|"initializes"| F7
    A -->|"initializes"| F8
    A -->|"initializes"| F9
    A -->|"initializes"| F10

    F1 -->|"calls"| D
    F2 -->|"calls"| D
    F3 -->|"calls"| D
    F4 -->|"calls"| D
    F5 -->|"calls"| D
    F6 -->|"calls"| D
    F7 -->|"calls"| D
    F8 -->|"calls"| D
    F9 -->|"calls"| D
    F10 -->|"calls"| D

    D -->|"implements"| DA
    DA -->|"includes"| DI

    F1 ---|"uses"| C
    F2 ---|"uses"| C
    F3 ---|"uses"| C
    F4 ---|"uses"| C
    F5 ---|"uses"| C
    F6 ---|"uses"| C
    F7 ---|"uses"| C
    F8 ---|"uses"| C
    F9 ---|"uses"| C
    F10 ---|"uses"| C
    A ---|"configures"| C

    B ---|"deploys"| A
    B ---|"tests"| F1

    click A "https://github.com/brunocarvalhs/paguei/blob/master/app/src/main/java/br/com/brunocarvalhs/paguei/PagueiApplication.kt"
    click D "https://github.com/brunocarvalhs/paguei/tree/master/domain/src/main/java/br/com/brunocarvalhs/domain"
    click DA "https://github.com/brunocarvalhs/paguei/tree/master/data/src/main/java/br/com/brunocarvalhs/data"
    click DI "https://github.com/brunocarvalhs/paguei/tree/master/data/src/main/java/br/com/brunocarvalhs/data/di"
    click F1 "https://github.com/brunocarvalhs/paguei/tree/master/features/auth"
    click F2 "https://github.com/brunocarvalhs/paguei/tree/master/features/billet_registration"
    click F3 "https://github.com/brunocarvalhs/paguei/tree/master/features/calculation"
    click F4 "https://github.com/brunocarvalhs/paguei/tree/master/features/check_list"
    click F5 "https://github.com/brunocarvalhs/paguei/tree/master/features/costs"
    click F6 "https://github.com/brunocarvalhs/paguei/tree/master/features/extracts"
    click F7 "https://github.com/brunocarvalhs/paguei/tree/master/features/groups"
    click F8 "https://github.com/brunocarvalhs/paguei/tree/master/features/profile"
    click F9 "https://github.com/brunocarvalhs/paguei/tree/master/features/report"
    click F10 "https://github.com/brunocarvalhs/paguei/tree/master/features/splash"
    click C "https://github.com/brunocarvalhs/paguei/tree/master/commons/src/main/java/br/com/brunocarvalhs/commons"
    click B "https://github.com/brunocarvalhs/paguei/blob/master/.github"

    classDef app fill:#1E90FF,stroke:#000,stroke-width:2px;
    classDef feature fill:#87CEFA,stroke:#000,stroke-width:2px;
    classDef domain fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef data fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef commons fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef build fill:#FFB6C1,stroke:#000,stroke-width:2px;
```
