# khaled280-313/cash_flow architecture

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

- Interactive diagram: https://gitdiagram.com/khaled280-313/cash_flow
- Repository: https://github.com/khaled280-313/cash_flow

## Overview

##### Project type and purpose
- This is a Flutter-based mobile application (“cash_flow”) targeting Android and iOS.
- It follows a feature-driven, clean-architecture style: each feature (auth, home, category, transactions, etc.) is split into presentation (Cubit/UI), domain (use cases, entities), and data (repositories, data sources).
- It includes a core layer for shared concerns (network connectivity, API client, cache helper, error handling, routing, theming, DI).

##### File structure
- Top-level “android” and “ios” folders contain native platform integration and build configurations.
- “lib” contains all Dart code:
- core/—shared services, network, caching, error definitions, utility widgets, service locator, routing, theming.
- features/—each feature sub-folder follows Data → Domain → Presentation folders.
– data/datasources: remote & local data source implementations
– data/model: DTOs
– data/repositories: repository implementations
– domain/entities & usecases: business rules
– presentation/cubit & pages/widgets: BLoC state managers and UI
- Third-party and generated code folders: dio_consumer, API interceptors, generated intl for localization.
- Configuration: pubspec.yaml, analysis_options, devtools_options, assets, fonts, images.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Platform Shells"
        AndroidHost["Android MainActivity"]:::platform
        iOSHost["iOS AppDelegate"]:::platform
    end

    subgraph "Application Entry" 
        Main["main.dart"]:::core
        MyApp["MyApp (my_app.dart)"]:::core
    end

    subgraph "Core Services" 
        ServiceLocator["ServiceLocator"]:::core
        NetworkInfo["NetworkInfo"]:::core
        APIConsumer["ApiConsumer"]:::core
        DioConsumer["DioConsumer"]:::core
        APIInterceptors["ApiInterceptors"]:::core
        CacheHelper["CacheHelper"]:::core
        AppRoutes["AppRoutes"]:::core
        AppTheme["AppTheme"]:::core
    end

    subgraph "Presentation Layer" 
        AnalyticsPage["AnalyticsPage"]:::presentation
        AnalyticsCubit["AnalyticsCubit"]:::presentation
    end

    subgraph "Domain Layer"
        TransactionEntity["TransactionEntity"]:::domain
        GetAllTransactionsUseCase["GetAllTransactionsUseCase"]:::domain
    end

    subgraph "Data Layer"
        TransactionsRemoteDataSource["TransactionsRemoteDataSource"]:::data
        TransactionsRepoImpl["TransactionsRepositoryImpl"]:::data
    end

    subgraph "External Systems"
        ExternalAPI["External REST API"]:::external
        LocalStorage["Local Persistent Storage"]:::external
    end

    %% Relationships
    AndroidHost -->|launches| Main
    iOSHost -->|launches| Main

    Main -->|initializes| ServiceLocator
    Main -->|runs| MyApp
    MyApp -->|uses| AppRoutes
    MyApp -->|uses| AppTheme

    ServiceLocator -->|provides| AnalyticsCubit
    ServiceLocator -->|provides| GetAllTransactionsUseCase
    ServiceLocator -->|provides| TransactionsRepoImpl
    ServiceLocator -->|provides| NetworkInfo
    ServiceLocator -->|provides| APIConsumer
    ServiceLocator -->|provides| DioConsumer
    ServiceLocator -->|provides| APIInterceptors
    ServiceLocator -->|provides| CacheHelper

    AnalyticsPage -->|uses| AnalyticsCubit
    AnalyticsCubit -->|calls| GetAllTransactionsUseCase
    GetAllTransactionsUseCase -->|uses| TransactionsRepoImpl
    TransactionsRepositoryImpl -->|fetches| TransactionsRemoteDataSource
    TransactionsRepositoryImpl -->|caches via| CacheHelper
    TransactionsRemoteDataSource -->|http via| DioConsumer
    DioConsumer -->|intercepts with| APIInterceptors
    DioConsumer -->|calls| ExternalAPI
    CacheHelper -->|reads/writes| LocalStorage
    NetworkInfo -->|checks connectivity before| TransactionsRemoteDataSource

    %% Click Events
    click AnalyticsPage "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/analytics/presentation/pages/analytics_page.dart"
    click AnalyticsCubit "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/analytics/presentation/cubit/analytics_cubit.dart"
    click TransactionEntity "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/transactions/domain/entities/transaction_entities.dart"
    click GetAllTransactionsUseCase "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/transactions/domain/usecases/get_all_transaction.dart"
    click TransactionsRemoteDataSource "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/transactions/data/datasources/transactions_data_remote_source.dart"
    click TransactionsRepoImpl "https://github.com/khaled280-313/cash_flow/blob/main/lib/features/transactions/data/repo/transactions_repo_impl.dart"
    click NetworkInfo "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/connection/network_info.dart"
    click APIConsumer "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/database/api/api_consumer.dart"
    click DioConsumer "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/database/api/dio_consumer.dart"
    click APIInterceptors "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/database/api/api_interceptors.dart"
    click CacheHelper "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/database/cache/cache_helper.dart"
    click ServiceLocator "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/services/servic_locator.dart"
    click AppRoutes "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/routes/app_routes.dart"
    click AppTheme "https://github.com/khaled280-313/cash_flow/blob/main/lib/core/utils/app_theme.dart"
    click Main "https://github.com/khaled280-313/cash_flow/blob/main/lib/main.dart"
    click MyApp "https://github.com/khaled280-313/cash_flow/blob/main/lib/app/my_app.dart"
    click AndroidHost "https://github.com/khaled280-313/cash_flow/blob/main/android/app/src/main/kotlin/com/example/cash_flow/MainActivity.kt"
    click iOSHost "https://github.com/khaled280-313/cash_flow/blob/main/ios/Runner/AppDelegate.swift"

    %% Styles
    classDef presentation fill:#D6EAF8,stroke:#1F618D,color:#1F618D
    classDef domain fill:#D5F5E3,stroke:#196F3D,color:#196F3D
    classDef data fill:#FAD7A0,stroke:#B9770E,color:#B9770E
    classDef core fill:#E8DAEF,stroke:#7D3C98,color:#7D3C98
    classDef external fill:#D5D8DC,stroke:#424949,color:#424949
    classDef platform fill:#AAB7B8,stroke:#424949,color:#424949
```
