# eduardotejeda/beautiful_fleet architecture

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

- Interactive diagram: https://gitdiagram.com/eduardotejeda/beautiful_fleet
- Repository: https://github.com/eduardotejeda/beautiful_fleet

## Overview

This project appears to be a full-stack Node.js application called "Beautiful_fleet" that likely manages fleet-related data (such as vehicles, maintenance, fuel consumption, mileage, and users) via a set of CRUD operations. The system has clearly defined client and server parts, with the server handling data operations and communicating with a database (as indicated by the need to disable row-level security in the DB and the existence of a database connection module).

##### Main components
- Client Module: Represented by the "client" directory which contains files like app.js and a test file (archivodeprueba.js). This component is likely responsible for the user interface or frontend logic.
- Server Module: The "server" directory contains the main server file (app.js), a database connection module (dataBase.js), and a dedicated subdirectory "CRUD" for resource-specific operations (Combustible, Kilometraje, Mantenimiento, Usuario, Vehiculos). This encapsulates the backend logic.
- Database: While there is no explicit database type mentioned in the tree, the README notes configuration related to row-level security, implying that an external Database (likely PostgreSQL or a similar DB that uses RLS) is an integral part of the system.

##### Component interactions
- The Client interacts with the Server via API calls: The client-side code (in client/app.js) sends requests to the backend.
- The Server receives these API calls and routes them to the proper CRUD module (located under server/CRUD) that handles specific resources.
- The Server also interacts with the external Database via the dataBase.js module. It sends queries and operations necessary for CRUD functionalities.
- Dependencies; for instance, the use of Express for the server and Nodemon for development.

##### Detail key architectural patterns and technologies
- Modular Design: Each resource type (Combustible, Kilometraje, etc.) is separated into its own module, reflecting a clear separation-of-concerns within the backend.
- Full-Stack Separation: Distinct folders for client and server indicate a natural division between UI/front-end and backend/business logic.
- API-Driven Communication: The client is presumed to communicate with the server through RESTful endpoints.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Beautiful_fleet System"
        %% Client Section
        subgraph "Client (Frontend)"
            CA["Client App"]:::client
            CT["Test File"]:::client
        end

        %% Server Section
        subgraph "Server (Backend)"
            SA["Server App"]:::server
            DBM["DB Connector"]:::server
            subgraph "CRUD Services"
                CRD1["Combustible Module"]:::server
                CRD2["Kilometraje Module"]:::server
                CRD3["Mantenimiento Module"]:::server
                CRD4["Usuario Module"]:::server
                CRD5["Vehiculos Module"]:::server
            end
        end

        %% External Database
        DB["Database (RLS Disabled)"]:::db
    end

    %% Interactions
    CA -->|"APIRequests/Responses"| SA
    SA -->|"Route"| CRD1
    SA -->|"Route"| CRD2
    SA -->|"Route"| CRD3
    SA -->|"Route"| CRD4
    SA -->|"Route"| CRD5
    SA -->|"DBQueryCalls"| DBM
    DBM -->|"CRUDOps/Queries"| DB

    %% Click Events
    click CA "https://github.com/eduardotejeda/beautiful_fleet/blob/main/client/app.js"
    click CT "https://github.com/eduardotejeda/beautiful_fleet/blob/main/client/archivodeprueba.js"
    click SA "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/app.js"
    click DBM "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/dataBase.js"
    click CRD1 "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/CRUD/Combustible.js"
    click CRD2 "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/CRUD/Kilometraje.js"
    click CRD3 "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/CRUD/Mantenimiento.js"
    click CRD4 "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/CRUD/Usuario.js"
    click CRD5 "https://github.com/eduardotejeda/beautiful_fleet/blob/main/server/CRUD/Vehiculos.js"

    %% Styles
    classDef client fill:#cce5ff,stroke:#007bff,stroke-width:2px;
    classDef server fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef db fill:#ffeeba,stroke:#fd7e14,stroke-width:2px;
```
