# majoood143/majalis architecture

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

- Interactive diagram: https://gitdiagram.com/majoood143/majalis
- Repository: https://github.com/majoood143/majalis

## Overview

1. **Overall shape**
   - This is a Laravel monolith for a hall/event booking platform.
   - The application is split into three user-facing surfaces plus background automation:
     - a public/customer booking site,
     - an owner portal,
     - an admin back office.
   - Most business logic lives in Laravel services, Eloquent models, events/listeners, jobs, and Filament resources.

2. **Main request entrypoints**
   - HTTP routing is separated by concern: `routes/web.php`, `routes/customer.php`, `routes/guest-booking.php`, `routes/customer-tickets.php`, and `routes/auth.php`.
   - Controllers in `app/Http/Controllers` handle the public/customer flows, while Filament pages/resources handle most CRUD and dashboard interactions for admin/owner users.
   - `routes/console.php` and `app/Console/Kernel.php` define scheduled/CLI automation.

3. **Three application surfaces**
   - **Admin panel**: `app/Filament/Admin` with management pages, dashboards, reports, and CRUD for nearly all domain entities.
   - **Owner panel**: `app/Filament/Owner` focused on hall owners’ bookings, availability, earnings, expenses, tickets, and performance dashboards.
   - **Public/customer experience**: Blade views and controllers under `resources/views/customer` and `app/Http/Controllers/Customer` for browsing halls, booking, payment, tickets, and reviews.

4. **Core domain model**
   - The heart of the system is hall booking. Key entities include `Hall`, `Booking`, `HallOwner`, `HallAvailability`, `Payment`, `Payout`, `Review`, `PromoCode`, `ExtraService`, `CommissionSetting`, `ServiceFeeSetting`, `Expense`, `Ticket`, `Page`, and geographic entities like `Region` and `City`.
   - The many migration files show a mature schema with advanced booking features such as advance payments, guest bookings, seasonal pricing, event types, payout tracking, and service-fee audits.

5. **Booking lifecycle**
   - Booking creation starts in customer/guest controllers or Filament CRUD screens and is validated against availability and hall rules.
   - Booking state transitions are represented with enums like `BookingStatus`, `PaymentStatus`, and related notification/status enums.
   - Booking actions trigger domain events such as `BookingApproved` and `BookingRejected`, and there are observer classes for side effects on booking/user changes.

6. **Availability and pricing**
   - Availability is a first-class subsystem: `AvailabilityService` and owner/admin availability resources manage slot calendars and hall blocking.
   - Pricing is layered through `PricingResource`, `SeasonalPricing`, commission/service fee settings, and promo codes.
   - Owner-facing calendar and pricing tools suggest the system supports operational scheduling, not just static listings.

7. **Payments, payouts, and finance**
   - Payment handling is centralized in services like `PaymentService`, `ThawaniService`, `InvoiceService`, `BookingPdfService`, `PayoutReceiptService`, and PDF-related services.
   - The presence of `config/thawani.php` indicates integration with the Thawani payment gateway.
   - Financial reporting is split by audience: admin reports, owner earnings, payout management, and receipt/invoice generation, with Filament widgets and PDF views supporting those outputs.

8. **Notifications and messaging**
   - There is a dedicated notification pipeline using Laravel notifications, mailables, and queued jobs.
   - Booking, payout, review request, reminder, and ticket notifications are all modeled explicitly in `app/Notifications`, `app/Mail`, and `app/Jobs`.
   - WhatsApp is also part of the architecture via `WhatsappNotificationService` and WhatsApp-related models/policies/migrations, so messaging is multi-channel, not email-only.

9. **Asynchronous processing**
   - Background jobs handle time-sensitive or expensive work: auto-completing bookings, generating invoices, sending reminders, sending notifications, and review requests.
   - The app also includes console commands for synchronization, diagnostics, cache/font maintenance, and booking/email checks.
   - This means the system depends on queues and scheduled automation for operational correctness, not just synchronous web requests.

10. **Guest booking and identity linking**
   - Guest booking is a dedicated path with its own service provider, controllers, Livewire components, and storage model (`GuestSession`).
   - There are listeners that link guest bookings and tickets to a registered user after account creation.
   - This is a key boundary: the system supports anonymous conversion funnels and later account association.

11. **Content, support, and CMS-like features**
   - The app includes pages, static content, and knowledge-base-style admin capabilities: `Page`, `PageResource`, `PageController`, and related views.
   - Tickets and ticket messages form a built-in support system for customers and owners.
   - Reviews and promo codes add adjacent customer engagement flows around the booking core.

12. **Presentation layer and UI framework**
   - Filament is the main admin/owner UI framework, with many resources, relation managers, widgets, and custom pages.
   - Livewire is used for interactive components such as language switching, hall owner registration, and maintenance controls.
   - Blade templates under `resources/views` provide the customer site, emails, invoices, PDFs, and Filament custom views.

13. **Internationalization and formatting**
   - The app is bilingual, with extensive Arabic and English language files across domain areas.
   - Arabic-specific assets include a custom font setup and font-cache maintenance commands, which matters for PDF and UI rendering.
   - `app/Http/Middleware/SetUserLanguage` indicates language selection is part of request handling.

14. **Infrastructure and cross-cutting concerns**
   - Authorization is enforced through a rich set of policies and Filament Shield/permission configuration.
   - Observers, middleware, and service classes are used to keep controllers and resources thin.
   - Reporting/export functionality is centralized in services such as `ReportService` and `DashboardExportService`.

15. **What to draw as the main architecture boundaries**
   - At the center: Eloquent models and services around halls, bookings, payments, and payouts.
   - On the left: customer/guest web flows and public pages.
   - On the right: owner and admin Filament panels.
   - Below: queues, scheduled commands, email/PDF/WhatsApp integrations, and payment gateway calls.
   - Around everything: policies, middleware, localization, and notification/event infrastructure.

Main entry points: [`app/Models/Booking.php`](https://github.com/majoood143/majalis/blob/main/app/Models/Booking.php) (Booking Core), [`routes`](https://github.com/majoood143/majalis/tree/main/routes) (Routes), [`app/Http/Controllers/Customer`](https://github.com/majoood143/majalis/tree/main/app/Http/Controllers/Customer) (Customer HTTP), [`app/Filament/Admin`](https://github.com/majoood143/majalis/tree/main/app/Filament/Admin) (Admin Panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_surfaces["Application Surfaces"]
  node_routes["Routes<br/>http entrypoints"]
  node_customer_http["Customer HTTP<br/>controllers"]
  node_guest_booking["Guest Booking<br/>guest funnel"]
  node_admin_panel["Admin Panel<br/>filament admin"]
  node_owner_panel["Owner Panel<br/>filament owner"]
end

subgraph group_core["Domain Core"]
  node_hall_models[("Hall Models<br/>domain models<br/>[Hall.php]")]
  node_booking_models[("Booking Core<br/>domain models<br/>[Booking.php]")]
  node_pricing_finance["Pricing & Finance<br/>services<br/>[BookingService.php]"]
  node_support_content["Support & Content<br/>content models<br/>[Page.php]"]
  node_domain_enums{{"Domain Enums<br/>status enums"}}
end

subgraph group_async["Automation"]
  node_events_listeners["Events & Listeners<br/>domain events"]
  node_jobs_queue["Jobs & Queue<br/>background jobs"]
  node_scheduler["Scheduler<br/>console automation<br/>[Kernel.php]"]
  node_notifications["Notifications<br/>messaging pipeline"]
end

subgraph group_presentation["Presentation"]
  node_filament_support["Filament Support<br/>ui framework"]
  node_customer_views["Customer Views<br/>blade ui"]
  node_localization["Localization<br/>i18n assets"]
end

subgraph group_infra["Infrastructure"]
  node_middleware_policies["Access Control<br/>middleware and policies"]
  node_providers["Providers"]
  node_integrations["External Integrations<br/>config integrations<br/>[thawani.php]"]
end

node_routes -->|"dispatches"| node_customer_http
node_routes -->|"guest flows"| node_guest_booking
node_routes -->|"admin UI"| node_admin_panel
node_routes -->|"owner UI"| node_owner_panel
node_customer_http -->|"reads/writes"| node_hall_models
node_customer_http -->|"creates bookings"| node_booking_models
node_guest_booking -->|"guest records"| node_booking_models
node_admin_panel -->|"manages"| node_hall_models
node_admin_panel -->|"manages"| node_booking_models
node_owner_panel -->|"operates"| node_hall_models
node_owner_panel -->|"tracks"| node_booking_models
node_hall_models -->|"used by"| node_pricing_finance
node_booking_models -->|"processed by"| node_pricing_finance
node_booking_models -->|"stateful"| node_domain_enums
node_booking_models -->|"emits"| node_events_listeners
node_events_listeners -->|"queues work"| node_jobs_queue
node_jobs_queue -->|"sends"| node_notifications
node_scheduler -->|"orchestrates"| node_jobs_queue
node_filament_support -->|"powers"| node_admin_panel
node_filament_support -->|"powers"| node_owner_panel
node_customer_views -->|"renders"| node_customer_http
node_localization -->|"translates"| node_customer_views
node_localization -->|"translates"| node_filament_support
node_middleware_policies -->|"guards"| node_routes
node_providers -->|"registers"| node_routes
node_providers -->|"boots"| node_filament_support
node_integrations -->|"connects"| node_pricing_finance
node_integrations -->|"supports"| node_notifications

click node_routes "https://github.com/majoood143/majalis/tree/main/routes"
click node_customer_http "https://github.com/majoood143/majalis/tree/main/app/Http/Controllers/Customer"
click node_guest_booking "https://github.com/majoood143/majalis/blob/main/app/Providers/GuestBookingServiceProvider.php"
click node_admin_panel "https://github.com/majoood143/majalis/tree/main/app/Filament/Admin"
click node_owner_panel "https://github.com/majoood143/majalis/tree/main/app/Filament/Owner"
click node_hall_models "https://github.com/majoood143/majalis/blob/main/app/Models/Hall.php"
click node_booking_models "https://github.com/majoood143/majalis/blob/main/app/Models/Booking.php"
click node_pricing_finance "https://github.com/majoood143/majalis/blob/main/app/Services/BookingService.php"
click node_support_content "https://github.com/majoood143/majalis/blob/main/app/Models/Page.php"
click node_domain_enums "https://github.com/majoood143/majalis/tree/main/app/Enums"
click node_events_listeners "https://github.com/majoood143/majalis/tree/main/app/Events"
click node_jobs_queue "https://github.com/majoood143/majalis/tree/main/app/Jobs"
click node_scheduler "https://github.com/majoood143/majalis/blob/main/app/Console/Kernel.php"
click node_notifications "https://github.com/majoood143/majalis/blob/main/app/Services/WhatsappNotificationService.php"
click node_filament_support "https://github.com/majoood143/majalis/tree/main/app/Filament"
click node_customer_views "https://github.com/majoood143/majalis/tree/main/resources/views/customer"
click node_localization "https://github.com/majoood143/majalis/tree/main/resources/lang"
click node_middleware_policies "https://github.com/majoood143/majalis/tree/main/app/Policies"
click node_providers "https://github.com/majoood143/majalis/tree/main/app/Providers"
click node_integrations "https://github.com/majoood143/majalis/blob/main/config/thawani.php"

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_routes,node_customer_http,node_guest_booking,node_admin_panel,node_owner_panel toneBlue
class node_hall_models,node_booking_models,node_pricing_finance,node_support_content,node_domain_enums toneAmber
class node_events_listeners,node_jobs_queue,node_scheduler,node_notifications toneMint
class node_filament_support,node_customer_views,node_localization toneRose
class node_middleware_policies,node_providers,node_integrations toneIndigo
```

## Components

### Application Surfaces

Public customer site, owner portal, and admin back office.

- [Routes](https://github.com/majoood143/majalis/tree/main/routes): http entrypoints · Route files split by customer, guest booking, tickets, auth, web, and console concerns. · `routes`
- [Customer HTTP](https://github.com/majoood143/majalis/tree/main/app/Http/Controllers/Customer): controllers · Public and customer-facing controllers for halls, bookings, payments, profiles, promo codes, reviews, and pages. · `app/Http/Controllers/Customer`
- [Guest Booking](https://github.com/majoood143/majalis/blob/main/app/Providers/GuestBookingServiceProvider.php): guest funnel · Anonymous booking flow with its own service provider, Livewire components, and guest session linkage. · `app/Providers/GuestBookingServiceProvider.php`
- [Admin Panel](https://github.com/majoood143/majalis/tree/main/app/Filament/Admin): filament admin · Back-office CRUD, dashboards, reports, settings, and management pages. · `app/Filament/Admin`
- [Owner Panel](https://github.com/majoood143/majalis/tree/main/app/Filament/Owner): filament owner · Owner-facing booking, availability, pricing, earnings, expenses, tickets, and performance tools. · `app/Filament/Owner`

### Domain Core

Booking, halls, payments, pricing, finance, and support data models.

- [Hall Models](https://github.com/majoood143/majalis/blob/main/app/Models/Hall.php): domain models · Halls, owners, regions, cities, features, images, categories, types, and availability. · `app/Models/Hall.php`
- [Booking Core](https://github.com/majoood143/majalis/blob/main/app/Models/Booking.php): domain models · Bookings, payments, payouts, reviews, promo codes, guest sessions, and booking notifications. · `app/Models/Booking.php`
- [Pricing & Finance](https://github.com/majoood143/majalis/blob/main/app/Services/BookingService.php): services · Availability, booking, pricing, commission, payment, invoice, PDF, payout receipt, promo code, and reporting services. · `app/Services/BookingService.php`
- [Support & Content](https://github.com/majoood143/majalis/blob/main/app/Models/Page.php): content models · Pages, tickets, ticket messages, and related customer support/content entities. · `app/Models/Page.php`
- [Domain Enums](https://github.com/majoood143/majalis/tree/main/app/Enums): status enums · Booking, payment, payout, notification, expense, recurrence, time-slot, and user role states. · `app/Enums`

### Automation

Queues, jobs, listeners, events, and scheduled commands.

- [Events & Listeners](https://github.com/majoood143/majalis/tree/main/app/Events): domain events · Booking approval/rejection events and registration listeners that link guest data to users. · `app/Events`
- [Jobs & Queue](https://github.com/majoood143/majalis/tree/main/app/Jobs): background jobs · Invoice generation, reminders, notifications, review requests, and auto-completion work. · `app/Jobs`
- [Scheduler](https://github.com/majoood143/majalis/blob/main/app/Console/Kernel.php): console automation · Scheduled commands and maintenance tasks for booking sync, font cache, diagnostics, and cleanup. · `app/Console/Kernel.php`
- [Notifications](https://github.com/majoood143/majalis/blob/main/app/Services/WhatsappNotificationService.php): messaging pipeline · Laravel notifications, mailables, and WhatsApp notification services for booking and payout flows. · `app/Services/WhatsappNotificationService.php`

### Presentation

Blade, Filament UI, Livewire, and localization assets.

- [Filament Support](https://github.com/majoood143/majalis/tree/main/app/Filament): ui framework · Shared Filament services, traits, components, pages, widgets, and custom views. · `app/Filament`
- [Customer Views](https://github.com/majoood143/majalis/tree/main/resources/views/customer): blade ui · Public customer, guest booking, invoices, emails, PDFs, and support-facing Blade templates. · `resources/views/customer`
- [Localization](https://github.com/majoood143/majalis/tree/main/resources/lang): i18n assets · Arabic and English translations plus RTL/font assets and language switching support. · `resources/lang`

### Infrastructure

Policies, middleware, providers, and external integrations.

- [Access Control](https://github.com/majoood143/majalis/tree/main/app/Policies): middleware and policies · Authentication, owner gating, language selection, Filament session checks, and authorization policies. · `app/Policies`
- [Providers](https://github.com/majoood143/majalis/tree/main/app/Providers): service providers · Application, event, Filament panel, and guest-booking providers wiring the app together. · `app/Providers`
- [External Integrations](https://github.com/majoood143/majalis/blob/main/config/thawani.php): config integrations · Thawani payment gateway, mail, queue, filament plugins, PDF rendering, and WhatsApp-related config. · `config/thawani.php`

## Connections

- Routes → Customer HTTP: dispatches · Web and customer routes lead into controllers.
- Routes → Guest Booking: guest flows · Dedicated guest booking routes use the guest booking provider and components.
- Routes → Admin Panel: admin UI · Admin route surface is handled by Filament resources and pages.
- Routes → Owner Panel: owner UI · Owner route surface is handled by Filament owner resources and pages.
- Customer HTTP → Hall Models: reads/writes · Customer flows browse and update hall data and availability.
- Customer HTTP → Booking Core: creates bookings · Booking, payment, ticket, review, and profile flows touch booking entities.
- Guest Booking → Booking Core: guest records · Anonymous bookings and guest sessions are stored and later linked.
- Admin Panel → Hall Models: manages · Admin CRUD spans halls, regions, cities, media, and availability.
- Admin Panel → Booking Core: manages · Admin manages bookings, payments, payouts, reviews, promo codes, and tickets.
- Owner Panel → Hall Models: operates · Owners manage their halls, galleries, features, pricing, and availability.
- Owner Panel → Booking Core: tracks · Owners review bookings, earnings, expenses, payouts, and support tickets.
- Hall Models → Pricing & Finance: used by · Availability and booking logic depend on pricing, commission, and payment services.
- Booking Core → Pricing & Finance: processed by · Bookings flow through payment, invoice, PDF, payout, and reporting services.
- Booking Core → Domain Enums: stateful · Bookings, payments, payouts, and notifications rely on enums for workflow states.
- Booking Core → Events & Listeners: emits · Booking state changes trigger approval/rejection events and guest-link listeners.
- Events & Listeners → Jobs & Queue: queues work · Listeners and domain events trigger queued notifications and follow-up jobs.
- Jobs & Queue → Notifications: sends · Queued work delivers mail, notifications, reminders, and WhatsApp messages.
- Scheduler → Jobs & Queue: orchestrates · Console commands schedule automation around booking sync, cleanup, and diagnostics.
- Filament Support → Admin Panel: powers · Filament resources, widgets, and pages implement the admin experience.
- Filament Support → Owner Panel: powers · Filament resources, widgets, and pages implement the owner experience.
- Customer Views → Customer HTTP: renders · Blade views support the public and customer controllers.
- Localization → Customer Views: translates · UI text, emails, PDFs, and customer screens are bilingual.
- Localization → Filament Support: translates · Filament panels and custom widgets use localized labels and content.
- Access Control → Routes: guards · Middleware and policies gate the routed application surfaces.
- Providers → Routes: registers · Service providers register panels, guest booking, and app wiring.
- Providers → Filament Support: boots · Panel providers bootstrap the Filament admin and owner surfaces.
- External Integrations → Pricing & Finance: connects · Payment gateway, PDF, mail, and report integrations back the core services.
- External Integrations → Notifications: supports · Email and messaging channels depend on configured transports and APIs.
