# razasoneji/cryptml architecture

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

- Interactive diagram: https://gitdiagram.com/razasoneji/cryptml
- Repository: https://github.com/razasoneji/cryptml

## Overview

##### Project Type and Purpose
- This is a full-stack application designed to automatically identify cryptographic algorithms using AI/ML, while also providing encryption services and secure user authentication.
- The project integrates a Spring Boot backend (with cryptographic and ML functionalities) and a React-based frontend, plus a machine learning component (Python-based Random Forest model).

##### Analyzing the File Structure
- The top-level separation into “Backend” and “Frontend” highlights a clear division between server-side logic and client-side presentation.
- In the Backend directory, you see standard Spring Boot structure with directories for controllers, services, repositories, exception handlers, configurations, and entities. This points to an MVC-style pattern.
- The Frontend directory comprises React components, UI pages, utility libraries, and Redux slices – indicating a modern, component-based UI architecture.
- You also have additional files (i.e. configuration files, presentation images, and sample scripts) that further illuminate the integration of ML modules.

##### Final Recommendation
- The endpoints mentioned in the README and highlight interactions between frontend and backend.
- To note the machine learning module’s role within the ML Controller and its interaction with the encryption and cryptographic data components.

## Diagram (Mermaid)

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

    subgraph "Frontend"
        F1["Frontend (React/Vite)"]:::frontend
        F2["UI Components & Pages"]:::frontend
        F3["State Management (Redux)"]:::frontend
    end

    subgraph "Backend (Spring Boot)"
        BA["Backend Application Entry"]:::backend
        subgraph "Controllers"
            B1["AuthController"]:::backend
            B2["AlgorithmController"]:::backend
            B3["CryptographicDataController"]:::backend
            B4["EncryptionController"]:::backend
            B5["MLController"]:::backend
            B6["UserController"]:::backend
        end
        subgraph "Services"
            S1["Business Logic Services"]:::backend
        end
        subgraph "Repositories"
            R1["Data Access (Repositories)"]:::backend
        end
        Sec["Security (Spring Security & JWT)"]:::sec
        SecFilter["JWT Filter"]:::sec
        Ex["GlobalExceptionHandler"]:::backend
        AC["Application Configs (application.properties)"]:::backend
    end

    subgraph "Machine Learning Module"
        M1["predict.py"]:::ml
        M2["model.pickle"]:::ml
    end

    DB["Database (PostgreSQL)"]:::db

    U -->|"uses"| F2
    F1 --> F2
    F1 --> F3
    F2 -->|"API_call"| BA

    BA -->|"routes"| B1
    BA -->|"routes"| B2
    BA -->|"routes"| B3
    BA -->|"routes"| B4
    BA -->|"routes"| B5
    BA -->|"routes"| B6
    BA --> Sec
    Sec --> SecFilter

    B1 -->|"calls"| S1
    B2 -->|"calls"| S1
    B3 -->|"calls"| S1
    B4 -->|"calls"| S1
    B5 -->|"calls"| S1
    B6 -->|"calls"| S1

    S1 -->|"calls"| R1
    R1 -->|"queries"| DB

    B5 -->|"ML_call"| M1
    B5 -->|"ML_call"| M2

    Ex --> S1

    click F1 "https://github.com/razasoneji/cryptml/tree/main/Frontend/"
    click F2 "https://github.com/razasoneji/cryptml/tree/main/Frontend/src/components"
    click F3 "https://github.com/razasoneji/cryptml/tree/main/Frontend/src/redux"
    click BA "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/BackendApplication.java"
    click B1 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/AuthController.java"
    click B2 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/AlgorithmController.java"
    click B3 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/CryptographicDataController.java"
    click B4 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/EncryptionController.java"
    click B5 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/MLController.java"
    click B6 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Controllers/UserController.java"
    click S1 "https://github.com/razasoneji/cryptml/tree/main/Backend/src/main/java/com/project/backend/Services"
    click R1 "https://github.com/razasoneji/cryptml/tree/main/Backend/src/main/java/com/project/backend/Repositories"
    click Sec "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Configurations/WebSecurityConfig.java"
    click SecFilter "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/Filters/JwtAuthFilter.java"
    click AC "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/resources/application.properties"
    click M1 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/resources/scripts/predict.py"
    click M2 "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/resources/scripts/model.pickle"
    click Ex "https://github.com/razasoneji/cryptml/blob/main/Backend/src/main/java/com/project/backend/ExceptionHandler/GlobalExceptionHandler.java"

    classDef frontend fill:#e0f7fa,stroke:#006064,stroke-width:2px;
    classDef backend fill:#ffecb3,stroke:#ff9800,stroke-width:2px;
    classDef db fill:#dcedc8,stroke:#8bc34a,stroke-width:2px;
    classDef ml fill:#f8bbd0,stroke:#e91e63,stroke-width:2px;
    classDef sec fill:#e1bee7,stroke:#9c27b0,stroke-width:2px;
```
