# thangnghiendua/website architecture

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

## Overview

##### Main Components
- Backend Service(s):
- Core Application Modules: "VaccineManagement" which houses the primary business logic.
- Domain Models: Entities like Appointment, Child, Doctor, Payment, User, Vaccine, Wallet, etc.
- Repositories: Data access layers (AppointmentRepository, ChildRepository, etc.) that interface with the database.
- Services: Business logic modules (AppointmentService, UserService, VaccineService, etc.) which process application-specific rules.
- Security Layer: Spring Security components (SecurityConfig, CustomUserDetails) that control authentication and authorization.
- Frontend/UI Layer:
- Templates: HTML templates (e.g., admin pages, children booking views, orders, schedule pages).
- Database:
- Underlying SQL database schema (indicated by VMDB.sql) where persistent data (users, appointments, vaccine records and feedback) are stored.

##### Relationships and Interactions
- The user interface interacts with the backend via standard HTTP requests. For example, a user accessing a vaccination booking page triggers controller logic in the backend.
- Controllers (which may be implicitly present) receive HTTP requests, call the relevant service to process the business logic, and then interact with the repositories to perform CRUD operations on the database.
- The security module intercepts requests and ensures that valid credentials or roles are in place before the request proceeds.

##### Architectural Patterns and Design Principles
- MVC (Model-View-Controller): With clear separation between the front-end templates (views) and business logic in the backend.
- Layered Architecture: Distinction is clear between the presentation layer (templates and static assets), business layer (services), data access layer (repositories), and security layer.
- Dependency Injection: Leveraged by the Spring framework to decouple components (services and repositories).

##### Technologies, Frameworks, and Libraries
- Spring Boot: The core framework for the backend.
- Spring Security: For authentication and authorization.
- Maven: Build and dependency management tool.
- Thymeleaf (or similar templating engine): For server-side rendering of HTML templates.
- Standard SQL database (likely MySQL or PostgreSQL based on the VMDB.sql file).

## Diagram (Mermaid)

```mermaid
graph TD
    User["User Browser"]:::frontend

    subgraph "Frontend Layer"
        UI_Templates_A["UI Templates (VaccineManagement)"]:::frontend
        UI_Templates_B["UI Templates (src)"]:::frontend
        Static["Static Assets (CSS/JS/Images)"]:::frontend
    end

    subgraph "Backend Layer"
        Core["Core Modules"]:::backend
        Controllers["Controllers"]:::backend
        Services["Services (Business Logic)"]:::backend
        Repositories["Repositories (Data Access)"]:::backend
        Models["Domain Models"]:::backend
        Security["Security (Spring Security)"]:::security
    end

    subgraph "Database Layer"
        DB["SQL Database (VMDB.sql)"]:::database
    end

    User -->|"HTTP_Request"| UI_Templates_A
    User -->|"HTTP_Request"| UI_Templates_B
    User -->|"HTTP_Request"| Static

    UI_Templates_A -->|"Calls"| Controllers
    UI_Templates_B -->|"Calls"| Controllers
    Static -->|"Provides"| Controllers

    Core -->|"Contains"| Controllers
    Core -->|"Contains"| Services
    Core -->|"Contains"| Repositories
    Core -->|"Contains"| Models
    Core -->|"Contains"| Security

    Controllers -->|"Delegates"| Services
    Services -->|"Uses"| Models
    Services -->|"Calls"| Repositories
    Security ---|"Intercepts"| Controllers
    Repositories -->|"Queries"| DB

    click Core "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/java/ut/edu/vaccinemanagement"
    click Models "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/java/ut/edu/vaccinemanagement/models"
    click Repositories "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/java/ut/edu/vaccinemanagement/Repositories"
    click Services "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/java/ut/edu/vaccinemanagement/Services"
    click Security "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/java/ut/edu/vaccinemanagement/Security"
    click UI_Templates_A "https://github.com/thangnghiendua/website/tree/main/VaccineManagement/src/main/resources/templates"
    click UI_Templates_B "https://github.com/thangnghiendua/website/tree/main/src/main/resources/templates"
    click Static "https://github.com/thangnghiendua/website/tree/main/src/main/resources/static"
    click DB "https://github.com/thangnghiendua/website/blob/main/VMDB.sql"

    classDef frontend fill:#cce5ff,stroke:#007bff,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:2px;
    classDef security fill:#f8d7da,stroke:#dc3545,stroke-width:2px;
    classDef database fill:#fff3cd,stroke:#ffc107,stroke-width:2px;
```
