# shafiqtanim/hotel_api architecture

> Architecture diagram of the GitHub repository shafiqtanim/hotel_api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shafiqtanim/hotel_api
- Repository: https://github.com/shafiqtanim/hotel_api

## Overview

##### Main System Components

a) API Layer
- This at the top level as the entry point
- Controllers from app/Http/Controllers/Api
- Controllers by functionality:
- Authentication (AuthController)
- Booking Management (BookingController, ReservationRequestController)
- Room Management (RoomListController, RoomCategoryController)
- Food & Services (MenuItemController, ServiceListController)
- Staff Management (EmployeeController, RosterScheduleController)
- Billing (PaymentController, FoodBillController, ServiceBillController)

b) Business Logic Layer
- This in the middle
- Models from app/Models directory
- Related models together:
- User-related (User, Customer, Employee)
- Room-related (RoomList, RoomCategory)
- Booking-related (Booking, ReservationRequest)
- Food-related (MenuItem, MenuCategory, Order)
- Service-related (ServiceList, ServiceBill)
- Schedule-related (RosterSchedule, Shift, Day)

c) Database Layer
- At the bottom
- Major tables from database/migrations
- Relationships between tables

##### Specific Elements

a) Authentication Flow:
- Sanctum authentication flow
- Middleware interactions

b) Booking Process Flow:
- Reservation Request → Booking → Payment
- Service and food order additions

c) Employee Management:
- Role-based access control
- Roster scheduling system

##### Technical Details to Highlight

- Laravel Framework version
- Database type (from config/database.php)
- Authentication mechanism (Sanctum)
- API versioning structure

Remember to include notes about scalability considerations and potential integration points with external systems like payment gateways or third-party booking platforms.

This will provide a clear understanding of the system's architecture while maintaining the necessary level of detail for a principal software engineer to understand the complete system flow and structure.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "API Layer"
        API["API Gateway"]:::gateway
        click API "https://github.com/ShafiqTanim/hotel_api/blob/master/routes/api.php"
        
        subgraph "Controllers"
            AuthC["Authentication Controller"]:::controller
            click AuthC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/AuthController.php"
            BookC["Booking Controller"]:::controller
            click BookC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/BookingController.php"
            ResC["Reservation Controller"]:::controller
            click ResC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/ReservationRequestController.php"
            RoomC["Room Controller"]:::controller
            click RoomC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/RoomListController.php"
            RoomCatC["Room Category Controller"]:::controller
            click RoomCatC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/RoomCategoryController.php"
            MenuC["Menu Controller"]:::controller
            click MenuC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/MenuItemController.php"
            OrderC["Order Controller"]:::controller
            click OrderC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/OrderController.php"
            EmpC["Employee Controller"]:::controller
            click EmpC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/EmployeeController.php"
            RosterC["Roster Controller"]:::controller
            click RosterC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/RosterScheduleController.php"
            PayC["Payment Controller"]:::controller
            click PayC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/PaymentController.php"
            CustC["Customer Controller"]:::controller
            click CustC "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Http/Controllers/Api/CustomerController.php"
        end
    end

    subgraph "Business Logic Layer"
        Auth["Authentication"]:::auth
        click Auth "https://github.com/ShafiqTanim/hotel_api/blob/master/config/sanctum.php"
        
        subgraph "Models"
            User["User Model"]:::model
            Customer["Customer Model"]:::model
            click Customer "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/Customer.php"
            Employee["Employee Model"]:::model
            click Employee "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/Employee.php"
            Room["Room Model"]:::model
            click Room "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/RoomList.php"
            RoomCat["Room Category Model"]:::model
            click RoomCat "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/RoomCategory.php"
            Booking["Booking Model"]:::model
            click Booking "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/Booking.php"
            ResReq["Reservation Request Model"]:::model
            click ResReq "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/ReservationRequest.php"
            MenuItem["Menu Item Model"]:::model
            click MenuItem "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/MenuItem.php"
            Order["Order Model"]:::model
            click Order "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/Order.php"
            Roster["Roster Schedule Model"]:::model
            click Roster "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/RosterSchedule.php"
            Payment["Payment Model"]:::model
            click Payment "https://github.com/ShafiqTanim/hotel_api/blob/master/app/Models/Payment.php"
        end
    end

    subgraph "Database Layer"
        UserDB[(Users)]:::database
        CustomerDB[(Customers)]:::database
        click CustomerDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_02_085655_create_customers_table.php"
        EmployeeDB[(Employees)]:::database
        click EmployeeDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_133926_create_employees_table.php"
        RoomDB[(Rooms)]:::database
        click RoomDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_03_053551_create_room_lists_table.php"
        RoomCatDB[(Room Categories)]:::database
        click RoomCatDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_03_045039_create_room_categories_table.php"
        BookingDB[(Bookings)]:::database
        click BookingDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_131715_create_bookings_table.php"
        ResReqDB[(Reservation Requests)]:::database
        click ResReqDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_131712_create_reservation_requests_table.php"
        MenuItemDB[(Menu Items)]:::database
        click MenuItemDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_134748_create_menu_items_table.php"
        OrderDB[(Orders)]:::database
        click OrderDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_134911_create_orders_table.php"
        RosterDB[(Roster Schedules)]:::database
        click RosterDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_134526_create_roster_schedules_table.php"
        PaymentDB[(Payments)]:::database
        click PaymentDB "https://github.com/ShafiqTanim/hotel_api/blob/master/database/migrations/2024_10_25_133526_create_payments_table.php"
    end

    %% Relationships
    API --> AuthC & BookC & ResC & RoomC & RoomCatC & MenuC & OrderC & EmpC & RosterC & PayC & CustC
    
    AuthC --> Auth
    Auth --> User
    
    BookC --> Booking
    ResC --> ResReq
    RoomC --> Room
    RoomCatC --> RoomCat
    MenuC --> MenuItem
    OrderC --> Order
    EmpC --> Employee
    RosterC --> Roster
    PayC --> Payment
    CustC --> Customer
    
    User -.-> UserDB
    Customer -.-> CustomerDB
    Employee -.-> EmployeeDB
    Room -.-> RoomDB
    RoomCat -.-> RoomCatDB
    Booking -.-> BookingDB
    ResReq -.-> ResReqDB
    MenuItem -.-> MenuItemDB
    Order -.-> OrderDB
    Roster -.-> RosterDB
    Payment -.-> PaymentDB

    %% Styling
    classDef gateway fill:#f9f,stroke:#333
    classDef controller fill:#bbf,stroke:#333
    classDef model fill:#bfb,stroke:#333
    classDef database fill:#fb8,stroke:#333
    classDef auth fill:#b8f,stroke:#333

    %% Legend
    subgraph Legend
        L1["API Gateway"]:::gateway
        L2["Controllers"]:::controller
        L3["Models"]:::model
        L4["Database Tables"]:::database
        L5["Authentication"]:::auth
    end
```
