# juanppdev/proyecto_1_pomodoro architecture

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

- Interactive diagram: https://gitdiagram.com/juanppdev/proyecto_1_pomodoro
- Repository: https://github.com/juanppdev/proyecto_1_pomodoro

## Overview

##### Project Type and Purpose
- This is an Android mobile application built primarily in Kotlin. Its purpose is to implement the Pomodoro technique, allowing users to manage their time, view statistics, and (in future iterations) manage tasks and habits.
- Key indicators include the use of Jetpack Compose for the UI (as seen in the Kotlin files under the ui/ directories), DI modules for dependency injection, and a clear separation of concerns across viewModels, navigation, and core modules.

##### Analyzing the File Structure
- Top-Level Module: The “app” folder is the main Android module. It contains typical Android project components:
- “src/main” which houses the main application logic.
- App Module Structure:
- Presentation/UI: Located under app/src/main/java/com/mundocode/pomodoro/ui, it is further subdivided into components and multiple screen directories (e.g., TaskScreen, HabitsScreen, HomeScreen, LoginScreen, TimerScreen, etc.).
- Navigation: Under app/src/main/java/com/mundocode/pomodoro/core/navigation, files like Destinations.kt and NavigationRoot.kt represent navigation paths and logic.
- Dependency Injection (DI): Under app/src/main/java/com/mundocode/pomodoro/di, files such as ApplicationModule.kt, FirebaseModule.kt, and LoginFirebase.kt show that the project uses dependency injection to manage application components.
- Models: Under app/src/main/java/com/mundocode/pomodoro/model and subdirectories (e.g., local), which define the data structures like the Timer model.
- View Models: Organized under app/src/main/java/com/mundocode/pomodoro/viewModels and nested subdirectories for different screens. They serve as the bridge between the UI and business logic.
- Testing: Both instrumented tests (androidTest) and unit tests (test) are available, ensuring that the architecture supports testing at different levels.
- Build & Configuration: Build scripts (build.gradle.kts, settings.gradle.kts) and configuration files indicate that the project is managed with Gradle and structured for modular development.

##### Examining the README for Architectural Insights
- The README describes the objectives (Pomodoro technique, metrics, statistics) and highlights that it uses technologies like Kotlin, Jetpack Compose, and GitHub for collaboration.
- The roadmap and design resources (link to Figma) indicate that the UI/UX plays a significant role in this project.

a. Main Components:
- Application Entry Point: PomodoroApp.kt which initializes the application and sets up dependency injection.
- UI Layer: All user-facing screens (LoginScreen, HomeScreen, TaskScreen, TimerScreen, HabitsScreen) and UI components (customTopAppBar, theme files) that build the interface with Jetpack Compose.
- Navigation: Items under core/navigation (Destinations.kt and NavigationRoot.kt) that manage the app flow between screens.
- ViewModel Layer: Various view models (TimerViewModel, HomeViewModel, SetupSessionViewModel, etc.) acting as intermediaries that provide data to the UI.
- Dependency Injection: The DI modules that provide the objects and services required across the application.
- Model/Domain: The business models (e.g., Timer) that encapsulate core logic.
- Testing Components: Represent the unit tests and instrumented tests that validate functionality.
- External Services: Components integrating Firebase (as seen in FirebaseModule.kt and LoginFirebase.kt).

b. Relationships and Interactions:
- That PomodoroApp (the application initializer) sets up DI which injects dependencies into the ViewModels and other components.
- Flow from the user interface (UI Screens) to the corresponding ViewModels (state management and logic) and then to the domain models.
- That the Navigation module directs the user from one screen to another.
- That external services (Firebase integration) are provided via DI modules and utilized in screens such as the LoginScreen for authentication.

c. Important Architectural Patterns:
- MVVM Pattern: The separation between the UI and the viewModels (with clear directories for UI screens and their corresponding viewModels).
- Dependency Injection: Using modules like ApplicationModule and FirebaseModule to supply dependencies.
- Modularization: Distinct packages for navigation, DI, models, UI components, and viewModels to keep concerns separated.
- Clean Code Principles: A modular structure that eases testing and maintenance evident by the division between instrumented and unit tests.

d. Relevant Technologies, Frameworks, or Libraries:
- Kotlin as the main programming language.
- Jetpack Compose for the UI.
- Gradle (using build.gradle.kts) as the build system.
- Firebase for backend/authentication services.
- GitHub workflows for CI/CD integration.

##### Final Recommendations
- Be detailed: Ensure that every core architectural element is represented. Do not simplify too much; if necessary, break down components further (e.g., show individual screens or even key functions like Firebase integration).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Application Entry Point"
        POM("PomodoroApp"):::app
    end

    subgraph "Dependency Injection"
        DI("DI Modules"):::di
    end

    subgraph "Navigation"
        NAV("Navigation Module"):::nav
    end

    subgraph "Presentation (UI Screens)"
        UI1("LoginScreen"):::ui
        UI2("HomeScreen"):::ui
        UI3("TaskScreen"):::ui
        UI4("TimerScreen"):::ui
        UI5("HabitsScreen"):::ui
        UI6("SetupSessionScreen"):::ui
    end

    subgraph "ViewModel Layer"
        VM1("TimerViewModel"):::vm
        VM2("HomeViewModel"):::vm
        VM3("SetupSessionViewModel"):::vm
        VM4("HabitsViewModel"):::vm
    end

    subgraph "Domain Model"
        DM("Timer Model"):::domain
    end

    subgraph "Testing"
        TEST1("Instrumented Tests"):::test
        TEST2("Unit Tests"):::test
    end

    subgraph "CI/CD"
        CICD("GitHub Actions"):::cicd
    end

    %% Relationships
    POM -->|"setsUpDI"| DI
    POM -->|"configuresNav"| NAV

    DI -->|"injects"| VM1
    DI -->|"injects"| VM2
    DI -->|"injects"| VM3
    DI -->|"injects"| VM4

    NAV -->|"navigates"| UI1
    NAV -->|"navigates"| UI2
    NAV -->|"navigates"| UI3
    NAV -->|"navigates"| UI4
    NAV -->|"navigates"| UI5
    NAV -->|"navigates"| UI6

    UI4 -->|"bindsTo"| VM1
    UI2 -->|"bindsTo"| VM2
    UI6 -->|"bindsTo"| VM3
    UI5 -->|"bindsTo"| VM4
    UI1 -->|"bindsTo"| VM2
    UI3 -->|"bindsTo"| VM2

    VM1 -->|"uses"| DM

    TEST1 -->|"tests"| POM
    TEST2 -->|"tests"| VM1

    CICD -->|"deploys"| POM
    CICD -->|"triggersTests"| TEST1

    %% Click Events
    click POM "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/PomodoroApp.kt"
    click UI1 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/loginScreen/LoginScreen.kt"
    click UI2 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/homeScreen/HomeScreen.kt"
    click UI3 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/TaskScreen/TaskScreen.kt"
    click UI4 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/timer/TimerScreen.kt"
    click UI5 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/habits/HabitsScreen.kt"
    click UI6 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/ui/screens/setupSessionScreen/SetupSessionScreen.kt"
    click NAV "https://github.com/juanppdev/proyecto_1_pomodoro/tree/main/app/src/main/java/com/mundocode/pomodoro/core/navigation"
    click DI "https://github.com/juanppdev/proyecto_1_pomodoro/tree/main/app/src/main/java/com/mundocode/pomodoro/di"
    click DM "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/model/local/Timer.kt"
    click VM1 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/viewModels/timerViewModels/TimerViewModel.kt"
    click VM2 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/viewModels/HomeViewModel.kt"
    click VM3 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/viewModels/SetupSessionViewModel/SetupSessionViewModel.kt"
    click VM4 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/main/java/com/mundocode/pomodoro/viewModels/habitsViewModel/HabitsViewModel.kt"
    click TEST1 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/androidTest/java/com/mundocode/pomodoro/ExampleInstrumentedTest.kt"
    click TEST2 "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/app/src/test/java/com/mundocode/pomodoro/ExampleUnitTest.kt"
    click CICD "https://github.com/juanppdev/proyecto_1_pomodoro/blob/main/.github/workflows/main.yml"

    %% Styles
    classDef app fill:#AEC6CF,stroke:#1E90FF,stroke-width:2px;
    classDef ui fill:#AEDFF7,stroke:#1E90FF,stroke-width:2px;
    classDef vm fill:#CFFFB3,stroke:#228B22,stroke-width:2px;
    classDef domain fill:#FFD580,stroke:#FF8C00,stroke-width:2px;
    classDef di fill:#E6E6FA,stroke:#9370DB,stroke-width:2px;
    classDef nav fill:#F5DEB3,stroke:#DAA520,stroke-width:2px;
    classDef test fill:#D3D3D3,stroke:#696969,stroke-width:2px;
    classDef cicd fill:#FFC0CB,stroke:#FF69B4,stroke-width:2px;
```
