# cuonglmptit/pickleballcourtbookingsystem architecture

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

## Overview

##### Project Type and Purpose
- The system is a full-stack application for managing pickleball court bookings.
- It supports multiple client interfaces: a native Android mobile app (located under AndroidApp), a Vue-based web front-end (under VUEWebFE), and another web front-end in WebFE.
- The backend (located in the BACKEND directory) is built with C# (using .NET) and follows a layered architecture, with API controllers, service interfaces, DTOs, entities, repository implementations, and integrated database connection.
- The README links to additional documentation and UI design, indicating that the system is planned, designed, and likely intended for production-level booking operations.

##### Analyzing the File Structure
- The mobile layer (“AndroidApp”) is organized with clear separation between UI screens (activities, fragments) and the data/service layer (DTOs, models, repositories, and API service utilities).
- The web front-end is split between two implementations – one leveraging Vue (VUEWebFE) and another more classic HTML/CSS/JS version (WebFE). In VUEWebFE, you see components, views, and a Vue store indicating modern SPA architecture.
- The backend contains several projects:
- API project with a rich set of controllers for different business areas (e.g., AddressController, BookingController, AuthController, etc.).
- Domain/Core library containing DTOs, entities, enums, and service interfaces which indicates a domain-driven or layered design.
- Infrastructure layer providing repository implementations (e.g., AddressRepository, BookingRepository, etc.) and supporting database interactions.
- Additional configuration and SQL files (CreateDB.sql, backup scripts) point to an underlying relational database.
- There are also design & use case drawio files indicating that functional decomposition has been formally captured.

##### Main Components and Their Relationships
a. Client Applications:
- Android Mobile App (AndroidApp) – handles native mobile UI, communicates with the backend API.
- Web Applications:
- Vue Web Front-End (VUEWebFE) – modern SPA using Vue.js.
- Classic Web Front-End (WebFE) – based on standard HTML, CSS, and JavaScript.
b. Backend API:
- API Controllers (found in the PickleballCourtBookingSystem.Api folder) expose endpoints for authentication, booking management, court information, user management, etc.
- Service Layer (services and interfaces under the Core folder) contains business logic and adheres to patterns like dependency injection.
- Repository Layer (under Infrastructure) abstracts database operations.
c. Database:
- Though the DB itself isn’t explicitly a folder here, SQL files (e.g., CreateDB.sql, IndexSQL.sql) and the repository classes indicate a relational database (e.g., MySQL as seen in MySqlDbContext.cs) where all bookings, user data, etc., are stored.
d. External Services and Assets:
- Integration with image hosting via Cloudinary (referenced in CloudinaryController and CloudinarySettings.cs).

##### Architectural Patterns and Design Principles
- Layered/Onion Architecture: UI clients → API controllers → service layer → repository layer → database.
- Separation of concerns: distinct directories for client apps, backend API, business logic, and infrastructure.
- Use of DTOs for transferring data between layers.
- The design suggests a microservice-like separation within the monolith (different controllers for different concerns) even though it is a single backend solution.

##### Detail Level
- As many layers as possible without clutter: ideally, show the mobile client, Vue web front-end, and traditional web front-end each as distinct nodes.
- Within the backend, you might represent the API controllers in one block, the core services and business logic in another, and the repository/data access layer (connected to the database) in a third block.
- Being detailed is key, so if necessary, include subsidiary components like DTOs, cloud integrations, and external APIs – simply note these as additional service connectors.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Applications Subgraph
    subgraph "Client Applications"
        mClient["Mobile Client (Android)"]:::client
        vWeb["Modern Web Client (Vue SPA)"]:::client
        cWeb["Classic Web Client (WebFE)"]:::client
    end

    %% Backend API Subgraph
    subgraph "Backend API"
        apiCont["API Controllers"]:::backend
        svcLayer["Service Layer"]:::backend
        repoLayer["Repository Layer"]:::backend
    end

    %% Infrastructure Subgraph
    subgraph "Infrastructure & External"
        db["Relational Database"]:::database
        subgraph "External Services"
            cloudCtrl["Cloudinary Controller"]:::external
            cloudSet["Cloudinary Settings"]:::external
        end
    end

    %% Connections from Clients to Backend
    mClient -->|"HTTP Request"| apiCont
    vWeb -->|"HTTP Request"| apiCont
    cWeb -->|"HTTP Request"| apiCont

    %% Backend Layer Connections
    apiCont -->|"Process"| svcLayer
    svcLayer -->|"BusinessLogic"| repoLayer
    repoLayer -->|"CRUD"| db

    %% External Services Connection
    apiCont -->|"ImageUpload"| cloudCtrl
    cloudCtrl -->|"Config"| cloudSet

    %% Click Events
    click mClient "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/AndroidApp/app/"
    click vWeb "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/VUEWebFE/pickleball-web/"
    click cWeb "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/WebFE/"
    click apiCont "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/BACKEND/PickleballCourtBookingSystem/PickleballCourtBookingSystem.Api/Controllers/"
    click svcLayer "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/BACKEND/PickleballCourtBookingSystem/PickleballCourtBookingSystem.Core/Services/"
    click repoLayer "https://github.com/cuonglmptit/pickleballcourtbookingsystem/tree/main/BACKEND/PickleballCourtBookingSystem/PickleballCourtBookingSystem.Infrastructure/Repository/"
    click db "https://github.com/cuonglmptit/pickleballcourtbookingsystem/blob/main/CreateDB.sql"
    click cloudCtrl "https://github.com/cuonglmptit/pickleballcourtbookingsystem/blob/main/BACKEND/PickleballCourtBookingSystem/PickleballCourtBookingSystem.Api/Controllers/CloudinaryController.cs"
    click cloudSet "https://github.com/cuonglmptit/pickleballcourtbookingsystem/blob/main/BACKEND/PickleballCourtBookingSystem/PickleballCourtBookingSystem.Core/Entities/CloudinarySettings.cs"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef backend fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef database fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
```
