# vodoquangduong/spring2025swd392_net1709_gabong architecture

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

## Overview

This project is clearly a full-stack application that separates concerns into a frontend and a backend. The frontend, built with React (using TypeScript, Vite, Tailwind CSS, etc.), handles the user interface across multiple pages (e.g., Login, Register, Dashboard, Project details, Profile, etc.) and components (chat, notifications, modals, etc.). The backend is an ASP.NET Web API organized into a clearly layered structure with controllers (e.g., AccountController, BidController, NotificationController, etc.), business objects (domain models and enums), data access objects (DAOs with migrations and Entity Framework style mappings), repositories (abstracting data persistence responsibilities), and services (encapsulating business logic for authentication, project management, messaging, PayPal integration, and SignalR hubs for real-time notifications and chat).

##### Main Components
● Frontend: A React-based client application that manages routing (with multiple pages like Home, Dashboard, Profile, etc.) and state management using stores. Indicate that it uses Vite as the build tool and Tailwind CSS for styling.
● Backend API: The ASP.NET Core-based API including the Controllers layer that exposes endpoints, the Services layer (implementing business logic), the Repository layer for data access abstractions, and the DAOs for direct database communication. Include additional internal components such as the Business Objects (models, enums) and the DTOs (for data transfer between client and server).
● Database: A relational database (evidenced by SQL script files and migration history) that the backend uses via Entity Framework (or a similar ORM) to persist data.
● Real-Time Communication and External Integrations: Highlight the use of SignalR components (ChatHub, NotifyUserHub) for real-time communication. Also include integration with external services (e.g., PayPal as shown in the PayPal controller and related DTOs).

##### Relationships & Interactions
● Show the Backend interacting with the Database for CRUD operations via the DAOs and migrations.
● Include connections from the Backend’s SignalR hubs to the clients, demonstrating real-time bi-directional communication.
● Optionally, indicate auxiliary files/configs (e.g., Dockerfile for containerization) as part of the deployment pipeline.

##### Architectural Patterns & Design Principles
● The project follows layered (or N-tier) architecture segregating controllers, business logic, data access, and presentation (frontend).
● The backend is designed with separation of concerns: the Controllers handle HTTP requests, Services encapsulate business logic, and Repositories/DAOs manage database access.
● The frontend separates UI components, layouts, hooks, and state management into distinct modules.
● Use of DTOs and Mapper profiles hints at a careful mapping between internal domain models and external API models.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Layer
    subgraph "Frontend (React + Vite)"
        F1["Pages (Routing, Login, Register, Dashboard, Profile)"]:::frontend
        F2["Components (Chat, Notifications, Modals)"]:::frontend
        F3["State Management (Stores)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend API (ASP.NET Core)"
        subgraph "Controllers Layer"
            B1["API Controllers (Authentication, Bid, Notification, etc.)"]:::backend
            B1a["PayPal Controller"]:::backend
        end
        subgraph "Services Layer"
            B2["Business Logic (Authentication, Project Management, Messaging)"]:::backend
            B2a["PayPal Client"]:::backend
        end
        subgraph "Repositories & DAOs"
            B3["Repositories (Implements)"]:::backend
            B4["Repositories (Interfaces)"]:::backend
            B5["DAOs & Migrations"]:::backend
        end
        subgraph "Domain & Data Transfer"
            B6["Business Objects (Domain Models & Enums)"]:::backend
            B7["DTOs"]:::backend
        end
        B8["SignalR Hubs (Real-Time Communication)"]:::backend
    end

    %% External and Database
    E1["External PayPal Service"]:::external
    DB["Database (Relational, SQL Scripts & Config)"]:::database

    %% Interactions
    F1 -->|"RESTcall"| B1
    F2 -->|"RESTcall"| B1
    F3 -->|"RESTcall"| B1

    B1 -->|"calls"| B2
    B1 -->|"maps"| B7
    B1a -->|"routes to"| B2a

    B2 -->|"uses"| B3
    B2 -->|"uses"| B4
    B2 -->|"accesses"| B5
    B2 -->|"triggers"| B8

    B5 -->|"CRUD"| DB

    B2a -->|"externalCall"| E1

    B8 -->|"pushesUpdates"| F1

    %% Click Events
    click F1 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/frontend/src/pages"
    click F2 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/frontend/src/components"
    click F3 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/frontend/src/stores"
    click B1 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/API/Controllers"
    click B1a "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/blob/main/backend/API/Controllers/PayPalController.cs"
    click B2 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/Services/Implements"
    click B2a "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/blob/main/backend/Services/Implements/PayPalClient.cs"
    click B3 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/Repositories/Implements"
    click B4 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/Repositories/Interfaces"
    click B5 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/DAOs"
    click B6 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/BusinessObjects"
    click B7 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/Helpers/DTOs"
    click B8 "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/backend/Helpers/SignalR"
    click DB "https://github.com/vodoquangduong/spring2025swd392_net1709_gabong/tree/main/database"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef backend fill:#f8d7da,stroke:#842029,stroke-width:2px;
    classDef database fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
