# tinhne/capstons2 architecture

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

## Overview

##### Project Type and Purpose
- This project is clearly a full-stack application with both a backend (Java/Spring Boot) and a frontend (React/TypeScript) component.
- The backend appears to handle functionalities around disease prediction, authentication, chat, and role/permission management (as seen from directories like “controllers” for Disease, Symptom, and Authentication; “models” for Disease, Symptom, and User; and “services” that encapsulate business logic).
- The frontend organizes features into sections such as authentication, administration (admin features), chat, and users, using Redux for state management and a component-driven design.

##### Analyzing the File Structure
- Backend:
- The “backend” directory follows a clear layered (MVC) architecture: configuration, controllers, DTOs, exceptions, mappers, models, repositories, and services (with separate implementation packages).
- Standard Spring Boot structures are present (e.g., Application class in BackendApplication.java) together with security configurations (JWT-based authentication).
- A build file (pom.xml) and Maven scripts ensure that it’s managed as a Java project.
- Frontend:
- The “frontend” directory is a typical React project enhanced with TypeScript, Redux for state management, and organized by features (e.g., “auth”, “chat”, “admin”, “users”), along with shared resources (contexts, hooks, utils, layouts).
- It contains build and configuration files (e.g., vite.config.ts, tailwind.config.js) which indicate modern tooling for a web application.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Group
    subgraph "Frontend"
        FE["React Frontend"]:::frontend
        subgraph "Modules"
            A["Authentication Module"]:::module
            B["Admin Module"]:::module
            C["Chat Module"]:::module
            D["User Management Module"]:::module
        end
    end

    %% Backend Group
    subgraph "Backend"
        BE["Spring Boot Backend Server"]:::backend
        E["Backend Application Entry Point"]:::backend
        F["Security & Configuration"]:::backend
        G["Controllers"]:::backend
        H["Services & Business Logic"]:::backend
        I["Data Access (Repositories)"]:::backend
        J["Domain Models"]:::backend
    end

    %% Database
    DB["Database (Relational)"]:::db

    %% Relationships between Frontend and Backend
    FE -->|"calls"| BE
    BE -->|"initializes"| E
    E -->|"routes to"| G

    %% API Calls from Frontend Modules to Controllers
    A -->|"authAPI"| G
    B -->|"adminAPI"| G
    C -->|"chatAPI"| G
    D -->|"userAPI"| G

    %% Backend internal flow
    G -->|"delegates"| H
    H -->|"invokes"| I
    I -->|"performsCRUD"| DB

    %% Security aspects (dashed lines)
    G -.->|"secures"| F
    H -.->|"secures"| F

    %% Domain Models usage (dotted lines)
    G ---|"uses"| J
    H ---|"uses"| J
    I ---|"mapsTo"| J

    %% Click Events
    click FE "https://github.com/tinhne/capstons2/tree/main/frontend"
    click A "https://github.com/tinhne/capstons2/tree/main/frontend/src/features/auth"
    click B "https://github.com/tinhne/capstons2/tree/main/frontend/src/features/admin"
    click C "https://github.com/tinhne/capstons2/tree/main/frontend/src/features/chat"
    click D "https://github.com/tinhne/capstons2/tree/main/frontend/src/features/users"
    click BE "https://github.com/tinhne/capstons2/tree/main/backend"
    click E "https://github.com/tinhne/capstons2/blob/main/backend/src/main/java/com/prediction/backend/BackendApplication.java"
    click F "https://github.com/tinhne/capstons2/tree/main/backend/src/main/java/com/prediction/backend/config"
    click G "https://github.com/tinhne/capstons2/tree/main/backend/src/main/java/com/prediction/backend/controllers"
    click H "https://github.com/tinhne/capstons2/tree/main/backend/src/main/java/com/prediction/backend/services"
    click I "https://github.com/tinhne/capstons2/tree/main/backend/src/main/java/com/prediction/backend/repositories"
    click J "https://github.com/tinhne/capstons2/tree/main/backend/src/main/java/com/prediction/backend/models"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#F4A460,stroke:#000,stroke-width:2px;
    classDef module fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef db fill:#FFDEAD,stroke:#000,stroke-width:2px;
```
