# bennyz327/gallxiv architecture

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

- Interactive diagram: https://gitdiagram.com/bennyz327/gallxiv
- Repository: https://github.com/bennyz327/gallxiv

## Overview

##### Project Components and Their Roles
- Frontend:
- Built with Vue 3 using the Composition API.
- Contains components, views, and a routing system (via Vue Router). It uses Pinia for state management.
- Includes an "api" directory with both auto-generated hooks and custom API integrations to interact with the backend.
- Backend:
- Developed with Spring Boot.
- Organized into clear layers: configurations (security, JWT, web), controllers (handling RESTful APIs for user authentication, post management, and media handling), services (business logic), repositories (data access) and DTOs/entities for database mapping.
- Uses Gradle for builds (see build.gradle.kts) and has its main configuration in application.yml.
- Supporting and Deployment Components:
- There is a docker-compose YAML for running the database container.
- Gradle and Docker configurations indicate an environment ready for containerized deployment and continuous integration.

##### Relationships and Data Flow
- Frontend ↔ Backend: The frontend sends API requests (using auto-generated API hooks) to the backend for authentication, posting, and media retrieval.
- Backend ↔ Database: The backend (via repositories) communicates with the database for CRUD operations.
- Docker: Optionally, include a database container node (launched via docker-compose) that interacts with the backend.

##### Architectural Patterns and Design Principles
- The backend follows a layered architecture (commonly MVC/MVCS) where RESTful controllers invoke service methods, which in turn interact with repository components.
- JWT-based security is enforced, so clearly illustrate the authentication flow from the frontend login (invoking AuthHooks) to the backend’s security filters and controllers.
- The API layer in the frontend is generated and extended, showing clear separation of concerns.
- Modularity as components are split between frontend (views, components, plugins) and backend (controllers, services, data layers).

##### Technologies and Frameworks
- Frontend: Vue 3, Vite (configuration defined in vite.config.ts), Pinia (state management), Vuetify (UI elements via a plugin).
- Backend: Java 17, Spring Boot, Gradle, and JWT for authentication.
- Additional: Docker for containerization (especially for the database), plus API auto-generation tools visible through the API directories.

- Under the “Backend” block, create sections such as “Configuration” (for security and web config), “Controllers” (for Auth, Post, Media endpoints), “Services” (business logic), and “Repositories” (data access).
- For the frontend:
- Out major directories such as “views”, “components”, “router”, and “API hooks”, ensuring you show how these connect to the backend.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::frontend

    subgraph "Frontend"
        FE["Vue 3 Frontend"]:::frontend
        Router["Vue Router"]:::frontend
        Pinia["Pinia State Management"]:::frontend
        API_Auto["API Integration: Auto-generated Hooks"]:::frontend
        API_Custom["API Integration: Custom Hooks"]:::frontend
    end

    subgraph "Backend"
        BackendApp["Spring Boot Application"]:::backend
        Config["Configuration (Security,JWT,Web)"]:::backend
        Controllers["Controllers (Auth,Post,Media)"]:::backend
        Services["Services (Business Logic)"]:::backend
        Repositories["Repositories (Data Access)"]:::backend
        DTO["DTOs"]:::backend
        Entities["Entities"]:::backend
        Gradle["Build (Gradle)"]:::backend
    end

    Database["Database Container"]:::db

    User --> FE
    FE --> Router
    FE --> Pinia
    FE --> API_Auto
    FE --> API_Custom
    API_Auto -->|"calls"| Controllers
    API_Custom -->|"calls"| Controllers

    BackendApp --> Config
    BackendApp --> Controllers
    Config --> Controllers
    Controllers -->|"invokes"| Services
    Services -->|"uses"| Repositories
    Controllers -->|"transfers"| DTO
    Services -->|"processes"| DTO
    Repositories --> Entities
    Repositories -->|"CRUD"| Database
    Gradle --> BackendApp

    click FE "https://github.com/bennyz327/gallxiv/tree/main/frontend/src"
    click Router "https://github.com/bennyz327/gallxiv/blob/main/frontend/src/router/index.ts"
    click Pinia "https://github.com/bennyz327/gallxiv/tree/main/frontend/src/stores"
    click API_Auto "https://github.com/bennyz327/gallxiv/tree/main/frontend/src/api/generated"
    click API_Custom "https://github.com/bennyz327/gallxiv/tree/main/frontend/src/api/generated-override"
    click BackendApp "https://github.com/bennyz327/gallxiv/blob/main/src/main/kotlin/com/benjk/gallexiv/GallexivApplication.kt"
    click Config "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/config"
    click Controllers "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/controller"
    click Services "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/service"
    click Repositories "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/repository"
    click DTO "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/data/dto"
    click Entities "https://github.com/bennyz327/gallxiv/tree/main/src/main/kotlin/com/benjk/gallexiv/data/entity"
    click Database "https://github.com/bennyz327/gallxiv/blob/main/docker-compose-database.yml"
    click Gradle "https://github.com/bennyz327/gallxiv/blob/main/build.gradle.kts"

    classDef frontend fill:#AED6F1,stroke:#000,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#000,stroke-width:2px;
    classDef db fill:#A9DFBF,stroke:#000,stroke-width:2px;
```
