# astivens/temposagemovil architecture

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

- Interactive diagram: https://gitdiagram.com/astivens/temposagemovil
- Repository: https://github.com/astivens/temposagemovil

## Overview

##### Project type and purpose
- This is a cross-platform Flutter application (“temposage”) targeting mobile (Android, iOS), desktop (macOS, Windows, Linux) and web.
- Its focus is time-management and productivity: tracking activities, habits, tasks and time‐blocks, backed by local storage (Hive) and remote API calls, plus an on-device ML model for productivity prediction.

##### File structure
- Top-level platform folders (android, ios, linux, macos, windows, web): Flutter host configurations and platform-specific bootstrap code.
- lib/
└ core/: shared utilities—animations, constants, config, DI container, services (API, local storage, speech, notifications), Hive initialization, navigation.
└ features/: classic clean-architecture separation per domain (activities, auth, calendar, dashboard, habits, home, settings, tasks, timeblocks). Each feature splits into data (models, repositories, services), domain (entities, use-cases, services), and presentation (screens, widgets, controllers or cubits).
- assets/: fonts, images, and an on-device TFLite model with labels.
- Configuration files: pubspec.yaml, build.yaml, analysis_options.yaml, API_GUIDE.md, api_documentation.yaml.

##### README
- Minimal boilerplate Flutter README. No additional architecture notes, so infer architecture from directory conventions (Clean Architecture + Flutter best practices + hive for persistence + TFLite for inference).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Hosts
    subgraph "Platforms"
        Android["Android Host"]:::external
        iOS["iOS Host"]:::external
        Web["Web Host"]:::external
        Desktop["Desktop Host"]:::external
    end

    Android -->|"runs Flutter Engine"| Engine["Flutter Engine"]:::core
    iOS -->|"runs Flutter Engine"| Engine
    Web -->|"runs Flutter Engine"| Engine
    Desktop -->|"runs Flutter Engine"| Engine

    %% Core Services
    subgraph "Core Services"
        ServiceLocator["Service Locator (GetIt)"]:::core
        NavigationService["Navigation Service"]:::core
        AppRouter["App Router"]:::core
        SpeechService["Speech Service"]:::core
        VoiceCommandService["Voice Command Service"]:::core
        AICommandService["AI Command Service"]:::core
        NotificationService["Notification Service"]:::core
        ErrorHandler["Error Handler"]:::core
        Logger["Logger"]:::core
    end

    Engine -->|injects| ServiceLocator
    ServiceLocator --> NavigationService
    ServiceLocator --> SpeechService
    ServiceLocator --> NotificationService
    ServiceLocator --> ErrorHandler

    %% Presentation Layer
    subgraph "Presentation Layer"
        ActivitiesScreen["ActivitiesScreen"]:::presentation
        CreateActivityScreen["CreateActivityScreen"]:::presentation
        EditActivityScreen["EditActivityScreen"]:::presentation
        HabitsScreen["HabitsScreen"]:::presentation
        TasksScreen["TasksScreen"]:::presentation
        TimeBlocksScreen["TimeBlocksScreen"]:::presentation
        CreateTimeBlockScreen["CreateTimeBlockScreen"]:::presentation
        CalendarScreen["CalendarScreen"]:::presentation
        DashboardScreen["DashboardScreen"]:::presentation
        HabitCubit["HabitCubit"]:::presentation
        TaskCubit["TaskCubit"]:::presentation
        DashboardController["DashboardController"]:::presentation
    end

    NavigationService --> DashboardScreen
    DashboardScreen -->|"uses"| DashboardController
    ActivitiesScreen -->|"dispatches"| HabitCubit
    HabitsScreen -->|"dispatches"| HabitCubit
    TasksScreen -->|"dispatches"| TaskCubit
    TimeBlocksScreen -->|"dispatches"| TaskCubit

    %% Domain Layer
    subgraph "Domain Layer"
        ActivityEntity["Activity Entity"]:::domain
        HabitEntity["Habit Entity"]:::domain
        AnalyzePatternsUC["AnalyzePatternsUseCase"]:::domain
        PredictProductivityUC["PredictProductivityUseCase"]:::domain
        SuggestOptimalTimeUC["SuggestOptimalTimeUseCase"]:::domain
        GetHabitsUC["GetHabitsUseCase"]:::domain
    end

    HabitCubit -->|"executes"| GetHabitsUC
    DashboardController -->|"executes"| AnalyzePatternsUC
    DashboardController -->|"executes"| PredictProductivityUC
    DashboardController -->|"executes"| SuggestOptimalTimeUC

    %% Data Layer
    subgraph "Data Layer"
        ActivityRepo["ActivityRepository"]:::data
        HabitRepoImpl["HabitRepositoryImpl"]:::data
        TaskRepoImpl["TaskRepositoryImpl"]:::data
        SubtaskRepoImpl["SubtaskRepositoryImpl"]:::data
        TimeBlockRepo["TimeBlockRepository"]:::data
        TempoSageAPI["Tempo Sage API Service"]:::data
        LocalStorage["LocalStorageService"]:::data
        HiveInit["HiveInitService"]:::data
        TFLiteModel["TFLite Model"]:::data
    end

    AnalyzePatternsUC -->|"calls"| ActivityRepo
    PredictProductivityUC -->|"calls"| ActivityRepo
    SuggestOptimalTimeUC -->|"calls"| ActivityRepo
    GetHabitsUC -->|"calls"| HabitRepoImpl

    ActivityRepo -->|"HTTP"| TempoSageAPI
    ActivityRepo -->|"Read/Write"| LocalStorage
    ActivityRepo -->|"Inference"| TFLiteModel
    HabitRepoImpl -->|"Read/Write"| LocalStorage
    TaskRepoImpl -->|"Read/Write"| LocalStorage
    SubtaskRepoImpl -->|"Read/Write"| LocalStorage
    TimeBlockRepo -->|"Read/Write"| LocalStorage
    HiveInit -->|"initializes"| LocalStorage

    %% External Systems
    subgraph "External Systems"
        RemoteAPI["Remote API Endpoint"]:::external
        FileSystem["Device FileSystem (Hive DB)"]:::external
        TFLiteInterpreter["TFLite Interpreter"]:::external
        PushBackend["Push Notification Backend"]:::external
    end

    TempoSageAPI -->|"network"| RemoteAPI
    LocalStorage -->|"fs access"| FileSystem
    TFLiteModel -->|"runs on"| TFLiteInterpreter
    NotificationService -->|"push"| PushBackend

    %% Legends and styling
    classDef presentation fill:#2196f3,stroke:#1e88e5,color:white;
    classDef domain fill:#4caf50,stroke:#388e3c,color:white;
    classDef data fill:#ff9800,stroke:#f57c00,color:white;
    classDef core fill:#9e9e9e,stroke:#616161,color:white;
    classDef external fill:#9c27b0,stroke:#6a1b9a,color:white;

    %% Click Events Presentation
    click ActivitiesScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/presentation/screens/activities_screen.dart"
    click CreateActivityScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/presentation/screens/create_activity_screen.dart"
    click EditActivityScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/presentation/screens/edit_activity_screen.dart"
    click HabitsScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/habits/presentation/screens/habits_screen.dart"
    click TasksScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/tasks/presentation/screens/tasks_screen.dart"
    click TimeBlocksScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/timeblocks/presentation/screens/time_blocks_screen.dart"
    click CreateTimeBlockScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/timeblocks/presentation/screens/create_time_block_screen.dart"
    click CalendarScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/calendar/presentation/screens/calendar_screen.dart"
    click DashboardScreen "https://github.com/astivens/temposagemovil/blob/main/lib/features/dashboard/presentation/screens/dashboard_screen.dart"
    click DashboardController "https://github.com/astivens/temposagemovil/blob/main/lib/features/dashboard/controllers/dashboard_controller.dart"
    click HabitCubit "https://github.com/astivens/temposagemovil/blob/main/lib/features/habits/cubit/habit_cubit.dart"
    click TaskCubit "https://github.com/astivens/temposagemovil/blob/main/lib/features/tasks/cubit/task_cubit.dart"

    %% Click Events Domain
    click ActivityEntity "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/domain/entities/activity.dart"
    click HabitEntity "https://github.com/astivens/temposagemovil/blob/main/lib/features/habits/domain/entities/habit.dart"
    click AnalyzePatternsUC "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/domain/usecases/analyze_patterns_use_case.dart"
    click PredictProductivityUC "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/domain/usecases/predict_productivity_use_case.dart"
    click SuggestOptimalTimeUC "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/domain/usecases/suggest_optimal_time_use_case.dart"
    click GetHabitsUC "https://github.com/astivens/temposagemovil/blob/main/lib/features/habits/domain/usecases/get_habits_use_case.dart"

    %% Click Events Data
    click ActivityRepo "https://github.com/astivens/temposagemovil/blob/main/lib/features/activities/data/repositories/activity_repository.dart"
    click HabitRepoImpl "https://github.com/astivens/temposagemovil/blob/main/lib/features/habits/data/repositories/habit_repository_impl.dart"
    click TaskRepoImpl "https://github.com/astivens/temposagemovil/blob/main/lib/features/tasks/data/repositories/task_repository_impl.dart"
    click SubtaskRepoImpl "https://github.com/astivens/temposagemovil/blob/main/lib/features/tasks/data/repositories/subtask_repository_impl.dart"
    click TimeBlockRepo "https://github.com/astivens/temposagemovil/blob/main/lib/features/timeblocks/data/repositories/time_block_repository.dart"
    click TempoSageAPI "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/tempo_sage_api_service.dart"
    click LocalStorage "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/local_storage.dart"
    click HiveInit "https://github.com/astivens/temposagemovil/blob/main/lib/core/database/hive_init.dart"

    %% Click Events Core
    click ServiceLocator "https://github.com/astivens/temposagemovil/blob/main/lib/core/di/service_locator.dart"
    click NavigationService "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/navigation_service.dart"
    click AppRouter "https://github.com/astivens/temposagemovil/blob/main/lib/core/navigation/app_router.dart"
    click SpeechService "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/speech_service.dart"
    click VoiceCommandService "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/voice_command_service.dart"
    click AICommandService "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/ai_command_service.dart"
    click NotificationService "https://github.com/astivens/temposagemovil/blob/main/lib/core/services/notification_service.dart"
    click ErrorHandler "https://github.com/astivens/temposagemovil/blob/main/lib/core/utils/error_handler.dart"
    click Logger "https://github.com/astivens/temposagemovil/blob/main/lib/core/utils/logger.dart"

    %% Click Events Data Model
    click TFLiteModel "https://github.com/astivens/temposagemovil/blob/main/assets/ml/productivity_model.tflite"
```
