# devbathani/task-management-app architecture

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

- Interactive diagram: https://gitdiagram.com/devbathani/task-management-app
- Repository: https://github.com/devbathani/task-management-app

## Overview

##### Main Components
- Flutter Frontend: Encompassing the cross-platform UI that runs on Android, iOS, and Web (as seen in directories like android, ios, and web).
- Domain Layer (lib/domain): Contains the core business logic, task entities, and use cases.
- Presentation Layer (lib/presentation): Houses the UI screens and widgets that manage the user interface.
- Infrastructure Layer (lib/infrastructure): Manages data-related operations including interactions with Firebase Firestore, local persistence (via Hive), and any networking.
- Core Utilities (lib/core & lib/utils): Provides common extensions, helper classes, and utility functions across the application.
- Dependency Injection (lib/injection): Manages service location and dependency management.
- Configuration & Generated Code (lib/configs and lib/gen): Provides configuration constants and auto-generated assets/resources.
- State Management (lib/providers): Implements the Provider-based state management, especially for the home or task module.
- Routing (lib/routing): Contains navigation setup and route definitions for app transitions.
- External Services: Firebase (Firebase Firestore, Firebase Core) and Hive for offline storage.

##### Detail the Relationships and Interactions
- The Presentation Layer interacts with the state management providers (from lib/providers) to react to user inputs and UI events.
- The Providers communicate with the Domain Layer to execute business logic (like task creation, deletion, or updates).
- The Domain Layer, which includes task entities and related use cases, is decoupled from the concrete implementations of data access. It sends/receives data via repositories.
- The Infrastructure Layer implements these repositories and interacts with external services like Firebase (for cloud syncing) and Hive (for offline storage).
- Dependency Injection (lib/injection) is crucial for linking the various layers together, ensuring that each component receives the required dependencies at runtime.
- Core and Utils provide shared functionality that is used in both the UI and business logic layers.

##### Architectural Patterns and Principles
- Domain-Driven Design (DDD): Notice the separation into domain, infrastructure, and presentation layers.
- MVVM/MVC-Like Separation: UI on one side and business logic/data handling on the other.
- Dependency Injection: Managing dependencies via a dedicated injection setup (as seen in lib/injection) for better decoupling and testability.
- Cross-Platform Mobile Development: Flutter for UI across Android, iOS, and Web environments.
- Offline-first Mobile App: Use of Hive for local data storage with synchronization to Firebase when online.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Flutter Frontend"
        A1("Android"):::platform
        A2("iOS"):::platform
        A3("Web"):::platform
        A4("Main App Entry"):::platform
    end

    P("Presentation Layer"):::presentation
    PR("State Management (Providers)"):::providers
    R("Routing"):::routing
    D("Domain Layer"):::domain
    I("Infrastructure Layer"):::infrastructure
    subgraph "External Services"
        F("Firebase"):::external
        H("Hive"):::external
    end
    DI("Dependency Injection"):::di
    CU("Core Utilities"):::core
    CONFIG("Configuration & Generated Code"):::config

    %% Inter-layer relationships
    A1 --> P
    A2 --> P
    A3 --> P
    A4 --> P

    P --> PR
    P --> R
    PR --> D
    D --> I
    I --> F
    I --> H

    %% Dependency Injection relationships
    DI --- P
    DI --- PR
    DI --- D
    DI --- I

    %% Core Utilities usage
    CU --- P
    CU --- D
    CU --- I

    %% Config usage
    CONFIG --- P
    CONFIG --- I
    CONFIG --- R

    %% Click Events
    click A1 "https://github.com/devbathani/task-management-app/tree/main/android"
    click A2 "https://github.com/devbathani/task-management-app/tree/main/ios"
    click A3 "https://github.com/devbathani/task-management-app/tree/main/web"
    click A4 "https://github.com/devbathani/task-management-app/blob/main/lib/main.dart"
    click P "https://github.com/devbathani/task-management-app/tree/main/lib/presentation"
    click D "https://github.com/devbathani/task-management-app/tree/main/lib/domain"
    click I "https://github.com/devbathani/task-management-app/tree/main/lib/infrastructure"
    click CU "https://github.com/devbathani/task-management-app/tree/main/lib/core"
    click CU "https://github.com/devbathani/task-management-app/tree/main/lib/utils"
    click DI "https://github.com/devbathani/task-management-app/tree/main/lib/injection"
    click CONFIG "https://github.com/devbathani/task-management-app/tree/main/lib/configs"
    click CONFIG "https://github.com/devbathani/task-management-app/tree/main/lib/gen"
    click PR "https://github.com/devbathani/task-management-app/tree/main/lib/providers"
    click R "https://github.com/devbathani/task-management-app/tree/main/lib/routing"

    %% Styles
    classDef platform fill:#f9c,stroke:#333,stroke-width:2px;
    classDef presentation fill:#ccf,stroke:#333,stroke-width:2px;
    classDef providers fill:#cfc,stroke:#333,stroke-width:2px;
    classDef routing fill:#fcf,stroke:#333,stroke-width:2px;
    classDef domain fill:#cff,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#ffc,stroke:#333,stroke-width:2px;
    classDef external fill:#fdc,stroke:#333,stroke-width:2px;
    classDef di fill:#ddd,stroke:#333,stroke-width:2px;
    classDef core fill:#eef,stroke:#333,stroke-width:2px;
    classDef config fill:#efe,stroke:#333,stroke-width:2px;
```
