# yeizermarrugo/dilodepartededios architecture

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

- Interactive diagram: https://gitdiagram.com/yeizermarrugo/dilodepartededios
- Repository: https://github.com/yeizermarrugo/dilodepartededios

## Overview

1. **Overall shape**
   - This is a Laravel 12 monolith with an Inertia.js + React 19 frontend. The browser never talks to a separate SPA API for normal navigation; instead, Laravel controllers return Inertia responses that hydrate React pages from `resources/js/pages`.

2. **Request path**
   - A typical user request enters through Laravel routing in `routes/web.php`, `routes/auth.php`, `routes/settings.php`, or `routes/api.php`.
   - Controllers in `app/Http/Controllers` fetch or mutate data through Eloquent models in `app/Models`, then return either Inertia pages, redirects, JSON responses, file downloads, or webhook acknowledgements.

3. **Content platform core**
   - The main domain model is `Devocional`, which represents more than one content type: daily devotionals, Bible studies, and series episodes.
   - `Ensenanza` is the separate series container model, while `Devocional` rows can belong to a series via `ensenanza_id`.
   - The public content pages are mostly driven by `DevocionalController`, `EnsenanzaController`, `PostController`, and related React pages under `resources/js/pages`.

4. **Public interaction features**
   - Likes, shares, and views are treated as first-class subsystems rather than simple counters.
   - `LikeController` and `ContentLike` support anonymous likes using a cookie-based visitor identifier and a hash, not a logged-in identity.
   - `ShortUrlController` generates short codes and resolves shared links back to the underlying content.
   - `DevocionalView` records view analytics, including anonymized network/location metadata.

5. **Media and file handling**
   - Uploads are split by type: `ImageUploadController`, `BulkUploadController`, and `PdfUploadController`.
   - Files are stored through the Laravel filesystem configuration, with AWS S3 explicitly supported in the environment and config.
   - `PostImage` and the upload controllers indicate a content-heavy system with associated images and downloadable resources.

6. **External service integrations**
   - `TTSController` integrates with Voice RSS to generate text-to-speech audio for content.
   - `PaymentController` handles ePayco donation webhooks and stores `Donation` records.
   - `PushSubscriptionController` manages Web Push subscriptions; the app uses VAPID keys and the `Visitor` model to keep subscription state.
   - `YouTubeController` likely acts as a cached feed bridge to YouTube content for the podcast/media section.

7. **Communication and notifications**
   - `ContactController` accepts contact form submissions, persists them as `ContactMessage`, and sends email through `ContactFormMail`.
   - `NuevoContenidoNotification` and the scheduled command `NotificarDevocionalDiario.php` support outbound notifications about new content.
   - Push notifications and email are therefore two separate outbound channels with different persistence and delivery paths.

8. **Admin and dashboard boundary**
   - The admin area lives in the same application and is rendered through Inertia pages like `resources/js/pages/dashboard.tsx` and dashboard components under `resources/js/components/dashboard`.
   - This area appears to manage publications, contact messages, and content CRUD without a separate backend service.

9. **Middleware and cross-cutting concerns**
   - `AssignVisitorId` establishes anonymous tracking identity through a long-lived cookie.
   - `HandleAppearance` manages theme preferences, `HandleInertiaRequests` injects global shared props, and `AddSecurityHeaders` enforces security-related HTTP headers.
   - These middlewares shape every request, so they are important boundary layers in the architecture.

10. **Frontend structure**
   - The frontend is organized as reusable React components, page-level views, and hooks.
   - `resources/js/components` contains shared UI and feature widgets such as likes, sharing, TTS controls, upload widgets, navigation, and layout shells.
   - `resources/js/hooks` encapsulates client-side behaviors like liking, sharing, appearance, and mobile navigation.
   - The presence of `bootstrap/ssr` assets shows server-side rendering support for the Inertia frontend.

11. **Data storage and schema**
   - The database schema is migration-driven and includes UUID-heavy tables for content and series, plus analytics, donations, visitors, likes, subscriptions, and contact messages.
   - There is clear separation between content records, user/account records, anonymous interaction records, and operational/audit data.
   - Factories and seeders exist for test and bootstrap data, especially around devocionales and enseñanzas.

12. **Client/runtime extras**
   - The app includes a service worker (`public/sw.js`) and a web manifest, which suggests PWA-like behavior such as offline handling and push support.
   - Frontend assets are built with Vite, and the presence of SSR assets indicates both client-side hydration and server-rendered initial pages.

13. **Operational/testing boundary**
   - CI is present for linting and tests via GitHub Actions.
   - Feature tests cover authentication, dashboard access, uploads, likes, settings, devocionales, and enseñanzas, which reflects the main functional boundaries of the system.

Main entry points: [`app/Http/Controllers/DevocionalController.php`](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/DevocionalController.php) (Content controllers), [`config/app.php`](https://github.com/yeizermarrugo/dilodepartededios/blob/main/config/app.php) (Config), [`routes/web.php`](https://github.com/yeizermarrugo/dilodepartededios/blob/main/routes/web.php) (Routes), [`resources/js/pages`](https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/pages) (Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_http["HTTP boundary"]
  node_n_routes["Routes<br/>[web.php]"]
  node_n_middleware["Middleware<br/>request boundary"]
  node_n_auth["Auth controllers<br/>auth flows"]
  node_n_settings["Settings<br/>user prefs"]
end

subgraph group_grp_content["Content domain"]
  node_n_content_ctrl["Content controllers<br/>content delivery"]
  node_n_devocional[("Devocional<br/>content model<br/>[Devocional.php]")]
  node_n_ensenanza[("Ensenanza<br/>series model<br/>[Ensenanza.php]")]
  node_n_content_like[("Likes<br/>anonymous interaction<br/>[ContentLike.php]")]
  node_n_views[("Views<br/>analytics model<br/>[DevocionalView.php]")]
  node_n_posts[("Post images<br/>media model<br/>[PostImage.php]")]
end

subgraph group_grp_integrations["Media & integrations"]
  node_n_shorturl["Short links<br/>share service"]
  node_n_uploads["Uploads<br/>file intake"]
  node_n_tts["Text to speech<br/>voice integration<br/>[TTSController.php]"]
  node_n_notifications["Notifications<br/>outbound alerts"]
  node_n_payments["Donations<br/>payment webhook"]
  node_n_contacts["Contact form<br/>messaging"]
end

subgraph group_grp_frontend["Frontend"]
  node_n_frontend_pages["Pages"]
  node_n_frontend_components["Components<br/>react ui"]
  node_n_frontend_hooks["Hooks<br/>client behaviors"]
end

subgraph group_grp_data["Data layer"]
  node_n_schema["Schema<br/>migrations"]
  node_n_seed["Seed data<br/>factories/seeders<br/>[DatabaseSeeder.php]"]
end

subgraph group_grp_ops["Operations"]
  node_n_ssr["SSR assets<br/>server render<br/>[ssr.js]"]
  node_n_sw["Service worker<br/>pwa runtime<br/>[sw.js]"]
  node_n_config["Config<br/>[app.php]"]
end

node_n_routes -->|"passes through"| node_n_middleware
node_n_routes -->|"auth routes"| node_n_auth
node_n_routes -->|"settings routes"| node_n_settings
node_n_routes -->|"content routes"| node_n_content_ctrl
node_n_content_ctrl -->|"reads/writes"| node_n_devocional
node_n_content_ctrl -->|"series"| node_n_ensenanza
node_n_content_ctrl -->|"media"| node_n_posts
node_n_devocional -->|"belongs to"| node_n_ensenanza
node_n_content_ctrl -->|"likes"| node_n_content_like
node_n_content_ctrl -->|"tracks views"| node_n_views
node_n_content_ctrl -->|"share links"| node_n_shorturl
node_n_uploads -->|"stores media"| node_n_posts
node_n_uploads -->|"filesystem"| node_n_config
node_n_tts -->|"external api"| node_n_config
node_n_notifications -->|"push/email"| node_n_config
node_n_notifications -->|"push support"| node_n_sw
node_n_payments -->|"gateway"| node_n_config
node_n_contacts -->|"mail"| node_n_config
node_n_contacts -->|"persists"| node_n_schema
node_n_frontend_pages -->|"composes"| node_n_frontend_components
node_n_frontend_pages -->|"uses"| node_n_frontend_hooks
node_n_frontend_pages -->|"hydrates from"| node_n_ssr
node_n_middleware -->|"shares props"| node_n_frontend_pages
node_n_schema -->|"bootstraps"| node_n_seed

click node_n_routes "https://github.com/yeizermarrugo/dilodepartededios/blob/main/routes/web.php"
click node_n_middleware "https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Middleware"
click node_n_auth "https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Controllers/Auth"
click node_n_settings "https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Controllers/Settings"
click node_n_content_ctrl "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/DevocionalController.php"
click node_n_devocional "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/Devocional.php"
click node_n_ensenanza "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/Ensenanza.php"
click node_n_content_like "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/ContentLike.php"
click node_n_views "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/DevocionalView.php"
click node_n_posts "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/PostImage.php"
click node_n_shorturl "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Services/ShortCodeService.php"
click node_n_uploads "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/ImageUploadController.php"
click node_n_tts "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/TTSController.php"
click node_n_notifications "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Notifications/NuevoContenidoNotification.php"
click node_n_payments "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/PaymentController.php"
click node_n_contacts "https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/ContactController.php"
click node_n_frontend_pages "https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/pages"
click node_n_frontend_components "https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/components"
click node_n_frontend_hooks "https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/hooks"
click node_n_ssr "https://github.com/yeizermarrugo/dilodepartededios/blob/main/bootstrap/ssr/ssr.js"
click node_n_sw "https://github.com/yeizermarrugo/dilodepartededios/blob/main/public/sw.js"
click node_n_config "https://github.com/yeizermarrugo/dilodepartededios/blob/main/config/app.php"
click node_n_schema "https://github.com/yeizermarrugo/dilodepartededios/blob/main/database/migrations/2025_07_16_202524_create_devocionales_table.php"
click node_n_seed "https://github.com/yeizermarrugo/dilodepartededios/blob/main/database/seeders/DatabaseSeeder.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_n_routes,node_n_middleware,node_n_auth,node_n_settings toneBlue
class node_n_content_ctrl,node_n_devocional,node_n_ensenanza,node_n_content_like,node_n_views,node_n_posts toneAmber
class node_n_shorturl,node_n_uploads,node_n_tts,node_n_notifications,node_n_payments,node_n_contacts toneMint
class node_n_frontend_pages,node_n_frontend_components,node_n_frontend_hooks toneRose
class node_n_schema,node_n_seed toneIndigo
class node_n_ssr,node_n_sw,node_n_config toneTeal
```

## Components

### HTTP boundary

Laravel routes, middleware, controllers, and requests

- [Routes](https://github.com/yeizermarrugo/dilodepartededios/blob/main/routes/web.php): laravel routes · Entry points for web, auth, settings, API, and console flows · `routes/web.php`
- [Middleware](https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Middleware): request boundary · Anonymous visitor identity, appearance, Inertia props, and security headers · `app/Http/Middleware`
- [Auth controllers](https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Controllers/Auth): auth flows · Registration, login, verification, and password recovery controllers · `app/Http/Controllers/Auth`
- [Settings](https://github.com/yeizermarrugo/dilodepartededios/tree/main/app/Http/Controllers/Settings): user prefs · Profile and password settings controllers and forms · `app/Http/Controllers/Settings`

### Content domain

Core models and flows for devocionales, enseñanzas, posts, and interactions

- [Content controllers](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/DevocionalController.php): content delivery · Public content pages and CRUD for devocionales, enseñanzas, posts, and sitemap · `app/Http/Controllers/DevocionalController.php`
- [Devocional](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/Devocional.php): content model · Primary content record for devotionals, studies, and episodes · `app/Models/Devocional.php`
- [Ensenanza](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/Ensenanza.php): series model · Series container that devocionales can belong to · `app/Models/Ensenanza.php`
- [Likes](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/ContentLike.php): anonymous interaction · Cookie-based content likes and stored like records · `app/Models/ContentLike.php`
- [Views](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/DevocionalView.php): analytics model · Tracked content views with anonymized metadata · `app/Models/DevocionalView.php`
- [Post images](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Models/PostImage.php): media model · Associated images and downloadable post assets · `app/Models/PostImage.php`

### Media & integrations

Uploads, sharing, notifications, payments, TTS, and web push

- [Short links](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Services/ShortCodeService.php): share service · Short-code generation and resolution for shared content · `app/Services/ShortCodeService.php`
- [Uploads](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/ImageUploadController.php): file intake · Image, bulk, and PDF upload controllers with validation · `app/Http/Controllers/ImageUploadController.php`
- [Text to speech](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/TTSController.php): voice integration · Voice RSS-backed audio generation for content · `app/Http/Controllers/TTSController.php`
- [Notifications](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Notifications/NuevoContenidoNotification.php): outbound alerts · Push subscriptions, email notifications, and scheduled new-content notices · `app/Notifications/NuevoContenidoNotification.php`
- [Donations](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/PaymentController.php): payment webhook · ePayco donation handling and persistence · `app/Http/Controllers/PaymentController.php`
- [Contact form](https://github.com/yeizermarrugo/dilodepartededios/blob/main/app/Http/Controllers/ContactController.php): messaging · Contact submissions, stored messages, and mail delivery · `app/Http/Controllers/ContactController.php`

### Frontend

Inertia React pages, layouts, components, and client hooks

- [Pages](https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/pages): inertia pages · React page views for public content, auth, settings, and dashboard · `resources/js/pages`
- [Components](https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/components): react ui · Shared layout, feature widgets, and dashboard components · `resources/js/components`
- [Hooks](https://github.com/yeizermarrugo/dilodepartededios/tree/main/resources/js/hooks): client behaviors · Like, share, appearance, and mobile navigation hooks · `resources/js/hooks`

### Data layer

Migrations, seeders, factories, and persistent schema

- [Schema](https://github.com/yeizermarrugo/dilodepartededios/blob/main/database/migrations/2025_07_16_202524_create_devocionales_table.php): migrations · Migration-driven database schema for content, analytics, and operational records · `database/migrations/2025_07_16_202524_create_devocionales_table.php`
- [Seed data](https://github.com/yeizermarrugo/dilodepartededios/blob/main/database/seeders/DatabaseSeeder.php): factories/seeders · Bootstrap and test data for users, devocionales, and enseñanzas · `database/seeders/DatabaseSeeder.php`

### Operations

SSR, service worker, config, and CI/testing

- [SSR assets](https://github.com/yeizermarrugo/dilodepartededios/blob/main/bootstrap/ssr/ssr.js): server render · Prebuilt server-side rendering bundle for Inertia pages · `bootstrap/ssr/ssr.js`
- [Service worker](https://github.com/yeizermarrugo/dilodepartededios/blob/main/public/sw.js): pwa runtime · Offline and push-support browser runtime · `public/sw.js`
- [Config](https://github.com/yeizermarrugo/dilodepartededios/blob/main/config/app.php): app config · Filesystem, mail, webpush, inertia, queue, session, and services settings · `config/app.php`

## Connections

- Routes → Middleware: passes through · Requests are shaped by shared request middleware before controllers run
- Routes → Auth controllers: auth routes · Authentication endpoints are routed to dedicated controllers
- Routes → Settings: settings routes · Profile and password settings are handled separately
- Routes → Content controllers: content routes · Public content, dashboard, sitemap, and related pages flow through controllers
- Content controllers → Devocional: reads/writes · Content controllers fetch and mutate the primary content model
- Content controllers → Ensenanza: series · Series pages and relations use the enseñanzas model
- Content controllers → Post images: media · Post and gallery controllers work with stored post images
- Devocional → Ensenanza: belongs to · Devocionales can be attached to a series container
- Content controllers → Likes: likes · Like actions are stored as first-class interaction records
- Content controllers → Views: tracks views · View tracking is persisted for analytics and ranking
- Content controllers → Short links: share links · Controllers generate and resolve short URLs for shared content
- Uploads → Post images: stores media · Uploads feed content image and document storage
- Uploads → Config: filesystem · Upload storage depends on configured filesystem drivers and S3 support
- Text to speech → Config: external api · Text-to-speech uses configured service credentials
- Notifications → Config: push/email · Notification delivery depends on mail and web push configuration
- Notifications → Service worker: push support · Web push subscriptions and service worker runtime cooperate for browser notifications
- Donations → Config: gateway · Donation webhooks and payment settings are driven by service config
- Contact form → Config: mail · Contact messages are sent through configured mail transport
- Contact form → Schema: persists · Contact submissions are stored in the database schema
- Pages → Components: composes · Pages are built from shared React components and layouts
- Pages → Hooks: uses · Pages consume hooks for likes, sharing, appearance, and mobile UX
- Pages → SSR assets: hydrates from · Initial page rendering is supported by the SSR bundle
- Middleware → Pages: shares props · Inertia middleware injects global data for React pages
- Schema → Seed data: bootstraps · Factories and seeders populate the schema for development and tests
