# hectormorgadoc/floriambra_report architecture

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

- Interactive diagram: https://gitdiagram.com/hectormorgadoc/floriambra_report
- Repository: https://github.com/hectormorgadoc/floriambra_report

## Overview

##### Project type and purpose
- This is a Vue 3 single-page application written in TypeScript and built with Vite.
- It lives entirely in the front end (served via Netlify/CDN) and communicates with an external “management” REST API (see src/api/managementApi.ts).
- It implements several functional modules (auth, client, order, process, report, team) plus common components and a landing page.

##### File structure
- Top-level:
- index.html, dist/, public/ – static entry and build output
- src/ – all application code
– src/main.ts – app bootstrap, Pinia store registration, router injection
– src/router/index.ts – Vue Router definitions
– src/api/managementApi.ts – HTTP wrapper for backend REST endpoints
– src/App.vue – root component
– src/landing – public landing page
– src/module – functional feature modules, each with action (API calls), interface (DTOs), stores (Pinia), views/layouts (UI)
– src/module/common – shared Vue components and interfaces
- Configuration:
- vite.config.ts, tsconfig*.json, .env.dev, netlify.toml

##### Key architectural patterns & principles
- Modular “feature‐based” organization: each domain (auth, client, order, process, report, team) lives in its own folder with its views, state, actions and interfaces.
- SFC + `<script setup>` for Vue components.
- Pinia for centralized state management (each store under src/module/*/stores).
- API layer abstraction (managementApi) decouples UI from HTTP details.
- Vue Router for navigation, guided by route guards in auth.

##### Main components
a. Front-end SPA (browser)
b. Module layers within the SPA:
- Landing & Auth Module (LoginView, route guards)
- Feature Modules (Client, Order, Process, Report, Team)
- Common Components (UI building blocks)
c. State Management (Pinia stores)
d. API Service (managementApi)
e. External Backend / REST Management API

##### Relationships and data flow
1) User → Browser → SPA
2) SPA → Vue Router → Module View
3) Module View → Pinia Store (action dispatch)
4) Store Action → managementApi (HTTP request) → Backend
5) Backend → HTTP response → managementApi → Store → View

##### Essential elements
- Clear component labels (e.g., “AuthStore”, “useClientCookies”, “RegisterClientAction”).
- A container boundary for the SPA vs. the external management API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    User["User"]:::user

    %% SPA Container
    subgraph "SPA (Vue 3 + Vite)" 
        direction TB
        %% Entry Point
        subgraph "Entry Point" 
            direction TB
            HTML["index.html"]:::static
            MainTS["main.ts"]:::bootstrap
            AppVue["App.vue"]:::component
        end

        %% Router
        Router["Router\n(src/router/index.ts)"]:::router

        %% UI Layer
        subgraph "UI Layer (Views)" 
            direction TB
            Landing["Landing.vue"]:::view
            subgraph "Auth Module Views"
                direction TB
                LoginView["LoginView.vue"]:::view
            end
            subgraph "Feature Modules Views"
                direction TB
                CardClient["CardInfoClient.vue"]:::view
                CardOrder["CardInfoOrder.vue"]:::view
                CardProcess["CardInfoProcess.vue"]:::view
                CardReport["CardInfoReport.vue"]:::view
                CardTeam["CardInfoTeam.vue"]:::view
            end
        end

        %% State Management
        subgraph "State Layer (Pinia Stores)"
            direction TB
            AuthStore["auth.store.ts"]:::store
            ClientStore["client.store.ts"]:::store
            OrderStore["order.store.ts"]:::store
            ProcessStore["process.store.ts"]:::store
            ReportStore["report.store.ts"]:::store
            TeamStore["team.store.ts"]:::store
        end

        %% API Layer
        subgraph "API Layer"
            direction TB
            APIService["managementApi.ts"]:::api
        end

        %% Auth Helpers
        subgraph "Auth Module Helpers"
            direction TB
            CheckAuth["check-auth.action.ts"]:::action
            LoginAction["login.action.ts"]:::action
            IsAuthGuard["is-authenticated.guard.ts"]:::guard
            IsNotAuthGuard["is-not-authenticated.guard.ts"]:::guard
            UseCookies["useClientCookies.ts"]:::composable
            UseStorage["useClientStorage.ts"]:::composable
        end
    end

    %% External Backend
    Backend["Management REST API"]:::external

    %% Flows
    User -->|access| HTML
    HTML --> MainTS
    MainTS --> AppVue
    AppVue --> Router
    Router -->|navigates to| Landing
    Router -->|navigate/Login| LoginView
    Router -->|guards| IsAuthGuard
    Router -->|guards| IsNotAuthGuard

    %% UI to Store
    Landing -->|dispatch| AuthStore
    LoginView -->|dispatch| AuthStore
    CardClient -->|dispatch| ClientStore
    CardOrder -->|dispatch| OrderStore
    CardProcess -->|dispatch| ProcessStore
    CardReport -->|dispatch| ReportStore
    CardTeam -->|dispatch| TeamStore

    %% Store to API
    AuthStore -->|calls| APIService
    ClientStore -->|calls| APIService
    OrderStore -->|calls| APIService
    ProcessStore -->|calls| APIService
    ReportStore -->|calls| APIService
    TeamStore -->|calls| APIService

    %% API to Backend
    APIService -->|HTTP request| Backend
    Backend -->|HTTP response| APIService

    %% API back to Store/View
    APIService -->|response data| AuthStore
    APIService -->|response data| ClientStore
    APIService -->|response data| OrderStore
    APIService -->|response data| ProcessStore
    APIService -->|response data| ReportStore
    APIService -->|response data| TeamStore

    %% Click Events
    click HTML "https://github.com/hectormorgadoc/floriambra_report/blob/main/index.html"
    click MainTS "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/main.ts"
    click AppVue "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/App.vue"
    click Router "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/router/index.ts"
    click Landing "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/landing/Landing.vue"
    click LoginView "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/views/LoginView.vue"
    click AuthStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/stores/auth.store.ts"
    click CheckAuth "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/action/check-auth.action.ts"
    click LoginAction "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/action/login.action.ts"
    click IsAuthGuard "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/guards/is-authenticated.guard.ts"
    click IsNotAuthGuard "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/guards/is-not-authenticated.guard.ts"
    click UseCookies "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/composable/useClientCookies.ts"
    click UseStorage "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/auth/composable/useClientStorage.ts"
    click ClientStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/client/stores/client.store.ts"
    click OrderStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/order/stores/order.store.ts"
    click ProcessStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/process/stores/process.store.ts"
    click ReportStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/report/stores/report.store.ts"
    click TeamStore "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/module/team/stores/team.store.ts"
    click APIService "https://github.com/hectormorgadoc/floriambra_report/blob/main/src/api/managementApi.ts"

    %% Styles
    classDef user fill:#ffe0b2,stroke:#e65100,color:#000
    classDef static fill:#fff3e0,stroke:#ffb74d
    classDef bootstrap fill:#e8f5e9,stroke:#2e7d32
    classDef component fill:#fffde7,stroke:#f9a825
    classDef router fill:#e3f2fd,stroke:#1e88e5
    classDef view fill:#ffecb3,stroke:#ffa000
    classDef store fill:#bbdefb,stroke:#1976d2
    classDef api fill:#c8e6c9,stroke:#388e3c
    classDef action fill:#d1c4e9,stroke:#7b1fa2
    classDef guard fill:#f3e5f5,stroke:#8e24aa
    classDef composable fill:#e0f7fa,stroke:#006064
    classDef external fill:#eceff1,stroke:#607d8b,stroke-dasharray: 5 5
```
