# arianhaddadi/loghme architecture

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

- Interactive diagram: https://gitdiagram.com/arianhaddadi/loghme
- Repository: https://github.com/arianhaddadi/loghme

## Overview

##### Main Components
- Front-End Component:
- Represented by the “Front-End” directory: built with React.js.
- Includes key parts like components (LoginPage, HomePage, ProfilePage, etc.), state management (store, reducers), and utilities.
- Back-End Component:
- Located in the “Back-End” directory: built using Java, Spring, and Maven (pom.xml).
- Has a well-organized Domain layer segmented into Entities, DTOs, and Managers, a services layer dealing with business logic (e.g., CartService, OrderService, etc.), and supporting utilities for configurations, token generation (JWT filters), and data mapping.
- Presence of filters (e.g., CORSFilter and JwtAuthenticationFilter) for security.
- Includes periodic jobs for asynchronous updates (FoodPartyUpdater).
- Database Component:
- In the back-end’s deployment artifacts you see “databaseDeployment.yml,” suggesting a separate database container or service.
- Although the project code does not explicitly show repository or ORM packages, the DTOs and Entities strongly indicate interactions with a persistent store.
- Infrastructure & Deployment:
- Dockerfiles and docker-compose.yml for both Front-End and Back-End indicate containerized deployments.
- Kubernetes deployment manifests (backendDeployment.yml, frontendDeployment.yml, databaseDeployment.yml) suggest that orchestration is an essential part of the system.
- CI/CD pipelines configured (e.g., .gitlab-ci.yml) should be noted as part of the DevOps process.

##### Relationships and Interactions
- The Back-End handles business logic: receiving API calls, processing data via its service layer, managing JWT-based authentication (JwtAuthenticationFilter), and mapping entities using the ObjectMappers.
- The Containerized Environment:
- Docker containers for both front-end and back-end.
- Kubernetes orchestrating these containers along with the database pod.
- External interactions can be noted for user browsers (clients) sending requests and receiving responses.

##### Architectural Patterns and Design Principles
- Layered/MVC structure in the Back-End (Entities, DTOs, Managers, Services, Filters).
- Separation of concerns between client-side (UI components, state management) and server-side logic.
- Use of Object Mapping to separate persistence models from data transfer objects.
- Security and authentication via JWT and CORS filters.
- Containerization and orchestration indicated by Docker and Kubernetes files.

##### Detailed Elements to Capture
- For the Front-End: Identify the separation into components (pages like LoginPage, HomePage, ProfilePage, etc.), the role of the Redux store and reducers, and static assets served by Nginx.
- For the Back-End: Break down into sub-layers (Domain Entities, DTOs, Managers, Services) and highlight the middleware (Filters for CORS and JWT).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Layer
    subgraph "Client"
        Browser["User/Client (Browser)"]:::client
    end

    %% Front-End Layer
    subgraph "Front-End (React + Nginx)"
        FE_Nginx["Nginx Reverse Proxy"]:::frontend
        FE_React["React Components & State Management"]:::frontend
        FE_Config["Project Config (Package.json)"]:::frontend
    end

    %% Back-End Layer
    subgraph "Back-End (Spring Java)"
        BE_Controller["REST Controllers"]:::backend
        BE_Maven["Maven Configuration"]:::backend
        BE_Domain["Domain Layer (Entities, DTOs, Managers)"]:::backend
        BE_Services["Service Layer (Cart, Order, Login, etc.)"]:::backend
        BE_Filters["Security Filters (CORS, JWT)"]:::backend
        BE_ObjectMappers["Object Mappers"]:::backend
        BE_Jobs["Periodic Jobs (FoodPartyUpdater)"]:::backend
    end

    %% Infrastructure & Deployment Layer
    subgraph "Infrastructure & Deployment"
        %% Containerization
        subgraph "Containerization"
            DockerFE["Front-End Docker Container"]:::infra
            DockerBE["Back-End Docker Container"]:::infra
        end
        %% Local Orchestration
        subgraph "Local Orchestration"
            ComposeFE["Front-End docker-compose"]:::infra
            ComposeBE["Back-End docker-compose"]:::infra
        end
        %% Production Orchestration
        subgraph "Production Orchestration"
            KubeFE["Frontend K8s Deployment"]:::infra
            KubeBE["Backend K8s Deployment"]:::infra
        end
        %% CI/CD Pipelines
        subgraph "CI/CD"
            CICD_FE["Front-End GitLab CI"]:::infra
            CICD_BE["Back-End GitLab CI"]:::infra
        end
    end

    %% Database
    subgraph "Database"
        DB["Database Service"]:::database
    end

    %% Data Flow Connections
    Browser -- "HTTP/HTTPS" --> FE_Nginx
    FE_Nginx -- "Serves Static Files" --> FE_React
    FE_React -- "APICalls" --> BE_Controller
    BE_Controller -- "Processes" --> BE_Services
    BE_Controller -- "SecuredBy" --> BE_Filters
    BE_Services -- "BusinessLogic" --> BE_Domain
    BE_Services -- "MapsData" --> BE_ObjectMappers
    BE_Services -- "Schedules" --> BE_Jobs
    BE_Services -- "Persists" --> DB

    %% Infrastructure Connections
    FE_Nginx --- DockerFE
    BE_Controller --- DockerBE
    DockerFE --- ComposeFE
    DockerBE --- ComposeBE
    ComposeFE --- KubeFE
    ComposeBE --- KubeBE
    KubeFE --- DB
    CICD_FE --- DockerFE
    CICD_BE --- DockerBE

    %% Click Events for Front-End Components
    click FE_React "https://github.com/arianhaddadi/loghme/tree/master/Front-End/src"
    click FE_Nginx "https://github.com/arianhaddadi/loghme/blob/master/Front-End/nginx.conf"
    click FE_Config "https://github.com/arianhaddadi/loghme/blob/master/Front-End/package.json"

    %% Click Events for Back-End Components
    click BE_Controller "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java"
    click BE_Maven "https://github.com/arianhaddadi/loghme/blob/master/Back-End/pom.xml"
    click BE_Filters "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java/Filters"
    click BE_Services "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java/Services"
    click BE_Domain "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java/Domain"
    click BE_ObjectMappers "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java/ObjectMappers"
    click BE_Jobs "https://github.com/arianhaddadi/loghme/tree/master/Back-End/src/main/java/PeriodicJobs"

    %% Click Events for Infrastructure & Deployment
    click DockerFE "https://github.com/arianhaddadi/loghme/tree/master/Front-End/Dockerfile"
    click DockerBE "https://github.com/arianhaddadi/loghme/tree/master/Back-End/Dockerfile"
    click ComposeFE "https://github.com/arianhaddadi/loghme/blob/master/Front-End/docker-compose.yml"
    click ComposeBE "https://github.com/arianhaddadi/loghme/blob/master/Back-End/docker-compose.yml"
    click KubeFE "https://github.com/arianhaddadi/loghme/blob/master/Front-End/deployments/frontendDeployment.yml"
    click KubeBE "https://github.com/arianhaddadi/loghme/blob/master/Back-End/deployments/backendDeployment.yml"
    click DB "https://github.com/arianhaddadi/loghme/blob/master/Back-End/deployments/databaseDeployment.yml"
    click CICD_FE "https://github.com/arianhaddadi/loghme/blob/master/Front-End/.gitlab-ci.yml"
    click CICD_BE "https://github.com/arianhaddadi/loghme/blob/master/Back-End/.gitlab-ci.yml"

    %% Styles
    classDef client fill:#cce5ff,stroke:#1b6ca8,stroke-width:2px;
    classDef frontend fill:#bfd7ea,stroke:#336699,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef infra fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
    classDef database fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
```
