# elvis-crespo/dimak-front architecture

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

- Interactive diagram: https://gitdiagram.com/elvis-crespo/dimak-front
- Repository: https://github.com/elvis-crespo/dimak-front

## Overview

##### Project Type and Purpose
- This is a single-page application (SPA) built with React and Vite.
- It provides vehicle, installation, and card management screens (CRUD operations) and uses Redux for global state plus custom hooks for form handling and data fetching.
- No backend code is present here; assume data comes from an external RESTful API.

##### File Structure
- Top-level:
- public/ (static assets & root HTML)
- src/
– Pages/ (route-level components)
– components/ (reusable UI pieces)
– Hooks/ (custom React hooks for business logic)
– redux/ (store + reducers)
– utils/ (Axios instance, theme toggling, validation, config)
– main.jsx & App.jsx (bootstrapping & routing)
- Config files: vite.config.js, eslint.config.js, package.json.

##### Extract Key Architectural Insights from README
- Uses Vite for fast dev server + HMR.
- Relies on @vitejs/plugin-react (Babel) for Fast Refresh.
- No mention of backend in README; assume external API endpoints.

1. Browser / End-User Interface
2. Static Asset Server (Vite Dev Server in Dev or CDN/Static Web Host in Prod)
3. React Application Shell (App.jsx, Router, ProtectedRoute)
4. Presentation Layer (Pages & components/)
5. State Management Layer (Redux store + themeReducer, userReducer)
6. Business Logic Layer (custom Hooks)
7. Data Access Layer (axiosInstance in utils/)
8. External REST API (Authentication, Vehicles, Installations, Cards)
9. Static Assets (public/assets/images, Logo.jsx)
10. Developer Tools (ESLint, Vite HMR)

– User ⟶ Browser UI
– Browser ⟶ Static Asset Server (HTTP GET index.html, JS/CSS)
– React Shell ⟶ Presentation Components (prop down)
– Components Hooks ⟶ Data Access Layer ⟶ External API (GET/POST/etc.)
– API Responses ⟶ Hooks ⟶ Redux Store ⟶ Components (via useSelector/useDispatch)
– Theme Toggle (DarkModeToggle) ⟶ themeReducer ⟶ UI styling changes
– Form Hooks ⟶ validateFields ⟶ axiosInstance to submit data

c. Architectural Patterns & Principles
– SPA with client-side routing (React Router implied by pages setup).
– Unidirectional data flow: components dispatch actions → reducers → new state → components re-render.
– Separation of concerns:
- UI (components/Pages)
- State (redux/)
- Logic (Hooks/)
- Data (utils/axiosInstance)
– Theming via centralized config (utils/themes.js + themeReducer).

d. Key Technologies/Frameworks
– Vite (dev server, build)
– React (17/18)
– Redux (store + reducers)
– Axios (configured instance in utils)
– ESLint for code quality
– Custom Hooks for side-effects & form logic

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User & Browser Layer
    subgraph "User & Browser Layer"
        User["User"]:::external
        Browser["Browser UI"]:::ui
    end
    User -->|interacts with| Browser
    Browser -->|"HTTP GET index.html, JS, CSS"| StaticServer

    %% Static Asset Server
    subgraph "Static Asset Server"
        Public["public/"]:::infra
        Index["index.html"]:::infra
    end
    click Public "https://github.com/elvis-crespo/dimak-front/tree/master/public/"
    click Index "https://github.com/elvis-crespo/dimak-front/blob/master/index.html"

    StaticServer --> ReactShell

    %% React Application Shell
    subgraph "React Application Shell"
        Main["src/main.jsx"]:::frontend
        App["src/App.jsx"]:::frontend
        ProtectedRoute["ProtectedRoute.jsx"]:::frontend
    end
    click Main "https://github.com/elvis-crespo/dimak-front/blob/master/src/main.jsx"
    click App "https://github.com/elvis-crespo/dimak-front/blob/master/src/App.jsx"
    click ProtectedRoute "https://github.com/elvis-crespo/dimak-front/blob/master/src/components/ProtectedRoute.jsx"

    ReactShell --> Presentation

    %% Presentation Layer
    subgraph "Presentation Layer"
        Pages["src/Pages/"]:::ui
        Components["src/components/"]:::ui
    end
    click Pages "https://github.com/elvis-crespo/dimak-front/tree/master/src/Pages/"
    click Components "https://github.com/elvis-crespo/dimak-front/tree/master/src/components/"

    Presentation --> StateLayer
    Presentation --> HooksLayer

    %% State Management Layer
    subgraph "State Management Layer"
        Store["store.js"]:::state
        ThemeRed["themeReducer.js"]:::state
        UserRed["userReducer.js"]:::state
    end
    click Store "https://github.com/elvis-crespo/dimak-front/blob/master/src/redux/store.js"
    click ThemeRed "https://github.com/elvis-crespo/dimak-front/blob/master/src/redux/themeReducer.js"
    click UserRed "https://github.com/elvis-crespo/dimak-front/blob/master/src/redux/userReducer.js"

    StateLayer --> Presentation

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        AuthHook["useAuth.js"]:::logic
        FormHook["useForm.js"]:::logic
        DeleteHook["useDeleteVehicle.js"]:::logic
    end
    click AuthHook "https://github.com/elvis-crespo/dimak-front/blob/master/src/Hooks/useAuth.js"
    click FormHook "https://github.com/elvis-crespo/dimak-front/blob/master/src/Hooks/useForm.js"
    click DeleteHook "https://github.com/elvis-crespo/dimak-front/blob/master/src/Hooks/useDeleteVehicle.js"

    HooksLayer --> DataLayer
    ExternalAPI --> HooksLayer

    %% Data Access Layer
    subgraph "Data Access Layer"
        Axios["axiosInstance.js"]:::data
    end
    click Axios "https://github.com/elvis-crespo/dimak-front/blob/master/src/utils/axiosInstance.js"

    DataLayer --> ExternalAPI["External REST API"]:::external

    %% Utilities
    subgraph "Utilities"
        Themes["themes.js"]:::util
        Config["config.js"]:::util
        DarkToggle["DarkModeToggle.jsx"]:::util
        Validate["validateFields.js"]:::util
    end
    click Themes "https://github.com/elvis-crespo/dimak-front/blob/master/src/utils/themes.js"
    click Config "https://github.com/elvis-crespo/dimak-front/blob/master/src/utils/config.js"
    click DarkToggle "https://github.com/elvis-crespo/dimak-front/blob/master/src/utils/DarkModeToggle.jsx"
    click Validate "https://github.com/elvis-crespo/dimak-front/blob/master/src/utils/validateFields.js"

    ReactShell --> Utilities

    %% Static Assets
    subgraph "Static Assets"
        Assets["public/assets/images/"]:::infra
        Logo["Logo.jsx"]:::infra
        Logomin["Logomin.jsx"]:::infra
    end
    click Assets "https://github.com/elvis-crespo/dimak-front/tree/master/public/assets/images/"
    click Logo "https://github.com/elvis-crespo/dimak-front/blob/master/public/Logo.jsx"
    click Logomin "https://github.com/elvis-crespo/dimak-front/blob/master/public/Logomin.jsx"

    %% Developer Tools / Build Config
    subgraph "Developer Tools / Build Config"
        ViteCfg["vite.config.js"]:::infra
        ESLintCfg["eslint.config.js"]:::infra
    end
    click ViteCfg "https://github.com/elvis-crespo/dimak-front/blob/master/vite.config.js"
    click ESLintCfg "https://github.com/elvis-crespo/dimak-front/blob/master/eslint.config.js"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef frontend fill:#E0F7FA,stroke:#00796B,color:#00796B;
    classDef state fill:#E8F5E9,stroke:#388E3C,color:#388E3C;
    classDef logic fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef data fill:#FFE0B2,stroke:#F57C00,color:#E65100;
    classDef external fill:#F3E5F5,stroke:#8E24AA,color:#6A1B9A;
    classDef infra fill:#F5F5F5,stroke:#9E9E9E,color:#424242;
    classDef util fill:#FFFDE7,stroke:#FBC02D,color:#F57F17;
```
