# mahfujul-01726/tourandtraveltouch architecture

> Architecture diagram of the GitHub repository mahfujul-01726/tourandtraveltouch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahfujul-01726/tourandtraveltouch
- Repository: https://github.com/mahfujul-01726/tourandtraveltouch

## Overview

1. **Overall shape**: This is a small monolithic travel-booking application built with **PHP 8+, MySQL/MariaDB, vanilla JavaScript, and Bootstrap 5**. The browser serves a mostly static frontend, while PHP scripts in `backend/` act as request handlers for auth, booking, search, and admin functions.

2. **Frontend shell**: `index.html` is the main public landing page. `pages/login.html` and `pages/signup.html` are separate auth screens. The UI is styled and themed through `assets/css/theme-orange.css` and `assets/css/theme-red.css`, with images and branding assets under `assets/images/`.

3. **Client-side behavior**: `assets/js/config.js` is the main browser-side integration point; it points frontend calls to the backend base URL. JavaScript also drives the interactive presentation layer described in the README: theme switching, animations, parallax, particles, scroll reveal, and flash/toast display.

4. **Backend configuration boundary**: `backend/config/app.php` and `backend/config/database.php` centralize environment settings and database connectivity. `app.php` governs session and frontend-origin related behavior, while `database.php` establishes the MySQL connection used by all handlers.

5. **Shared backend utilities**: `backend/helpers.php` provides cross-cutting server-side utilities used across handlers and admin pages. This is where common concerns like sanitization, token/session helpers, or response formatting are likely consolidated.

6. **Request handlers**: `backend/handlers/` is the application’s functional API layer. Each file is a focused endpoint:
   - `register.php`, `login.php`, `logout.php` handle user authentication
   - `auth-status.php` reports whether a session is authenticated
   - `csrf-token.php` issues CSRF tokens to the client
   - `booking.php` persists travel bookings
   - `search.php` performs booking/destination searches
   - `flash.php` exposes session-backed status messages

7. **Data model and persistence**: `database/schema.sql` defines the core relational schema. The main entities are `users`, `information` (booking records), and `admins`. The `information` table links bookings back to users, so the primary data flow is user account creation → authenticated session → booking insertion → later admin review.

8. **Admin subsystem**: `backend/admin/login.php`, `logout.php`, and `dashboard.php` form a separate admin realm from the public user flow. The admin panel is not just another page; it is a distinct authenticated boundary for reviewing and managing booking/user data.

9. **Security and trust boundaries**: The repository emphasizes server-side protection at every state-changing boundary. Public forms submit to PHP handlers protected by **CSRF tokens**, credentials are stored with **bcrypt**, database access uses **prepared statements**, and output is sanitized to reduce XSS risk. Session-based auth is the main trust mechanism between browser and backend.

10. **Operational/deployment flow**: `.github/workflows/deploy.yml` automates deployment by pushing the repository contents to an **InfinityFree** host over FTP on every push to `main`. That means the architecture has a simple CI/CD path: GitHub repository → Actions runner → FTP upload → shared hosting runtime.

11. **Runtime profile**: The app is deployed as a classic PHP site rather than a containerized service or SPA. The browser talks directly to PHP endpoints over HTTP, and PHP talks directly to MySQL. There is no separate application server layer, queue, or external API dependency visible in the repository.

12. **What to draw in a diagram**: The important diagram boundaries are: **browser/frontend assets**, **PHP backend handlers/config**, **admin area**, **MySQL database**, and **FTP-based deployment pipeline**. The main data flow is user interaction in the browser → PHP request handlers → MySQL → response/flash/session back to the browser.

Main entry points: [`assets/js/config.js`](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/assets/js/config.js) (Client Config), [`backend/config/database.php`](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/config/database.php) (DB Config), [`.github/workflows/deploy.yml`](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/.github/workflows/deploy.yml) (Deploy), [`backend/admin/dashboard.php`](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/admin/dashboard.php) (Admin Area)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_index["Landing<br/>public page<br/>[index.html]"]
  node_login_page["Login<br/>auth page<br/>[login.html]"]
  node_signup_page["Signup<br/>auth page<br/>[signup.html]"]
  node_js_config["Client Config<br/>browser config<br/>[config.js]"]
  node_theme_css["Themes<br/>ui styles<br/>[theme-orange.css]"]
end

subgraph group_backend["Backend"]
  node_backend_app["App Config<br/>php config<br/>[app.php]"]
  node_backend_db["DB Config<br/>php config<br/>[database.php]"]
  node_helpers["Helpers<br/>server utilities<br/>[helpers.php]"]
  node_register["Register<br/>auth handler<br/>[register.php]"]
  node_login["Login API<br/>auth handler<br/>[login.php]"]
  node_logout["Logout API<br/>auth handler<br/>[logout.php]"]
  node_auth_status["Auth Status<br/>session handler<br/>[auth-status.php]"]
  node_csrf["CSRF Token<br/>security handler<br/>[csrf-token.php]"]
  node_booking["Booking<br/>[booking.php]"]
  node_search["Search<br/>query handler<br/>[search.php]"]
  node_flash["Flash<br/>session handler<br/>[flash.php]"]
  node_admin_panel["Admin Area<br/>admin auth<br/>[dashboard.php]"]
end

subgraph group_data["Data"]
  node_schema[("Schema<br/>[schema.sql]")]
end

subgraph group_deploy["Deployment"]
  node_deploy_flow["Deploy<br/>ci workflow<br/>[deploy.yml]"]
end

node_index -->|"uses"| node_js_config
node_login_page -->|"uses"| node_js_config
node_signup_page -->|"uses"| node_js_config
node_js_config -->|"calls"| node_register
node_js_config -->|"calls"| node_login
node_js_config -->|"calls"| node_logout
node_js_config -->|"calls"| node_auth_status
node_js_config -->|"calls"| node_csrf
node_js_config -->|"calls"| node_booking
node_js_config -->|"calls"| node_search
node_js_config -->|"calls"| node_flash
node_backend_app -->|"supports"| node_helpers
node_backend_db -->|"connects"| node_schema
node_register -->|"uses"| node_backend_db
node_login -->|"uses"| node_backend_db
node_booking -->|"uses"| node_backend_db
node_search -->|"uses"| node_backend_db
node_admin_panel -->|"uses"| node_backend_db
node_admin_panel -->|"uses"| node_helpers
node_deploy_flow -->|"deploys"| node_index
node_deploy_flow -->|"deploys"| node_backend_app
node_deploy_flow -->|"deploys"| node_schema

click node_index "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/index.html"
click node_login_page "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/pages/login.html"
click node_signup_page "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/pages/signup.html"
click node_js_config "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/assets/js/config.js"
click node_theme_css "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/assets/css/theme-orange.css"
click node_backend_app "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/config/app.php"
click node_backend_db "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/config/database.php"
click node_helpers "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/helpers.php"
click node_register "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/register.php"
click node_login "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/login.php"
click node_logout "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/logout.php"
click node_auth_status "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/auth-status.php"
click node_csrf "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/csrf-token.php"
click node_booking "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/booking.php"
click node_search "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/search.php"
click node_flash "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/flash.php"
click node_admin_panel "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/admin/dashboard.php"
click node_schema "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/database/schema.sql"
click node_deploy_flow "https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/.github/workflows/deploy.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_index,node_login_page,node_signup_page,node_js_config,node_theme_css toneBlue
class node_backend_app,node_backend_db,node_helpers,node_register,node_login,node_logout,node_auth_status,node_csrf,node_booking,node_search,node_flash,node_admin_panel toneAmber
class node_schema toneMint
class node_deploy_flow toneRose
```

## Components

### Frontend

Public browser-facing pages and assets

- [Landing](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/index.html): public page · Main public entry page · `index.html`
- [Login](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/pages/login.html): auth page · Public sign-in screen · `pages/login.html`
- [Signup](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/pages/signup.html): auth page · Public account creation screen · `pages/signup.html`
- [Client Config](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/assets/js/config.js): browser config · Frontend base URL and integration settings · `assets/js/config.js`
- [Themes](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/assets/css/theme-orange.css): ui styles · Shared visual themes for the site · `assets/css/theme-orange.css`

### Backend

PHP request handlers and shared server logic

- [App Config](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/config/app.php): php config · Session and app-level runtime settings · `backend/config/app.php`
- [DB Config](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/config/database.php): php config · Database connection setup · `backend/config/database.php`
- [Helpers](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/helpers.php): server utilities · Shared PHP utility functions · `backend/helpers.php`
- [Register](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/register.php): auth handler · Creates user accounts · `backend/handlers/register.php`
- [Login API](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/login.php): auth handler · Authenticates users and starts sessions · `backend/handlers/login.php`
- [Logout API](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/logout.php): auth handler · Ends user sessions · `backend/handlers/logout.php`
- [Auth Status](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/auth-status.php): session handler · Reports whether a user is signed in · `backend/handlers/auth-status.php`
- [CSRF Token](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/csrf-token.php): security handler · Issues CSRF tokens to the browser · `backend/handlers/csrf-token.php`
- [Booking](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/booking.php): booking handler · Stores travel bookings · `backend/handlers/booking.php`
- [Search](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/search.php): query handler · Searches destinations and booking data · `backend/handlers/search.php`
- [Flash](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/handlers/flash.php): session handler · Returns session-backed messages · `backend/handlers/flash.php`
- [Admin Area](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/backend/admin/dashboard.php): admin auth · Separate admin login and dashboard boundary · `backend/admin/dashboard.php`

### Data

Database schema and persistence model

- [Schema](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/database/schema.sql): mysql schema · Core tables for users, bookings, and admins · `database/schema.sql`

### Deployment

Automated hosting pipeline

- [Deploy](https://github.com/mahfujul-01726/tourandtraveltouch/blob/main/.github/workflows/deploy.yml): ci workflow · FTP deployment to shared hosting · `.github/workflows/deploy.yml`

## Connections

- Landing → Client Config: uses · Browser code reads backend base URL and integration settings
- Login → Client Config: uses · Auth screens call the backend through shared client config
- Signup → Client Config: uses · Auth screens call the backend through shared client config
- Client Config → Register: calls · Client submits account creation requests
- Client Config → Login API: calls · Client submits login requests
- Client Config → Logout API: calls · Client submits logout requests
- Client Config → Auth Status: calls · Client checks session state
- Client Config → CSRF Token: calls · Client fetches CSRF tokens
- Client Config → Booking: calls · Client submits booking requests
- Client Config → Search: calls · Client performs search requests
- Client Config → Flash: calls · Client fetches status messages
- App Config → Helpers: supports · Shared runtime behavior and utilities are centralized here
- DB Config → Schema: connects · Database configuration targets the schema-backed MySQL store
- Register → DB Config: uses · Account creation needs database access
- Login API → DB Config: uses · Authentication reads and verifies stored credentials
- Booking → DB Config: uses · Booking writes persist to the database
- Search → DB Config: uses · Search queries read from the database
- Admin Area → DB Config: uses · Admin dashboard reviews persisted users and bookings
- Admin Area → Helpers: uses · Admin realm shares common server utilities
- Deploy → Landing: deploys · Workflow uploads the public site
- Deploy → App Config: deploys · Workflow uploads backend runtime files
- Deploy → Schema: deploys · Workflow includes the database schema artifacts
