# arnaud1404/luminashare architecture

> Architecture diagram of the GitHub repository arnaud1404/luminashare, 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/arnaud1404/luminashare
- Repository: https://github.com/arnaud1404/luminashare

## Overview

- Main Components:
- Frontend: Located in the "frontend" folder, built with Node.js (using Vue components like App.vue, Gallery.vue, etc.). This part handles user interactions through a web interface.
- Backend: A Spring Boot application (Java 17 with Maven) found under the "backend" directory. It exposes REST APIs through controllers (e.g., ImageController, FileController) and implements business logic via services and DAOs.
- Database: PostgreSQL, as indicated by the README prerequisites and environment variables. The backend interacts with the database (e.g., via ImageRepository) to store image metadata and possibly binary data.
- Image Processing Modules: The backend includes packages for imageProcessing (e.g., ColorProcessing, Convolution, GrayLevelProcessing) that indicate a modular design for handling photo analysis and transformations.
- File Handling: A separate module within the backend for managing files (handled by controllers and associated classes).

- Relationships and Data Flow:
- Users interact with the Frontend, which sends HTTP API calls to the Backend.
- The Backend processes these calls, invoking image processing when necessary and interacting with PostgreSQL to store/retrieve image data.
- Optionally, external image sources (e.g. picsum.photos for test images) can be shown as an external dependency from which image data can be fetched.
- Docker Compose is used to orchestrate these services in deployment.

- Architectural Patterns & Guidelines:
- Separation of concerns between the UI (frontend), API and business logic (backend), and data (database).
- Important modules inside the backend (controllers, services, DAOs, file handling & image processing) to clearly convey the responsibilities.

flowchart TD
direction LR
FE[Frontend
(Vue, Node.js)]:::frontend
BE[Backend API
(Spring Boot, Java 17)]:::backend
DB[Database
(PostgreSQL)]:::database
end

%% External Services and Components Module inside Backend
direction TB
IC[ImageController]:::controller
FC[FileController]:::controller
IS[ImageService]:::service
IDAO[ImageDao / DAO]:::dao
IP[Image Processing
end

%% User and External Image Service
USER[User]:::user
EXT[External Image Service
(picsum.photos)]:::external

%% Connections between User and Frontend
USER -->|HTTP Request/API Call| FE

%% Frontend communicates with Backend API
FE -->|REST API Calls
(upload, retrieve, process images)| BE

%% Backend API is composed of various modules
BE --> IC
BE --> FC
BE --> IS
BE --> IDAO
BE --> IP

%% Backend interacts with database
BE -->|JDBC / ORM| DB

%% Frontend might fetch demo images from external service
FE -->|Optional Fetch| EXT

%% Styling Classes
classDef frontend fill:#cce5ff,stroke:#339aff,stroke-width:2px;
classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
classDef database fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
classDef controller fill:#f8d7da,stroke:#dc3545,stroke-width:1px;
classDef service fill:#e2e3e5,stroke:#6c757d,stroke-width:1px;
classDef dao fill:#d1ecf1,stroke:#0c5460,stroke-width:1px;
classDef processing fill:#ffeeba,stroke:#fd7e14,stroke-width:1px;
classDef user fill:#f0f9ff,stroke:#007bff,stroke-width:2px;
classDef external fill:#e2f0cb,stroke:#8bc34a,stroke-width:2px;

##### A deployment boundary (Docker Compose) encompassing the frontend, backend, and database.
2. Detailed backend modules (controllers, service, DAO, and image processing) that are critical for image-centric business logic.
##### Interaction flows
- Users initiate requests to the Frontend.
- Frontend communicates via RESTful API calls to the Backend.
- The Backend handles business logic, interacts with internal modules, and connects to PostgreSQL.
- Optionally, the Frontend fetches test images from an external image service.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top-level Users and External Service
    USER("User"):::user
    EXT("External Image Service<br/>(picsum.photos)"):::external

    %% Deployment subgraph (Docker Compose Deployment)
    subgraph "Docker Compose Deployment"
        direction TB
        FE("Frontend<br/>(Vue, Node.js)"):::frontend
        BE("Backend API<br/>(Spring Boot, Java 17)"):::backend
        DB("Database<br/>(PostgreSQL)"):::database
    end

    %% Backend Modules subgraph
    subgraph "Backend Modules"
        direction TB
        IC("ImageController"):::controller
        FC("FileController"):::controller
        IS("ImageService"):::service
        IDAO("ImageDao/DAO"):::dao
        IR("ImageRepository"):::dao
        IP("Image Processing<br/>(Color,Convolution,GrayLevel)"):::processing
    end

    %% Build & Deployment Tools subgraph
    subgraph "Build & Deployment"
        direction TB
        MB("Maven Build<br/>(Backend)"):::build
        MF("Maven Build<br/>(Frontend)"):::build
        DF("Dockerfile"):::deploymentfile
        DC("docker-compose.yml"):::deploymentfile
    end

    %% Data Flow Connections
    USER -->|"HTTP_Request/API_Call"| FE
    FE -->|"REST_API_Calls"| BE
    FE -->|"OptionalFetch"| EXT
    BE --> IC
    BE --> FC
    BE --> IS
    BE --> IDAO
    BE --> IR
    BE --> IP
    BE -->|"JDBC/ORM"| DB

    %% Docker Compose orchestrates containers
    DC --> FE
    DC --> BE
    DC --> DB

    %% Click Events for Component Mapping
    click FE "https://github.com/arnaud1404/luminashare/tree/github_arnaud/frontend"
    click BE "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/BackendApplication.java"
    click IC "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/ImageController.java"
    click FC "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/FileHandler/FileController.java"
    click IS "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/ImageService.java"
    click IDAO "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/ImageDao.java"
    click IR "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/src/main/java/pdl/backend/Database/ImageRepository.java"
    click IP "https://github.com/arnaud1404/luminashare/tree/github_arnaud/backend/src/main/java/pdl/backend/imageProcessing"
    click MB "https://github.com/arnaud1404/luminashare/blob/github_arnaud/backend/pom.xml"
    click MF "https://github.com/arnaud1404/luminashare/blob/github_arnaud/frontend/pom.xml"
    click DF "https://github.com/arnaud1404/luminashare/tree/github_arnaud/Dockerfile"
    click DC "https://github.com/arnaud1404/luminashare/blob/github_arnaud/docker-compose.yml"

    %% Styling Classes
    classDef frontend fill:#cce5ff,stroke:#339aff,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef database fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef controller fill:#f8d7da,stroke:#dc3545,stroke-width:1px;
    classDef service fill:#e2e3e5,stroke:#6c757d,stroke-width:1px;
    classDef dao fill:#d1ecf1,stroke:#0c5460,stroke-width:1px;
    classDef processing fill:#ffeeba,stroke:#fd7e14,stroke-width:1px;
    classDef user fill:#f0f9ff,stroke:#007bff,stroke-width:2px;
    classDef external fill:#e2f0cb,stroke:#8bc34a,stroke-width:2px;
    classDef build fill:#d6d8db,stroke:#343a40,stroke-width:1px;
    classDef deploymentfile fill:#ffd1a4,stroke:#e07a5f,stroke-width:1px;
```
