# omarj9/my-todo architecture

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

- Interactive diagram: https://gitdiagram.com/omarj9/my-todo
- Repository: https://github.com/omarj9/my-todo

## Overview

##### Main System Components
- Flutter Application Layers (inside the lib/ directory):
- Core Layer: This includes shared modules such as constants, dependency injection (DI), error handling, themes, routing, services, utilities, and reusable widgets.
- Features Layer: Organized by app functionality (auth, onboarding, profile, splash, task, welcome). Each feature follows a layered pattern (data, state management (Cubits/Blocs), and presentation/UI).

##### Clean Architecture Breakdown (per feature)
- Presentation Layer: This includes all the UI components such as screens and widgets. For example, sign_in_screen.dart in the auth feature or home_screen.dart in the task feature.
- State Management: Cubits (or BLoCs) in each feature that manage the UI state, serving as an intermediary between the Data and UI layers. For example, authentication_cubit.dart or task_cubit.dart.

##### Architectural Technologies and Patterns
- Clean Architecture: Emphasize how features are encapsulated using a layered approach.
- Dependency Injection: Note the presence of DI modules in lib/core/di, which help in loosely coupling the components.
- State Management with Cubit: Each feature uses Cubits for state management.
- Navigation: Managed by GoRouter (as mentioned in the README), which will be part of the routing mechanism housed in lib/core/route.

- Data flow from the remote API (custom backend referenced in the README) to the repositories and then via state management to update the UI.
- Dependency injections flowing from the DI container (in lib/core/di) to the various components that need them.

## Diagram (Mermaid)

```mermaid
graph TD
    A1["Android Client"]:::mobile
    I1["iOS Client"]:::mobile
    FAPP["Flutter App (lib/)"]:::flutter
    BAPI["Backend API"]:::external
    NOTE["Clean Architecture\nFeature-first Organization\nFlutter, Cubit, GoRouter"]:::note

    A1 --> FAPP
    I1 --> FAPP
    NOTE --- FAPP

    subgraph "Core Components"
        DI["Dependency Injection (DI)"]:::core
        RT["Routing (GoRouter)"]:::core
        CU["Constants & Utilities"]:::core
        TS["Theme & Styling"]:::core
        CS["Core Services"]:::core
    end

    subgraph "Feature Modules"
        subgraph "Auth Feature"
            A_DATA["Data Layer"]:::feature
            A_STATE["State Management"]:::feature
            A_UI["Presentation Layer"]:::feature
        end

        subgraph "Onboarding Feature"
            O_STATE["State Management"]:::feature
            O_UI["Presentation Layer"]:::feature
        end

        subgraph "Profile Feature"
            P_DATA["Data Layer"]:::feature
            P_STATE["State Management"]:::feature
            P_UI["Presentation Layer"]:::feature
        end

        subgraph "Splash Feature"
            S_UI["Presentation Layer"]:::feature
        end

        subgraph "Task Feature"
            T_DATA["Data Layer"]:::feature
            T_STATE["State Management"]:::feature
            T_UI["Presentation Layer"]:::feature
        end

        subgraph "Welcome Feature"
            W_UI["Presentation Layer"]:::feature
        end
    end

    %% Data flow within features
    A_UI -->|"sendsAction"| A_STATE
    A_STATE -->|"fetchesData"| A_DATA

    O_UI -->|"sendsAction"| O_STATE

    P_UI -->|"sendsAction"| P_STATE
    P_STATE -->|"fetchesData"| P_DATA

    T_UI -->|"sendsAction"| T_STATE
    T_STATE -->|"fetchesData"| T_DATA

    %% External API interactions
    BAPI -->|"providesData"| A_DATA
    BAPI -->|"providesData"| T_DATA

    %% Routing connections from Core to Presentation layers
    RT --> A_UI
    RT --> O_UI
    RT --> S_UI
    RT --> P_UI
    RT --> T_UI
    RT --> W_UI

    %% Dependency Injection flows into State Management components
    DI --> A_STATE
    DI --> O_STATE
    DI --> P_STATE
    DI --> T_STATE

    %% Click Events
    click A1 "https://github.com/omarj9/my-todo/tree/master/android/"
    click I1 "https://github.com/omarj9/my-todo/tree/master/ios/"
    click DI "https://github.com/omarj9/my-todo/tree/master/lib/core/di/"
    click RT "https://github.com/omarj9/my-todo/blob/master/lib/core/route/app_router.dart"
    click CU "https://github.com/omarj9/my-todo/tree/master/lib/core/constants/"
    click TS "https://github.com/omarj9/my-todo/tree/master/lib/core/theme/"
    click CS "https://github.com/omarj9/my-todo/tree/master/lib/core/services/"
    click A_DATA "https://github.com/omarj9/my-todo/tree/master/lib/features/auth/data/"
    click A_STATE "https://github.com/omarj9/my-todo/tree/master/lib/features/auth/blocs/"
    click A_UI "https://github.com/omarj9/my-todo/tree/master/lib/features/auth/presentation/screens/"
    click O_STATE "https://github.com/omarj9/my-todo/tree/master/lib/features/onboarding/cubit/"
    click O_UI "https://github.com/omarj9/my-todo/tree/master/lib/features/onboarding/"
    click P_DATA "https://github.com/omarj9/my-todo/tree/master/lib/features/profile/data/"
    click P_STATE "https://github.com/omarj9/my-todo/tree/master/lib/features/profile/cubit/"
    click P_UI "https://github.com/omarj9/my-todo/tree/master/lib/features/profile/presentation/"
    click S_UI "https://github.com/omarj9/my-todo/blob/master/lib/features/splash/splash_screen.dart"
    click T_DATA "https://github.com/omarj9/my-todo/tree/master/lib/features/task/data/"
    click T_STATE "https://github.com/omarj9/my-todo/tree/master/lib/features/task/blocs/task/"
    click T_UI "https://github.com/omarj9/my-todo/tree/master/lib/features/task/presentation/screens/"
    click W_UI "https://github.com/omarj9/my-todo/blob/master/lib/features/welcome/welcome_screen.dart"

    %% Styles
    classDef mobile fill:#f9d56e,stroke:#333,stroke-width:2px;
    classDef flutter fill:#aed6f1,stroke:#333,stroke-width:2px;
    classDef core fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef feature fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef external fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef note fill:#e8daef,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
```
