# idiotman-2212/busticketbooking-fullstack architecture

> Architecture diagram of the GitHub repository idiotman-2212/busticketbooking-fullstack, 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/idiotman-2212/busticketbooking-fullstack
- Repository: https://github.com/idiotman-2212/busticketbooking-fullstack

## Overview

##### Main system components
- Backend API Server (BusTicketBooking-Backend): This module is built using Spring Boot and organized with a clear layered structure (controllers, services, repositories, models, DTOs, and configurations). It handles authentication, booking, notifications, reports, payment history, and more.
- Notification Scheduler Service: A dedicated Spring Boot application tasked with managing scheduled tasks for notification (and potentially email messaging) related to bookings.
- Frontend – Admin Application: A ReactJS application that provides an admin dashboard covering management of buses, drivers, tickets, users, reports, etc.
- Frontend – Customer Application: A ReactJS application dedicated to the customer experience (booking tickets, managing profiles, viewing notifications, etc.).
- Database: A MySQL backend to persist data (with provided SQL scripts for schema creation).
- External Services: (Implicitly) any external email or SMS services might be used by Notification Scheduler, or other third-party services integrated within the application.

##### Relationships and interactions between components
- Backend API Server communicating with the MySQL Database. This encompasses CRUD operations (using Spring Data repositories) and interactions defined in the service layer.
- Swagger/OpenAPI documentation as a component within the backend (accessible at http://localhost:8080/swagger-ui/index.html#) to indicate API documentation.

##### Architectural patterns and design principles
- Separation of Concerns – Clearly delineate between the Admin and Customer frontends as separate apps, each with its own folder and routing structure.
- Microservices / Decoupled Services – Represent the Notification Scheduler Service as an independent module with a well-defined role, highlighting its scheduling and messaging responsibilities.
- Configured external integrations – Although not detailed to the lowest level, represent where external services (email/SMS) might interface with your Notification service.

##### Relevant technologies and frameworks
- Spring Boot, Maven, Java – For backend API and Notification service.
- ReactJS – For both the Admin and Customer interfaces.
- MySQL – As the database.
- Maven for build and dependency management.
- Swagger/OpenAPI – For API documentation.
- Additional utilities and configuration classes (like WebSocket configuration, JWT for authentication, asynchronous processing, etc.) can be noted within the backend module.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Components
    AF("Admin Frontend"):::frontend
    CF("Customer Frontend"):::frontend

    %% Backend API Server Subgraph
    subgraph "Backend API Server"
        BA["BusTicketBooking-Backend"]:::backend
        CTR("Controllers"):::backendLayer
        SRV("Services"):::backendLayer
        REP("Repositories"):::backendLayer
        SWG("Swagger Documentation"):::backendLayer
    end

    %% Notification Scheduler Service
    NSS("Notification Scheduler Service"):::scheduler

    %% Database
    DB("MySQL Database"):::database

    %% External Services (Email/SMS)
    ES("External Email/SMS Services"):::external

    %% Flow from Frontends to Backend
    AF -->|"HTTP_API_call"| CTR
    CF -->|"HTTP_API_call"| CTR

    %% Backend internal layered flow
    BA --> CTR
    CTR -->|"logic"| SRV
    SRV -->|"persistence"| REP
    CTR -->|"docs"| SWG

    %% Database interactions
    REP -->|"CRUD_operations"| DB
    NSS -->|"read/write"| DB

    %% Notifications and External Services
    SRV -->|"trigger_notification"| NSS
    NSS -->|"send_alerts"| ES

    %% Click Events
    click BA "https://github.com/idiotman-2212/busticketbooking-fullstack/tree/main/BusTicketBooking-Backend/"
    click NSS "https://github.com/idiotman-2212/busticketbooking-fullstack/tree/main/NotificationSchedulerService/"
    click AF "https://github.com/idiotman-2212/busticketbooking-fullstack/tree/main/BusTicketBooking-Frontend-Admin/"
    click CF "https://github.com/idiotman-2212/busticketbooking-fullstack/tree/main/BusTicketBooking-Frontend-Customer/"
    click DB "https://github.com/idiotman-2212/busticketbooking-fullstack/tree/main/Database/"
    click SWG "https://github.com/idiotman-2212/busticketbooking-fullstack/blob/main/BusTicketBooking-Backend/src/main/java/com/ticketbooking/config/swagger/OpenApiConfig.java"

    %% Styles
    classDef backend fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
    classDef backendLayer fill:#FDEBD0,stroke:#F5B041,stroke-width:1px;
    classDef frontend fill:#AED6F1,stroke:#3498DB,stroke-width:2px;
    classDef scheduler fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
