# ezequieldhonatan/tourism-agency-system architecture

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

- Interactive diagram: https://gitdiagram.com/ezequieldhonatan/tourism-agency-system
- Repository: https://github.com/ezequieldhonatan/tourism-agency-system

## Overview

##### Project type and purpose
- This is a monolithic, full-stack Laravel PHP application for a travel agency (“Sistema de agência de turismo”).
- It exposes two user-facing interfaces:
- “Panel” – an administrative backend for managing airports, flights, planes, brands, reserves, states, cities, users.
- “Site” – a public website where end-customers search for flights, view promotions, manage their profile and purchases.

##### File structure
- Top-level separation:
- public/ – web-servable assets (CSS, JS, images, index.php)
- app/ – application code (Controllers, Models, Middleware, Requests, Helpers, Console commands)
- config/ – environment-specific configuration
- database/ – migrations, seeders, factories
- resources/ – Blade views (panel/ and site/), front-end assets (sass/js), language files
- routes/ – route definitions (web.php, api.php, console.php, channels.php)
- storage/ – compiled views, logs, cache, sessions
- tests/ – unit and feature tests
- bootstrap/ – framework bootstrap and cached files
- MVC pattern:
- Models under app/Models
- Controllers under app/Http/Controllers (subfolders Auth, Panel, Site)
- Views under resources/views (mirroring Controller structure)
- Build tool: webpack.mix.js (Laravel Mix) to compile JS, CSS, Sass into public/assets and public/js/app.js, public/css/app.css.
- Config files for DB, cache, mail, queue, session, services under config/.

##### README
- Minimal: “Sistema de agência de turismo”. Confirms domain is travel bookings.

##### Main components and their interactions
a. Components:
1) Client browsers/mobile apps
2) Web server (Apache/Nginx) + PHP-FPM
3) Laravel Application:
– Routing (routes/web.php, api.php)
– Controllers (Auth, Panel, Site)
– Request validation (FormRequest classes)
– Domain Models & Eloquent ORM
– Helpers, Rules, Console Commands
4) Database (MySQL/PostgreSQL)
5) Cache/Session store (Redis/File)
6) Queue system (Redis/Beanstalkd)
7) Mail/Notification service (SMTP/third-party)
8) Front-end assets (Blade + optional Vue components in resources/js/components)
9) External APIs (if any—e.g., payment gateways)

b. Relationships and data flows:
- Browser → HTTP → public/index.php → Laravel Router → Middleware pipeline → Controller → Model (Eloquent) → Database
- Controller → returns Blade view + compiled CSS/JS assets → Browser
- Jobs dispatched to queue → queue worker (artisan queue:work) → handle background tasks (e-mail, data sync)
- Console commands scheduled (app/Console/Kernel.php) for cron jobs
- Cache/store interactions via Cache facade and session middleware

c. Architectural patterns and design principles:
- MVC
- Layered architecture: HTTP Layer → Application Layer (Controllers/Requests) → Domain Layer (Models/Rules) → Infrastructure Layer (Database, Cache, Queue)
- Dependency Injection via Service Providers (app/Providers)
- Separation of concerns: Panel vs. Site modules; Auth subsystem; Helpers/Rules extracted from Controllers
- Single codebase with logical sub-modules under Controllers and Views

d. Key technologies/frameworks:
- Laravel Framework (Routing, Eloquent ORM, Blade, Middleware, Service Providers)
- PHP 7/8
- MySQL or Postgres
- Redis or native file cache/session
- Laravel Mix (Webpack) for asset compilation: SCSS, JS, Vue components
- PHPUnit for testing

##### Detail without over-fragmenting
- Break the monolith into logical pieces: HTTP gateway, Laravel core (split by sub-modules), persistence.
- Make clear boundaries: show what lives in code vs. infrastructure.
- Essential elements: Authentication flow, admin vs. public UI, asset pipeline, background jobs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Web Layer
    subgraph "Web Layer"
        direction TB
        AdminUI["Admin UI (Browser)"]:::weblayer
        UserUI["User UI (Browser/Mobile)"]:::weblayer
        WebServer["Web Server + PHP-FPM"]:::weblayer
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        Routing["Routing & Middleware"]:::app
        Controllers["Controllers (Auth / Panel / Site)"]:::app
        Requests["Requests & Validation"]:::app
        Models["Domain Models & Eloquent ORM"]:::app
        ViewsAssets["Blade Views & Assets"]:::app
        Helpers["Helpers & Custom Rules"]:::app
        ConsoleQueue["Console & Queue Workers"]:::app
        Providers["Service Providers & DI"]:::app
        ConfigLayer["Configuration & Environment"]:::app
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        Database["Database (MySQL/PostgreSQL)"]:::datastore
        CacheSession["Cache & Session Store (Redis/File)"]:::datastore
        QueueBackend["Queue Backend (Redis/Beanstalkd)"]:::datastore
    end

    %% External Services
    subgraph "External Services"
        direction TB
        MailService["Mail/Notification Service (SMTP)"]:::external
        ExternalAPI["External APIs (Payment, etc.)"]:::external
    end

    %% Connections
    AdminUI -->|HTTP| WebServer
    UserUI -->|HTTP| WebServer
    WebServer -->|index.php| Routing
    Routing -->|Pipeline| Controllers
    Controllers -->|validate| Requests
    Controllers -->|use| Models
    Controllers -->|return| ViewsAssets
    Controllers -->|dispatch| ConsoleQueue
    Controllers -->|cache/session| CacheSession
    Controllers -->|mail| MailService
    Controllers -->|external HTTP| ExternalAPI
    ConsoleQueue -->|jobs| QueueBackend
    ConsoleQueue -->|scheduler| ConsoleQueue
    ConsoleQueue -->|use| Models
    Models -->|SQL| Database
    Requests -->|use rules| Helpers
    Providers -->|inject| Controllers
    Providers -->|bind| Models
    ConfigLayer -->|configures| Routing
    ConfigLayer -->|configures| Controllers
    ConfigLayer -->|configures| QueueBackend
    ConfigLayer -->|configures| CacheSession
    ViewsAssets -->|JS/CSS| AdminUI
    ViewsAssets -->|JS/CSS| UserUI

    %% Click Events
    click Routing "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/routes/web.php"
    click Controllers "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/app/Http/Controllers/Panel/"
    click Controllers "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/app/Http/Controllers/Site/SiteController.php"
    click Controllers "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/app/Http/Controllers/Auth/"
    click Requests "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/app/Http/Requests/Panel/"
    click Models "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/app/Models/"
    click Helpers "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/app/Helpers/functions.php"
    click ConsoleQueue "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/app/Console/Kernel.php"
    click Providers "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/app/Providers/AppServiceProvider.php"
    click ConfigLayer "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/config/app.php"
    click Database "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/database/migrations/"
    click QueueBackend "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/config/queue.php"
    click CacheSession "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/config/cache.php"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/resources/views/panel/"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/resources/views/site/"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/tree/master/resources/views/auth/"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/public/js/app.js"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/public/css/app.css"
    click ViewsAssets "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/webpack.mix.js"
    click ExternalAPI "https://github.com/ezequieldhonatan/tourism-agency-system/blob/master/routes/api.php"

    %% Styles
    classDef weblayer fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef app fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20
    classDef datastore fill:#ffcdd2,stroke:#b71c1c,color:#b71c1c
    classDef external fill:#e1bee7,stroke:#4a148c,color:#4a148c
```
