# fleeforezz/melville architecture

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

## Overview

##### Main Components
- Server/Backend: This will be the core application logic that handles login, book management, user roles, and processing of user requests. Include components for the admin controls (dashboard management, user and content moderation) and authors (book upload and editing functionalities).
- Database & Storage: Illustrate the data persistence layer including a separate MSSQL Server (running via Docker) for structured data (users, books, categories, etc.). Add the MinIO server for storing various resources like images and book files.
- CI/CD Pipeline: Represent the continuous integration and deployment triggers that involve Jenkins (for build, code analysis with Sonarqube, and Dockerization) along with pushing images to DockerHub, managing Kubernetes manifests, and deploying via ArgoCD.
- Deployment Environment: Capture the Kubernetes cluster — with details like two nodes, multiple pods, and different namespaces for testing and production. Also, include deployment systems like the reverse proxy (Nginx Proxy Manager) and Cloudflare for DNS management.
- External Services: Although niche, it’s important to show integration with external authentication (login/signup with Google) and the integration with GitLab for source code management.

##### Establish Relationships and Interactions
- Interactions between the CI/CD tools (Jenkins, Sonarqube, DockerHub, ArgoCD) in the build/deployment pipeline.
- That the Kubernetes cluster receives new container images (versioned from DockerHub) as part of the ArgoCD deployment.

##### Architectural Patterns & Design Principles
- Separation of concerns by distinctly drawing the client (UI/UX as per the Figma link), server-side logic, and persistence layers.
- How the system leverages containerization (Docker for MSSQL, webapp containerization) and orchestration (Kubernetes).
- CI/CD flow with clear steps starting from commit detection in GitLab, through Jenkins build and testing, container image publication, manifest update, and final deployment by ArgoCD.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        FE("User-Centric Web UI (Frontend)"):::client
        FRes("UI/Assets (Resources)"):::client
    end

    %% Backend Services
    subgraph "Backend Services"
        BE("Core Application Logic (Backend)"):::backend
        API("API Gateway"):::backend
        Admin("Admin Controls"):::backend
        Author("Author Services"):::backend
    end

    %% Data Persistence Layer
    subgraph "Data Persistence Layer"
        MSSQL("MSSQL Database"):::database
        MinIO("MinIO Storage"):::database
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        Jenkins("Jenkins Build & Testing"):::cicd
        Sonar("Sonarqube Code Analysis"):::cicd
        DockerHub("DockerHub Repository"):::cicd
        ArgoCD("ArgoCD Deployment"):::cicd
        GitLab("GitLab Version Control"):::external
    end

    %% Deployment & Infrastructure
    subgraph "Deployment & Infrastructure"
        K8s("Kubernetes Cluster"):::infra
        Nginx("Nginx Proxy Manager"):::infra
        Cloudflare("Cloudflare DNS"):::infra
    end

    %% External Services
    subgraph "External Services"
        Google("Google Authentication"):::external
    end

    %% Interactions
    FE -->|"UserRequests"| API
    API -->|"Handles Calls"| BE
    BE -->|"Business Logic"| Admin
    BE -->|"Business Logic"| Author
    BE <-->|"APIResponses"| FE

    BE -->|"DataOps"| MSSQL
    BE -->|"Store/Fetch"| MinIO

    GitLab -->|"Commits"| Jenkins
    Jenkins -->|"CodeAnalysis"| Sonar
    Sonar -->|"BuildResults"| DockerHub
    DockerHub -->|"NewImage"| ArgoCD
    ArgoCD -->|"Deploys to"| K8s
    K8s -->|"Ingress Traffic"| Nginx
    Nginx -->|"DNS Routing"| Cloudflare

    %% External integrations
    FE -->|"OAUTH"| Google

    %% Click Events for Component Mapping
    click FE "https://github.com/fleeforezz/melville/blob/main/README.md"
    click FRes "https://github.com/fleeforezz/melville/tree/main/Resources"
    click BE "https://github.com/fleeforezz/melville/blob/main/README.md"
    click Jenkins "https://github.com/fleeforezz/melville/blob/main/README.md"
    click Sonar "https://github.com/fleeforezz/melville/blob/main/README.md"
    click DockerHub "https://github.com/fleeforezz/melville/blob/main/README.md"
    click ArgoCD "https://github.com/fleeforezz/melville/blob/main/README.md"
    click MSSQL "https://github.com/fleeforezz/melville/blob/main/README.md"
    click MinIO "https://github.com/fleeforezz/melville/blob/main/README.md"
    click K8s "https://github.com/fleeforezz/melville/blob/main/README.md"
    click Nginx "https://github.com/fleeforezz/melville/blob/main/README.md"
    click Cloudflare "https://github.com/fleeforezz/melville/blob/main/README.md"
    click Google "https://github.com/fleeforezz/melville/blob/main/README.md"
    click GitLab "https://github.com/fleeforezz/melville/blob/main/README.md"

    %% Styles
    classDef client fill:#ffcccc,stroke:#333,stroke-width:2px;
    classDef backend fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef database fill:#ffe6cc,stroke:#333,stroke-width:2px;
    classDef cicd fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef infra fill:#e6ccff,stroke:#333,stroke-width:2px;
    classDef external fill:#f9e79f,stroke:#333,stroke-width:2px;
```
