# danielrodriguez26/fe-events architecture

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

- Interactive diagram: https://gitdiagram.com/danielrodriguez26/fe-events
- Repository: https://github.com/danielrodriguez26/fe-events

## Overview

##### Project Type & Purpose
- Front-end single-page application for event management (“Mis Eventos”)
- Built with React + TypeScript + Tailwind CSS, following Clean (Hexagonal) Architecture
- Consumes a RESTful backend (VITE_API_URL) via HTTP (Axios)

##### Key Architectural Layers (to represent
a. Presentation Layer
- UI Components (`src/components/`, `public/index.html`)
- Pages & Layouts (`src/application/pages/…`, `src/application/layout/Layout.tsx`)
- Custom Hooks (presentation-focused) in `src/application/hooks/`
b. Application Layer
- Use-case orchestration via hooks (e.g., `useEvents`, `useRegisterForm`)
- Coordinates between UI and domain services
c. Domain Layer
- Business entities & interfaces (`src/domain/*/*.interface.ts`)
- Domain services (`src/domain/*/*.service.ts`) implementing business logic
d. Infrastructure Layer
- Router configuration (`src/infrastructure/router/index.tsx`)
- HTTP adapters and environment config (`src/domain/settings/axios.config.ts`, `backend.config.ts`, `http.service.ts`)
e. State Management
- Zustand stores in `src/store/store.ts` (slices: auth, events, sessions, speakers, etc.)
f. Utilities & Testing
- Utility modules (`src/utils/`) and test harness (`jest.config.ts`, `src/__tests__/`)

##### External & Deployment Components
- External REST API (hosted at VITE_API_URL)
- Build tools: Vite dev server, Docker image, Nginx web server
- CI/CD / Docker Compose (`docker-compose.yml`)

##### Relationships & Data Flows
- User Action → Presentation Components → Custom Hook (Application Layer)
- Hook invokes Domain Service → Domain Service calls HTTP Service (Infrastructure Layer)
- HTTP Service → External API → Response → Domain Service → Hook → Component (update UI)
- State updates stored in Zustand → UI subscribes to store slices → re‐render

##### Architectural Patterns & Principles
- Hexagonal/Clean Architecture: strict separation of concerns by layers
- “Ports & Adapters”: Domain services define interfaces, Infrastructure layer provides adapters (HTTP)
- Unidirectional data flow: UI → Hooks → Services → HTTP → API → Response → Store → UI
- Optimistic updates for sessions (Hook/Service pattern)
- Component reuse: atomic UI components in `components/ui`, higher-level composed components

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        UIComponents["UI Components"]:::presentation
        PublicHTML["public/index.html"]:::presentation
        Layout["Layout"]:::presentation
        Pages["Pages"]:::presentation
        HooksPL["Custom Hooks"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        UseCases["Use Case Hooks"]:::application
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        Entities["Entities & Interfaces"]:::domain
        Services["Domain Services"]:::domain
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        direction TB
        RouterConfig["Router Config"]:::infrastructure
        HTTPAdapters["HTTP Adapters & Env Config"]:::infrastructure
    end

    %% State Management
    subgraph "State Store"
        direction TB
        ZustandStore["Zustand Store"]:::state
    end

    %% Utilities & Testing
    subgraph "Utilities & Testing"
        direction TB
        Utils["Utilities"]:::utility
        Tests["Tests & Jest"]:::utility
    end

    %% External & Deployment
    subgraph "External & Deployment"
        direction TB
        Vite["Vite"]:::deploy
        Docker["Docker & Compose"]:::deploy
        Nginx["Nginx"]:::deploy
        API["External REST API"]:::external
    end

    %% Main Entry
    Main["src/main.tsx"]:::presentation

    %% Connections
    UIComponents -->|uses| HooksPL
    PublicHTML -->|loads| Main
    Main -->|renders| Layout
    Layout -->|contains| Pages
    Pages -->|invoke| HooksPL

    HooksPL -->|call| UseCases
    UseCases -->|orchestrate| Services

    Services -->|use| Entities
    Services -->|call| HTTPAdapters
    HTTPAdapters -->|HTTP calls| API

    API -->|response| HTTPAdapters
    HTTPAdapters -->|return data| Services
    Services -->|return| UseCases
    UseCases -->|update| ZustandStore
    ZustandStore -->|subscribe| UIComponents
    ZustandStore -->|subscribe| Pages

    RouterConfig -->|provides| Layout

    Utils -->|assist| HooksPL
    Tests -->|test| Utils
    Tests -->|test| HooksPL

    Vite -->|build| Main
    Docker -->|package| Vite
    Docker -->|bundle| Nginx
    Nginx -->|serve| PublicHTML

    %% Click Events
    click UIComponents "https://github.com/danielrodriguez26/fe-events/tree/master/src/components/"
    click PublicHTML "https://github.com/danielrodriguez26/fe-events/blob/master/public/index.html"
    click Layout "https://github.com/danielrodriguez26/fe-events/blob/master/src/application/layout/Layout.tsx"
    click HooksPL "https://github.com/danielrodriguez26/fe-events/tree/master/src/application/hooks/"
    click Main "https://github.com/danielrodriguez26/fe-events/blob/master/src/main.tsx"
    click UseCases "https://github.com/danielrodriguez26/fe-events/tree/master/src/application/hooks/"
    click Entities "https://github.com/danielrodriguez26/fe-events/tree/master/src/domain/"
    click Services "https://github.com/danielrodriguez26/fe-events/tree/master/src/domain/"
    click RouterConfig "https://github.com/danielrodriguez26/fe-events/blob/master/src/infrastructure/router/index.tsx"
    click HTTPAdapters "https://github.com/danielrodriguez26/fe-events/blob/master/src/domain/settings/axios.config.ts"
    click HTTPAdapters "https://github.com/danielrodriguez26/fe-events/blob/master/src/domain/settings/backend.config.ts"
    click HTTPAdapters "https://github.com/danielrodriguez26/fe-events/blob/master/src/domain/settings/envairoment.ts"
    click ZustandStore "https://github.com/danielrodriguez26/fe-events/blob/master/src/store/store.ts"
    click Utils "https://github.com/danielrodriguez26/fe-events/tree/master/src/utils/"
    click Tests "https://github.com/danielrodriguez26/fe-events/tree/master/src/__tests__/"
    click Vite "https://github.com/danielrodriguez26/fe-events/blob/master/vite.config.ts"
    click Docker "https://github.com/danielrodriguez26/fe-events/blob/master/docker-compose.yml"
    click Nginx "https://github.com/danielrodriguez26/fe-events/blob/master/nginx.conf"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#0366D6
    classDef application fill:#DFFFE0,stroke:#28A745
    classDef domain fill:#FFE5B4,stroke:#E36209
    classDef infrastructure fill:#E8DAFF,stroke:#6F42C1
    classDef state fill:#FFF4C1,stroke:#DBAB09
    classDef utility fill:#F0F0F0,stroke:#666666
    classDef deploy fill:#FDE2E1,stroke:#D73A49
    classDef external fill:#FFFFFF,stroke:#000000,stroke-dasharray: 2 2
```
