# mubarak-saeed/mediax architecture

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

- Interactive diagram: https://gitdiagram.com/mubarak-saeed/mediax
- Repository: https://github.com/mubarak-saeed/mediax

## Overview

MediaX is an Arabic-first streaming and e-book platform. Its user journey spans account access, catalog discovery, access checks, and reading or viewing content; subscribers can purchase or manage plans through Stripe. A separate Filament panel manages the catalog, users, plans, and payments. The graph combines README-described capabilities with the sampled controller, model, provider, and resource references; routes and several feature controllers were not inspected, so their detailed dispatch paths are omitted.

Main entry points: [`resources/views`](https://github.com/mubarak-saeed/mediax/tree/main/resources/views) (Web experience), [`app/Models/Content.php`](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Content.php) (Content catalog), [`app/Http/Controllers/WatchController.php`](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/WatchController.php) (Watch and read), [`app/Http/Controllers/SubscriptionController.php`](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SubscriptionController.php) (Checkout and billing portal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web experience"]
  node_auth["Authentication"]
  node_search["Content search"]
  node_favorites["Favorites and ratings"]
end

subgraph group_catalog["Catalog and playback"]
  node_sections["Section browsing"]
  node_content[("Content catalog<br/>[Content.php]")]
  node_taxonomy[("Sections and genres<br/>[Section.php]")]
  node_seasons[("Series seasons<br/>[Season.php]")]
  node_episodes[("Episodes<br/>[Episode.php]")]
  node_access["Subscription access checks"]
  node_playback["Watch and read"]
  node_viewcount["View tracking"]
end

subgraph group_billing["Subscriptions and payments"]
  node_user[("User and subscription model<br/>[User.php]")]
  node_plans[("Subscription plans<br/>[Plan.php]")]
  node_checkout["Checkout and billing portal"]
  node_webhook["Invoice webhook sync"]
  node_payment_sync["Payment record sync"]
  node_payments[("Payment records<br/>[Payment.php]")]
end

subgraph group_operations["Administration"]
  node_admin["Filament management"]
  node_admin_users["User management<br/>[UserResource.php]"]
  node_admin_billing["Plan and payment management<br/>[PlanResource.php]"]
end

node_visitor(("Visitor or member"))
node_stripe["Stripe"]
node_database[("Application database")]

node_visitor -->|"uses"| node_web
node_visitor -->|"signs in"| node_auth
node_web -->|"browses"| node_sections
node_web -->|"searches"| node_search
node_web -->|"favorites and rates"| node_favorites
node_sections -->|"queries"| node_taxonomy
node_sections -->|"queries"| node_content
node_content -->|"has seasons"| node_seasons
node_seasons -->|"has episodes"| node_episodes
node_web -->|"watches or reads"| node_playback
node_playback -->|"loads content"| node_content
node_playback -->|"loads episodes"| node_episodes
node_playback -->|"tracks views"| node_viewcount
node_visitor -->|"chooses a plan"| node_checkout
node_checkout -->|"loads plan"| node_plans
node_checkout -->|"starts or swaps subscription"| node_user
node_checkout -->|"opens checkout or portal"| node_stripe
node_stripe -->|"sends invoice event"| node_webhook
node_webhook -->|"syncs invoice"| node_payment_sync
node_payment_sync -->|"creates payment"| node_payments
node_admin -->|"manages catalog"| node_content
node_admin_users -->|"manages users"| node_user
node_admin_billing -->|"manages plans"| node_plans
node_admin_billing -->|"reviews payments"| node_payments
node_content -->|"persists"| node_database
node_user -->|"persists"| node_database
node_payments -->|"persists"| node_database

click node_web "https://github.com/mubarak-saeed/mediax/tree/main/resources/views"
click node_auth "https://github.com/mubarak-saeed/mediax/tree/main/app/Http/Controllers/Auth"
click node_search "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SearchController.php"
click node_favorites "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/FavoritesController.php"
click node_sections "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SectionController.php"
click node_content "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Content.php"
click node_taxonomy "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Section.php"
click node_seasons "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Season.php"
click node_episodes "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Episode.php"
click node_access "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Middleware/SubscribeMiddleware.php"
click node_playback "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/WatchController.php"
click node_viewcount "https://github.com/mubarak-saeed/mediax/blob/main/app/Services/ContentViewService.php"
click node_user "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/User.php"
click node_plans "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Plan.php"
click node_checkout "https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SubscriptionController.php"
click node_webhook "https://github.com/mubarak-saeed/mediax/blob/main/app/Listeners/SyncPaymentFromStripeInvoice.php"
click node_payment_sync "https://github.com/mubarak-saeed/mediax/blob/main/app/Services/PaymentStripeSyncService.php"
click node_payments "https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Payment.php"
click node_admin "https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Sections/Resources/SubSections/Resources/Contents/ContentResource.php"
click node_admin_users "https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Users/UserResource.php"
click node_admin_billing "https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Plans/PlanResource.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_web,node_auth,node_search,node_favorites toneBlue
class node_sections,node_content,node_taxonomy,node_seasons,node_episodes,node_access,node_playback,node_viewcount,node_database toneAmber
class node_user,node_plans,node_checkout,node_webhook,node_payment_sync,node_payments toneMint
class node_admin,node_admin_users,node_admin_billing toneRose
class node_visitor,node_stripe toneIndigo
```

## Components

### User experience

- [Web experience](https://github.com/mubarak-saeed/mediax/tree/main/resources/views): `resources/views`
- [Authentication](https://github.com/mubarak-saeed/mediax/tree/main/app/Http/Controllers/Auth): `app/Http/Controllers/Auth`
- [Content search](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SearchController.php): `app/Http/Controllers/SearchController.php`
- [Favorites and ratings](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/FavoritesController.php): `app/Http/Controllers/FavoritesController.php`

### Catalog and playback

- [Section browsing](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SectionController.php): `app/Http/Controllers/SectionController.php`
- [Content catalog](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Content.php): `app/Models/Content.php`
- [Sections and genres](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Section.php): `app/Models/Section.php`
- [Series seasons](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Season.php): `app/Models/Season.php`
- [Episodes](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Episode.php): `app/Models/Episode.php`
- [Subscription access checks](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Middleware/SubscribeMiddleware.php): `app/Http/Middleware/SubscribeMiddleware.php`
- [Watch and read](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/WatchController.php): `app/Http/Controllers/WatchController.php`
- [View tracking](https://github.com/mubarak-saeed/mediax/blob/main/app/Services/ContentViewService.php): `app/Services/ContentViewService.php`

### Subscriptions and payments

- [User and subscription model](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/User.php): `app/Models/User.php`
- [Subscription plans](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Plan.php): `app/Models/Plan.php`
- [Checkout and billing portal](https://github.com/mubarak-saeed/mediax/blob/main/app/Http/Controllers/SubscriptionController.php): `app/Http/Controllers/SubscriptionController.php`
- [Invoice webhook sync](https://github.com/mubarak-saeed/mediax/blob/main/app/Listeners/SyncPaymentFromStripeInvoice.php): `app/Listeners/SyncPaymentFromStripeInvoice.php`
- [Payment record sync](https://github.com/mubarak-saeed/mediax/blob/main/app/Services/PaymentStripeSyncService.php): `app/Services/PaymentStripeSyncService.php`
- [Payment records](https://github.com/mubarak-saeed/mediax/blob/main/app/Models/Payment.php): `app/Models/Payment.php`

### Administration

- [Filament management](https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Sections/Resources/SubSections/Resources/Contents/ContentResource.php): `app/Filament/Resources/Sections/Resources/SubSections/Resources/Contents/ContentResource.php`
- [User management](https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Users/UserResource.php): `app/Filament/Resources/Users/UserResource.php`
- [Plan and payment management](https://github.com/mubarak-saeed/mediax/blob/main/app/Filament/Resources/Plans/PlanResource.php): `app/Filament/Resources/Plans/PlanResource.php`

### Other components

- **Visitor or member**
- **Stripe**
- **Application database**

## Connections

- Visitor or member → Web experience: uses (evidence: `README.md`)
- Visitor or member → Authentication: signs in (evidence: `README.md`)
- Web experience → Section browsing: browses (evidence: `README.md`)
- Web experience → Content search: searches (evidence: `README.md`)
- Web experience → Favorites and ratings: favorites and rates (evidence: `README.md`)
- Section browsing → Sections and genres: queries (evidence: `app/Http/Controllers/SectionController.php`)
- Section browsing → Content catalog: queries (evidence: `app/Http/Controllers/SectionController.php`)
- Content catalog → Series seasons: has seasons (evidence: `app/Models/Content.php`)
- Series seasons → Episodes: has episodes (evidence: `app/Models/Season.php`)
- Web experience → Watch and read: watches or reads (evidence: `README.md`)
- Watch and read → Content catalog: loads content (evidence: `app/Http/Controllers/WatchController.php`)
- Watch and read → Episodes: loads episodes (evidence: `app/Http/Controllers/WatchController.php`)
- Watch and read → View tracking: tracks views (evidence: `app/Http/Controllers/WatchController.php`)
- Visitor or member → Checkout and billing portal: chooses a plan (evidence: `README.md`)
- Checkout and billing portal → Subscription plans: loads plan (evidence: `app/Http/Controllers/SubscriptionController.php`)
- Checkout and billing portal → User and subscription model: starts or swaps subscription (evidence: `app/Http/Controllers/SubscriptionController.php`)
- Checkout and billing portal → Stripe: opens checkout or portal (evidence: `app/Http/Controllers/SubscriptionController.php`)
- Stripe → Invoice webhook sync: sends invoice event
- Invoice webhook sync → Payment record sync: syncs invoice (evidence: `app/Listeners/SyncPaymentFromStripeInvoice.php`)
- Payment record sync → Payment records: creates payment (evidence: `app/Services/PaymentStripeSyncService.php`)
- Filament management → Content catalog: manages catalog (evidence: `app/Filament/Resources/Sections/Resources/SubSections/Resources/Contents/ContentResource.php`)
- User management → User and subscription model: manages users (evidence: `README.md`)
- Plan and payment management → Subscription plans: manages plans (evidence: `README.md`)
- Plan and payment management → Payment records: reviews payments (evidence: `README.md`)
- Content catalog → Application database: persists (evidence: `README.md`)
- User and subscription model → Application database: persists (evidence: `README.md`)
- Payment records → Application database: persists (evidence: `README.md`)
