# dragoner91/go_dely_front_verde architecture

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

- Interactive diagram: https://gitdiagram.com/dragoner91/go_dely_front_verde
- Repository: https://github.com/dragoner91/go_dely_front_verde

## Overview

##### Key Layers and Components
- Presentation Layer:
– Contains Flutter UI elements (screens, widgets, routes) organized in “lib/presentation”
– Screens such as home, login, register, product details, cart, order history, etc.
– Navigation and UI components (custom app bars, side menus, list views) that render data.
- Application Layer:
– Located under “lib/aplication”, it includes providers (state management), DTOs, use cases, and business logic handlers.
– This layer acts as a mediator between the UI and the domain layer, handling the interaction logic.
- Domain Layer:
– Found in “lib/domain”; it defines business entities (e.g., user, product, order, category, combo, discount) and abstraction interfaces for repositories.
– Its purpose is to represent the core business rules independently of any framework.
- Infrastructure Layer:
– Under “lib/infraestructure”, this layer contains concrete implementations of data sources and repository interfaces.
– It also manages external integrations such as Firebase services, notifications, and network petitions.
– Additional elements are data mappers and local models that convert between raw data and domain objects.
- Core Layer:
– Contains common utilities, error handling (“exception.dart”), use-case foundations, and result wrappers in “lib/core”.
- Configuration/DI Layer:
– Located in “lib/config”, including DI container setup, constants (environment, ubication), routing configuration, and custom theming.

##### Flow of Data and Interactions
- Infrastructure layer as the concrete implementation of repository and data-source interfaces, which interact with external services (like Firebase and notification services).
- Core and Config layers as cross-cutting concerns used by the other layers.
- Dependency inversion principle: the Domain layer defines repository contracts while the Infrastructure layer implements those contracts.

##### Architectural Patterns
- Separation of concerns: UI (Presentation) is decoupled from business rules (Domain), which in turn is decoupled from how data is retrieved (Infrastructure).
- That the dependency direction is inward – External frameworks like Flutter and Firebase interface at the outer layers, while the core business logic remains agnostic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Adaptations Subgraph
    subgraph "Platform Adaptations"
        PA1("Android"):::platform
        PA2("iOS"):::platform
        PA3("macOS"):::platform
        PA4("Windows"):::platform
        PA5("Linux"):::platform
        PA6("Web"):::platform
    end

    %% Clean Architecture Layers Subgraph
    subgraph "Clean Architecture Layers"
        subgraph "Presentation Layer"
            P("Flutter UI Screens (lib/presentation)"):::presentation
        end

        subgraph "Application Layer"
            A("Business Logic/State Management (lib/aplication)"):::application
        end

        subgraph "Domain Layer"
            D("Business Entities & Repository Contracts (lib/domain)"):::domain
        end

        subgraph "Infrastructure Layer"
            I("Data Sources & Firebase Integration (lib/infraestructure)"):::infrastructure
            FS("Firebase Services"):::firebase
        end

        subgraph "Core Layer"
            C("Utilities & Exception Handling (lib/core)"):::core
        end

        subgraph "Configuration/DI Layer"
            CFG("Configuration & DI (lib/config)"):::config
        end
    end

    %% Data and Interaction Flow
    P -->|"UserAction"| A
    A -->|"InvokeUseCases"| D
    D -->|"CallRepository"| I
    I -->|"IntegratesWith"| FS
    %% Connect Firebase Services to Platform Adaptations
    FS ---|"PlatformComm"| PA1
    FS ---|"PlatformComm"| PA2
    FS ---|"PlatformComm"| PA3
    FS ---|"PlatformComm"| PA4
    FS ---|"PlatformComm"| PA5
    FS ---|"PlatformComm"| PA6

    %% Cross-cutting Concerns
    CFG ---|"ProvidesConfig"| A
    CFG ---|"ProvidesConfig"| I
    C ---|"CrossCutting"| A
    C ---|"CrossCutting"| I

    %% Platform Rendering: Platforms drive Presentation layer 
    PA1 ---|"Render"| P
    PA2 ---|"Render"| P
    PA3 ---|"Render"| P
    PA4 ---|"Render"| P
    PA5 ---|"Render"| P
    PA6 ---|"Render"| P

    %% Click Events
    click P "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/presentation"
    click A "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/aplication"
    click D "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/domain"
    click I "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/infraestructure"
    click C "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/core"
    click CFG "https://github.com/dragoner91/go_dely_front_verde/tree/main/lib/config"
    click FS "https://github.com/dragoner91/go_dely_front_verde/blob/main/lib/infraestructure/services/firebase/firebase_handler.dart"
    click PA1 "https://github.com/dragoner91/go_dely_front_verde/tree/main/android"
    click PA2 "https://github.com/dragoner91/go_dely_front_verde/tree/main/ios"
    click PA3 "https://github.com/dragoner91/go_dely_front_verde/tree/main/macos"
    click PA4 "https://github.com/dragoner91/go_dely_front_verde/tree/main/windows"
    click PA5 "https://github.com/dragoner91/go_dely_front_verde/tree/main/linux"
    click PA6 "https://github.com/dragoner91/go_dely_front_verde/tree/main/web"

    %% Styles
    classDef presentation fill:#FFCCCC,stroke:#cc0000,stroke-width:2px;
    classDef application fill:#CCFFCC,stroke:#009900,stroke-width:2px;
    classDef domain fill:#CCCCFF,stroke:#0000cc,stroke-width:2px;
    classDef infrastructure fill:#FFFFCC,stroke:#cccc00,stroke-width:2px;
    classDef core fill:#FFCCFF,stroke:#cc0099,stroke-width:2px;
    classDef config fill:#CCFFFF,stroke:#0099cc,stroke-width:2px;
    classDef firebase fill:#EFEFEF,stroke:#666666,stroke-width:2px;
    classDef platform fill:#FFD700,stroke:#FF8C00,stroke-width:2px;
```
