# ckomundodev/flores-web architecture

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

- Interactive diagram: https://gitdiagram.com/ckomundodev/flores-web
- Repository: https://github.com/ckomundodev/flores-web

## Overview

##### Entry Point & Configuration
- The Webpack/Vite entry files (index.html, src/index.tsx) initialize the application.
- Configuration files (tsconfig.json, eslint.config.js, tailwind.config.js, etc.) set up the tooling and environment.

##### Application Layer
- The “src/application” folder (e.g., FlowersController.tsx) provides controllers that mediate between the user interface and the domain logic. It handles event processing and orchestrates flow among layers.

##### Domain Layer
- The “src/domain” directory (including models in “src/domain/models” and use cases in “src/domain/usecases”) embodies the business logic. For instance:
- FlowersModel.ts represents the data model for a flower.
- generarCorazonesUseCase.ts encapsulates a use case (likely for generating hearts) that applies core business rules.

##### Infrastructure Layer
- The “src/infrastructure” folder includes utility functions, styling assets, and supporting libraries that help implement design and animation rules. This includes styles (in animaciones.ts) and utilities (in the utils folder).

##### Assets
- The “src/assets” folder reserves space for images, fonts, or other static resources used by the application.

##### External Configurations & Tooling
- The README indicates that ESLint rules and React performance optimizations (using either Babel or SWC through plugins) are configured. This is essential to understand when depicting dependency flow for build and development processes.

A. Identify and Label Key Components:
- Entry Point: “index.html” and “src/index.tsx”.
- Presentation Layer: “src/pages/App.tsx” and all components in “src/presentation/components”.
- Application Layer: “src/application/FlowersController.tsx”.
- Domain Layer: “src/domain” which holds “models” and “usecases”.
- Infrastructure: “src/infrastructure” for utilities and styling.
- Assets & Public Files: “public” directory.

B. Define Relationships and Interactions:
- UI components (e.g., in the Presentation layer) to the Application layer (e.g., FlowersController.tsx) to indicate that UI events trigger controller actions.
- Connection from the Application layer to the Domain layer, where business logic is executed (e.g., flowing from the controller to generarCorazonesUseCase.ts and FlowersModel.ts).
- Link the Infrastructure layer to both the Presentation and Domain layers, highlighting that style and utility functions support both business logic and UI rendering.
- That assets from the “public” and “src/assets” directories are statically loaded into the application's UI.

C. Emphasize Architectural Patterns:
- This is a layered architecture (or “onion” architecture) where each layer has distinct responsibilities.
- The separation between domain logic, application orchestration, and presentation details follows principles common in Domain-Driven Design.
- The file tree shows a clean separation similar to MVC/MVP patterns, with controllers and models clearly separated from UI components.
- State or business rules management is offloaded to the domain layer and use cases, improving maintainability.

D. Include Relevant Technologies and Tools:
- React is used for the component-based user interface.
- TypeScript provides type safety and structured code.
- Vite serves as the build tool for fast development and HMR (Hot Module Replacement).
- ESLint and plugins (as described in the README) help ensure code quality.
- Tailwind (configured via tailwind.config.js) is potentially used for styling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point & Configuration layer
    subgraph "Entry & Configuration"
        Entry1["index.html"]
        Entry2["src/index.tsx"]
        Config1["tsconfig.json"]
        Config2["eslint.config.js"]
        Config3["tailwind.config.js"]
        Config4["vite.config.ts"]
        Config5["postcss.config.js"]
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        PageApp["src/pages/App.tsx"]
        FA["src/presentation/components/FlowersAnimation.tsx"]
        FB["src/presentation/components/FlowersButton.tsx"]
        H["src/presentation/components/Heart.tsx"]
        Hs["src/presentation/components/Hearts.tsx"]
    end

    %% Application Layer
    subgraph "Application Layer"
        Controller["src/application/FlowersController.tsx"]
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Model["src/domain/models/FlowersModel.ts"]
        UseCase["src/domain/usecases/generarCorazonesUseCase.ts"]
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        Anim["src/infrastructure/styles/animaciones.ts"]
        Util["src/infrastructure/utils/StyleUtils.ts"]
        UtilTSX["src/infrastructure/utils/StyleUtils.tsx"]
        UtilIndex["src/infrastructure/utils/index.ts"]
    end

    %% Assets
    subgraph "Assets"
        AssetsDir["src/assets"]
        PublicDir["public"]
    end

    %% Relationships

    %% Initialization flow
    Entry2 -->|"initializes"| PageApp
    PublicDir -->|"initializes"| Entry2

    %% Configurations support project startup
    Config1 --- Config2
    Config2 --- Config3
    Config3 --- Config4
    Config4 --- Config5
    %% (Configuration files support the build and tooling overall)

    %% Presentation: App renders UI components
    PageApp -->|"renders"| FA
    PageApp -->|"renders"| FB
    PageApp -->|"renders"| H
    PageApp -->|"renders"| Hs

    %% User interaction: UI triggers controller actions
    FA -->|"triggers"| Controller
    FB -->|"triggers"| Controller
    H -->|"triggers"| Controller
    Hs -->|"triggers"| Controller

    %% Application layer interacts with Domain layer
    Controller -->|"executes"| UseCase
    Controller -->|"updates"| Model

    %% Infrastructure supports Presentation and Domain
    Anim -.->|"stylingSupport"| FA
    Util -.->|"utilitySupport"| FB
    UtilTSX -.->|"utilitySupport"| UseCase
    UtilIndex -.->|"utilitySupport"| Controller

    %% Assets loaded into Presentation
    AssetsDir -->|"staticAssets"| PageApp

    %% Styling classes
    class Entry1,Entry2,Config1,Config2,Config3,Config4,Config5 entry;
    class PageApp,FA,FB,H,Hs presentation;
    class Controller application;
    class Model,UseCase domain;
    class Anim,Util,UtilTSX,UtilIndex infrastructure;
    class AssetsDir,PublicDir assets;

    %% Class Definitions with colours
    classDef entry fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef presentation fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef application fill:#FFE082,stroke:#FF6F00,stroke-width:2px;
    classDef domain fill:#C8E6C9,stroke:#1B5E20,stroke-width:2px;
    classDef infrastructure fill:#F0F4C3,stroke:#827717,stroke-width:2px;
    classDef assets fill:#E1BEE7,stroke:#4A148C,stroke-width:2px;
    classDef config fill:#D1C4E9,stroke:#311B92,stroke-width:2px;

    %% Click Events for Entry & Configuration
    click Entry1 "https://github.com/ckomundodev/flores-web/blob/master/index.html"
    click Entry2 "https://github.com/ckomundodev/flores-web/blob/master/src/index.tsx"
    click Config1 "https://github.com/ckomundodev/flores-web/blob/master/tsconfig.json"
    click Config2 "https://github.com/ckomundodev/flores-web/blob/master/eslint.config.js"
    click Config3 "https://github.com/ckomundodev/flores-web/blob/master/tailwind.config.js"
    click Config4 "https://github.com/ckomundodev/flores-web/blob/master/vite.config.ts"
    click Config5 "https://github.com/ckomundodev/flores-web/blob/master/postcss.config.js"

    %% Click Events for Presentation Layer
    click PageApp "https://github.com/ckomundodev/flores-web/blob/master/src/pages/App.tsx"
    click FA "https://github.com/ckomundodev/flores-web/blob/master/src/presentation/components/FlowersAnimation.tsx"
    click FB "https://github.com/ckomundodev/flores-web/blob/master/src/presentation/components/FlowersButton.tsx"
    click H "https://github.com/ckomundodev/flores-web/blob/master/src/presentation/components/Heart.tsx"
    click Hs "https://github.com/ckomundodev/flores-web/blob/master/src/presentation/components/Hearts.tsx"

    %% Click Event for Application Layer
    click Controller "https://github.com/ckomundodev/flores-web/blob/master/src/application/FlowersController.tsx"

    %% Click Events for Domain Layer
    click Model "https://github.com/ckomundodev/flores-web/blob/master/src/domain/models/FlowersModel.ts"
    click UseCase "https://github.com/ckomundodev/flores-web/blob/master/src/domain/usecases/generarCorazonesUseCase.ts"

    %% Click Events for Infrastructure Layer
    click Anim "https://github.com/ckomundodev/flores-web/blob/master/src/infrastructure/styles/animaciones.ts"
    click Util "https://github.com/ckomundodev/flores-web/blob/master/src/infrastructure/utils/StyleUtils.ts"
    click UtilTSX "https://github.com/ckomundodev/flores-web/blob/master/src/infrastructure/utils/StyleUtils.tsx"
    click UtilIndex "https://github.com/ckomundodev/flores-web/blob/master/src/infrastructure/utils/index.ts"

    %% Click Events for Assets
    click AssetsDir "https://github.com/ckomundodev/flores-web/tree/master/src/assets"
    click PublicDir "https://github.com/ckomundodev/flores-web/tree/master/public"
```
