# thepokenik/clover architecture

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

- Interactive diagram: https://gitdiagram.com/thepokenik/clover
- Repository: https://github.com/thepokenik/clover

## Overview

##### Overall project components
- Frontend: A React-based application (using Vite for building and Tailwind CSS for styling) housed in the “frontend” directory. It contains pages, components, utilities, and assets.
- Backend: A Spring Boot API (Java, managed via Maven) in the “backend/API” directory. This layer follows a common layered architecture with controllers, services, repositories, and entity definitions.
- Database: Although not explicitly shown in the file tree (e.g., no “mongo” directory files), the README notes the usage of MongoDB.
- Containerization & Deployment: Notice Dockerfiles for both the backend and frontend, along with a docker-compose.yml at the project root which suggests container orchestration.

##### Main components and sub-components
a. Frontend Container:
- UI Layer: Pages (e.g., auth, annotation, issues, projects, roadmap, settings, welcome) and a rich set of reusable UI components.
- Infrastructure: Routing, context providers, and integration utilities (for example, the “infra/url.jsx” and “lib” directories).
- Tooling: Vite, ESLint, Tailwind, and Docker deployment configuration.

b. Backend Container:
- API Controllers: Organized under “src/main/java/com/goncalves/API/controller”, these modules (e.g., AuthenticationController, FilesController, IssueController, etc.) expose RESTful endpoints.
- Business Services: In “src/main/java/com/goncalves/API/service”, encapsulating business logic such as authentication, email notifications, token handling, and project management.
- Data Access Layer: Repositories under “entities” folders for annotations, commits, files, issues, notifications, users, etc.
- Infrastructure & Configuration: Security, exception handling, seeds for initial data, and configuration files under “src/main/java/com/goncalves/API/infra”.
- Build & Containerization: Maven build scripts, Dockerfile for containerizing the API, and related configuration.

c. Database:
- MongoDB: As per the README, use MongoDB to store project data such as versioned files, annotations, commit histories, user data, and notifications.

d. DevOps/Deployment:
- Orchestration: The docker-compose.yml likely defines how the frontend, backend, and database containers interact.
- Docker: Individual Dockerfiles in both frontend and backend allow isolated environment setup.

- Requests from the Frontend to the Backend (HTTP/HTTPS REST API calls).
- CRUD operations from the Backend to the MongoDB database.
- Containerization orchestration (via docker-compose) as an outer boundary that encapsulates the containers.

##### Architectural Patterns and Design Principles
- Separation of concerns:
- Frontend: Presentation layer with components, pages, and routing.
- Backend: Follows an MVC-like or layered architecture separating controllers (handling HTTP requests), services (business logic), and repositories (persistence).
- Use of RESTful API design.
- Exception handling, security filters, and middleware components in the backend (e.g., SecurityConfiguration, SecurityFilter, and various exception handlers).

##### Relevant Technologies
- Frontend technologies: React, Vite, Tailwind CSS.
- Backend technologies: Java, Spring Boot, Maven.
- Database: MongoDB.
- Containerization: Docker and docker-compose.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Deployment (docker-compose)"
        subgraph "Frontend Container (React with Vite)"
            F1["UI Layer: Pages"]:::frontend
            F2["UI Layer: Components"]:::frontend
            F3["Infrastructure: Routing & Integration"]:::frontend
            F5["Vite Config"]:::frontend
            F6["Tailwind Config"]:::frontend
        end
        subgraph "Backend Container (Spring Boot)"
            B1["Controllers"]:::backend
            B2["Services"]:::backend
            B3["Repositories/Entities"]:::backend
            B4["Infrastructure & Config"]:::backend
            B5["Maven Build"]:::backend
            B6["API Entry"]:::backend
        end
        DB["MongoDB"]:::database
    end

    subgraph "Containerization & Deployment Tools"
        D1["Dockerfile (Frontend)"]:::deployment
        D2["Dockerfile (Backend)"]:::deployment
        D3["docker-compose.yml"]:::deployment
    end

    %% Data Flow Connections
    F3 -->|"HTTP/HTTPS_API"| B1
    B1 -->|"calls"| B2
    B2 -->|"accesses"| B3
    B3 -->|"CRUD_ops"| DB

    %% Orchestration Connections
    D3 -->|"orchestrates"| F1
    D3 -->|"orchestrates"| B1
    D3 -->|"orchestrates"| DB

    %% Click Events for Frontend Components
    click F1 "https://github.com/thepokenik/clover/tree/develop/frontend/src/pages"
    click F2 "https://github.com/thepokenik/clover/tree/develop/frontend/src/components"
    click F3 "https://github.com/thepokenik/clover/tree/develop/frontend/src/infra"
    click F5 "https://github.com/thepokenik/clover/blob/develop/vite.config.js"
    click F6 "https://github.com/thepokenik/clover/blob/develop/tailwind.config.js"

    %% Click Events for Backend Components
    click B1 "https://github.com/thepokenik/clover/tree/develop/backend/API/src/main/java/com/goncalves/API/controller"
    click B2 "https://github.com/thepokenik/clover/tree/develop/backend/API/src/main/java/com/goncalves/API/service"
    click B3 "https://github.com/thepokenik/clover/tree/develop/backend/API/src/main/java/com/goncalves/API/entities"
    click B4 "https://github.com/thepokenik/clover/tree/develop/backend/API/src/main/java/com/goncalves/API/infra"
    click B5 "https://github.com/thepokenik/clover/blob/develop/pom.xml"
    click B6 "https://github.com/thepokenik/clover/blob/develop/backend/API/ApiApplication.java"

    %% Click Events for Containerization Components
    click D1 "https://github.com/thepokenik/clover/tree/develop/frontend/Dockerfile"
    click D2 "https://github.com/thepokenik/clover/tree/develop/backend/API/Dockerfile"
    click D3 "https://github.com/thepokenik/clover/blob/develop/docker-compose.yml"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef backend fill:#c8e6c9,stroke:#1b5e20,stroke-width:2px;
    classDef database fill:#ffe0b2,stroke:#e65100,stroke-width:2px;
    classDef deployment fill:#e1bee7,stroke:#880e4f,stroke-width:2px;
```
