# everyscript/trabajonautas architecture

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

- Interactive diagram: https://gitdiagram.com/everyscript/trabajonautas
- Repository: https://github.com/everyscript/trabajonautas

## Overview

1. **Overall shape**
   - This is a **Laravel monolith** with a server-rendered UI built mainly from **Blade + Livewire**, not a separate SPA.
   - The app is organized around a few core business domains: **announcements, notices, users/clients, companies, professions/areas/locations, accounts/subscriptions, and reporting**.

2. **Primary user-facing surfaces**
   - There are three major UI boundaries:
     - a **public/web area** (`resources/views/welcome.blade.php`, `app/Livewire/Web/*`)
     - an **authenticated application/dashboard area** (`resources/views/dashboard.blade.php`, `app/Livewire/Panel/*`, `app/Livewire/User/*`, etc.)
     - an **auth/profile management area** powered by Jetstream/Fortify (`app/Actions/Fortify/*`, `resources/views/auth/*`, `resources/views/profile/*`)
   - The public area handles discovery and purchase/registration flows; the authenticated area manages operational CRUD and dashboards.

3. **Core domain model**
   - The central entities are:
     - **Announcement** and **AnnouncementFile**
     - **Notice**
     - **User** and client/user configuration
     - **Company**, **CompanyType**, **Location**, **Area**, **Profesion**
     - **Account**, **AccountType**, **Subscription**
     - **NotificationLog**, **TbnSetting**
   - The migration history shows this app evolved into a subscription/notification system with rich segmentation by location, profession, company, and grade/profile metadata.

4. **Content publishing and distribution flow**
   - `AnnouncementObserver` and `SendAnnouncementNotifications` indicate that creating/updating announcements can trigger downstream delivery work.
   - Notification delivery is abstracted through `FirebaseNotificationService`, so push notifications are a distinct integration boundary.
   - `NotificationLog` is the persistence layer for delivery/audit tracking, which implies announcement publishing is asynchronous or at least externally side-effecting.

5. **Background processing and scheduled maintenance**
   - The app uses Laravel **console commands** for periodic operations:
     - `SendUnnotifiedClientsCommand`
     - `UpdateExpiredAccounts`
   - These commands likely scan stored state and enqueue/trigger notifications or account status changes.
   - The presence of `jobs` and a `jobs` table migration shows that queue-backed processing is part of the architecture, not just synchronous HTTP requests.

6. **Authentication and account lifecycle**
   - Authentication is handled by **Fortify/Jetstream**, with custom actions for:
     - creating users
     - updating passwords/profile information
     - deleting users
     - password validation/reset flows
   - There are custom auth-related controllers and middleware such as:
     - `CheckIfUserEnable`
     - `CheckOnlyOneSession`
     - social login controller
   - This suggests the app enforces account-state rules beyond standard login, including single-session and enabled/disabled user checks.

7. **Authorization and multi-role access**
   - The app includes `config/permission.php`, implying **role/permission-based access control**.
   - `AuthorizeClients` trait and `CheckIfUserEnable` middleware show that some data and routes are restricted based on user type or account status.
   - The architectural boundary is therefore not just authenticated vs guest, but also **admin/operator vs client** and possibly account-tier based.

8. **Livewire as the main application layer**
   - Most business features are implemented as **Livewire components** rather than traditional controllers:
     - CRUD screens for announcements, areas, companies, professions, notices, users/clients
     - dashboard widgets and charts
     - report/configuration flows
     - public web modules like search and recent content
   - `app/Http/Controllers` is comparatively small, which means Livewire owns most request/response interaction and stateful UI behavior.

9. **Reporting and analytics**
   - The `Charts/*` components show dashboards for:
     - account status
     - client age, gender, grade, location, profession
     - unregistered clients
   - `ReportClient` and `ConfigQr` indicate report/export/configuration features tied to client records.
   - `UsersExport` further confirms the app supports data extraction for operational/reporting use cases.

10. **Notifications and messaging channels**
   - The app sends email through dedicated mailable classes:
     - `WelcomeAccount`
     - `RenewAccount`
   - It also customizes reset/verification notifications.
   - On the client side, there is Firebase service worker and browser notification JS in `public/`, showing **web push** is a first-class channel alongside email.

11. **Public content and engagement**
   - The web-facing Livewire components (`RecentAnnouncement`, `RecentNotices`, `SearchAnnouncement`, `PurchaseAccount`, `PurchaseCards`, `WelcomeSection`) support content browsing and conversion/purchase flows.
   - Markdown-based static pages for FAQ, policy, and terms indicate a mix of dynamic and semi-static public content.
   - This public side is separated from operational admin tools but shares the same domain models.

12. **Persistence and data setup**
   - Standard Laravel Eloquent models, factories, seeders, and migrations define the data layer.
   - Seeders cover business baseline data such as company types, grade profiles, locations, professions, settings, accounts, and users.
   - The schema also includes pivot tables for many-to-many relationships like announcements by location, profession, and user, which is important for understanding how targeting/segmentation works.

13. **Infrastructure and runtime boundaries**
   - The app relies on Laravel’s built-in **session, queue, cache, mail, broadcasting, and filesystem** subsystems.
   - `sanctum` is present for API/token auth, but the project is primarily server-rendered rather than a public JSON API.
   - `firebase.php` and the service worker assets are the main external integration that materially affect architecture.

14. **What to draw in an architecture diagram**
   - A good diagram would show:
     - **public web UI** and **authenticated dashboard UI**
     - **Livewire components** as the main presentation/application layer
     - **Eloquent models + migrations** as the persistent domain layer
     - **queue/jobs/console commands** as asynchronous/background processing
     - **Firebase + email** as outbound notification channels
     - **Fortify/Jetstream/Permissions** as the auth and access-control boundary
   - The main data flow is: user action → Livewire/app logic → models/database → observers/jobs/notifications → email/Firebase delivery, with scheduled commands handling reconciliation and account expiration.

Main entry points: [`app/Models/User.php`](https://github.com/everyscript/trabajonautas/blob/main/app/Models/User.php) (Users), [`app/Models`](https://github.com/everyscript/trabajonautas/tree/main/app/Models) (Business models), [`routes/web.php`](https://github.com/everyscript/trabajonautas/blob/main/routes/web.php) (Routes and views), [`app/Livewire/Web`](https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Web) (Web Livewire)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_public["Public web"]
  node_node_welcome["Welcome<br/>web entry<br/>[welcome.blade.php]"]
  node_node_web_livewire["Web Livewire<br/>livewire public"]
end

subgraph group_group_app["Dashboard app"]
  node_node_dashboard_view["Dashboard<br/>app shell"]
  node_node_panel_livewire["Panel<br/>livewire dashboard"]
  node_node_crud_livewire["CRUD modules<br/>livewire ops"]
  node_node_report_livewire["Reports<br/>livewire analytics"]
  node_node_routes_views["Routes and views<br/>http layer<br/>[web.php]"]
end

subgraph group_group_auth["Auth and access"]
  node_node_auth_actions["Fortify actions<br/>auth actions"]
  node_node_jetstream_delete["Delete user<br/>jetstream action<br/>[DeleteUser.php]"]
  node_node_auth_middleware["Access guards<br/>middleware"]
  node_node_permissions["Permissions<br/>rbac config<br/>[permission.php]"]
end

subgraph group_group_data["Domain and data"]
  node_node_user_model[("Users<br/>auth model<br/>[User.php]")]
  node_node_business_models[("Business models<br/>domain models")]
  node_node_notifications_log[("Delivery log<br/>audit store")]
end

subgraph group_group_async["Async work"]
  node_node_announcement_observer["Announcement observer<br/>model observer"]
  node_node_announcement_job["Notify job<br/>queue job"]
  node_node_console_commands["Console commands<br/>scheduled jobs"]
end

subgraph group_group_integrations["Notifications"]
  node_node_firebase_service["Firebase service<br/>push integration"]
  node_node_mailers["Mailers<br/>email integration"]
  node_node_public_assets["Push assets<br/>client assets"]
end

node_node_welcome -->|"loads"| node_node_web_livewire
node_node_web_livewire -->|"reads"| node_node_business_models
node_node_web_livewire -->|"creates users"| node_node_user_model
node_node_dashboard_view -->|"hosts"| node_node_panel_livewire
node_node_dashboard_view -->|"hosts"| node_node_crud_livewire
node_node_panel_livewire -->|"aggregates"| node_node_business_models
node_node_crud_livewire -->|"manages"| node_node_business_models
node_node_report_livewire -->|"analyzes"| node_node_business_models
node_node_report_livewire -->|"segments"| node_node_user_model
node_node_auth_actions -->|"mutates"| node_node_user_model
node_node_jetstream_delete -->|"deletes"| node_node_user_model
node_node_auth_middleware -->|"guards"| node_node_user_model
node_node_permissions -->|"authorizes"| node_node_crud_livewire
node_node_announcement_observer -->|"dispatches"| node_node_announcement_job
node_node_announcement_job -->|"sends push"| node_node_firebase_service
node_node_announcement_job -->|"records"| node_node_notifications_log
node_node_console_commands -->|"reconciles"| node_node_notifications_log
node_node_console_commands -->|"updates"| node_node_business_models
node_node_mailers -->|"emails"| node_node_user_model
node_node_public_assets -->|"supports"| node_node_firebase_service
node_node_routes_views -->|"serves"| node_node_welcome
node_node_routes_views -->|"serves"| node_node_dashboard_view
node_node_routes_views -->|"uses"| node_node_auth_actions

click node_node_welcome "https://github.com/everyscript/trabajonautas/blob/main/resources/views/welcome.blade.php"
click node_node_web_livewire "https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Web"
click node_node_dashboard_view "https://github.com/everyscript/trabajonautas/blob/main/resources/views/dashboard.blade.php"
click node_node_panel_livewire "https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Panel"
click node_node_crud_livewire "https://github.com/everyscript/trabajonautas/tree/main/app/Livewire"
click node_node_report_livewire "https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Report"
click node_node_auth_actions "https://github.com/everyscript/trabajonautas/tree/main/app/Actions/Fortify"
click node_node_jetstream_delete "https://github.com/everyscript/trabajonautas/blob/main/app/Actions/Jetstream/DeleteUser.php"
click node_node_auth_middleware "https://github.com/everyscript/trabajonautas/tree/main/app/Http/Middleware"
click node_node_permissions "https://github.com/everyscript/trabajonautas/blob/main/config/permission.php"
click node_node_user_model "https://github.com/everyscript/trabajonautas/blob/main/app/Models/User.php"
click node_node_business_models "https://github.com/everyscript/trabajonautas/tree/main/app/Models"
click node_node_notifications_log "https://github.com/everyscript/trabajonautas/blob/main/app/Models/NotificationLog.php"
click node_node_announcement_observer "https://github.com/everyscript/trabajonautas/blob/main/app/Observers/AnnouncementObserver.php"
click node_node_announcement_job "https://github.com/everyscript/trabajonautas/blob/main/app/Jobs/SendAnnouncementNotifications.php"
click node_node_console_commands "https://github.com/everyscript/trabajonautas/tree/main/app/Console/Commands"
click node_node_firebase_service "https://github.com/everyscript/trabajonautas/blob/main/app/Services/FirebaseNotificationService.php"
click node_node_mailers "https://github.com/everyscript/trabajonautas/tree/main/app/Mail"
click node_node_public_assets "https://github.com/everyscript/trabajonautas/blob/main/public/firebase-messaging-sw.js"
click node_node_routes_views "https://github.com/everyscript/trabajonautas/blob/main/routes/web.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_node_welcome,node_node_web_livewire toneBlue
class node_node_dashboard_view,node_node_panel_livewire,node_node_crud_livewire,node_node_report_livewire,node_node_routes_views toneAmber
class node_node_auth_actions,node_node_jetstream_delete,node_node_auth_middleware,node_node_permissions toneMint
class node_node_user_model,node_node_business_models,node_node_notifications_log toneRose
class node_node_announcement_observer,node_node_announcement_job,node_node_console_commands toneIndigo
class node_node_firebase_service,node_node_mailers,node_node_public_assets toneTeal
```

## Components

### Public web

Guest-facing discovery and purchase flows

- [Welcome](https://github.com/everyscript/trabajonautas/blob/main/resources/views/welcome.blade.php): web entry · Public landing page and guest entry point · `resources/views/welcome.blade.php`
- [Web Livewire](https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Web): livewire public · Public browsing, search, and purchase components · `app/Livewire/Web`

### Dashboard app

Authenticated operational UI

- [Dashboard](https://github.com/everyscript/trabajonautas/blob/main/resources/views/dashboard.blade.php): app shell · Authenticated application shell · `resources/views/dashboard.blade.php`
- [Panel](https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Panel): livewire dashboard · Dashboard cards, onboarding, and summary widgets · `app/Livewire/Panel`
- [CRUD modules](https://github.com/everyscript/trabajonautas/tree/main/app/Livewire): livewire ops · Operational screens for announcements, users, companies, areas, professions, and notices · `app/Livewire`
- [Reports](https://github.com/everyscript/trabajonautas/tree/main/app/Livewire/Report): livewire analytics · Charts and client reporting components · `app/Livewire/Report`
- [Routes and views](https://github.com/everyscript/trabajonautas/blob/main/routes/web.php): http layer · Laravel route definitions, Blade views, and layouts connecting all surfaces · `routes/web.php`

### Auth and access

Jetstream, Fortify, and permission boundaries

- [Fortify actions](https://github.com/everyscript/trabajonautas/tree/main/app/Actions/Fortify): auth actions · Create, profile, password, and delete-account workflows · `app/Actions/Fortify`
- [Delete user](https://github.com/everyscript/trabajonautas/blob/main/app/Actions/Jetstream/DeleteUser.php): jetstream action · Jetstream account deletion flow · `app/Actions/Jetstream/DeleteUser.php`
- [Access guards](https://github.com/everyscript/trabajonautas/tree/main/app/Http/Middleware): middleware · Enabled-user and single-session checks · `app/Http/Middleware`
- [Permissions](https://github.com/everyscript/trabajonautas/blob/main/config/permission.php): rbac config · Role and permission configuration · `config/permission.php`

### Domain and data

Core models, persistence, and content targeting

- [Users](https://github.com/everyscript/trabajonautas/blob/main/app/Models/User.php): auth model · Application users, clients, and account state · `app/Models/User.php`
- [Business models](https://github.com/everyscript/trabajonautas/tree/main/app/Models): domain models · Announcement, notice, company, location, area, profession, account, subscription, and settings entities · `app/Models`
- [Delivery log](https://github.com/everyscript/trabajonautas/blob/main/app/Models/NotificationLog.php): audit store · Persistence for notification delivery and tracking · `app/Models/NotificationLog.php`

### Async work

Observers, jobs, commands, and scheduled reconciliation

- [Announcement observer](https://github.com/everyscript/trabajonautas/blob/main/app/Observers/AnnouncementObserver.php): model observer · Triggers side effects when announcements change · `app/Observers/AnnouncementObserver.php`
- [Notify job](https://github.com/everyscript/trabajonautas/blob/main/app/Jobs/SendAnnouncementNotifications.php): queue job · Queued announcement delivery work · `app/Jobs/SendAnnouncementNotifications.php`
- [Console commands](https://github.com/everyscript/trabajonautas/tree/main/app/Console/Commands): scheduled jobs · Periodic notification and account-expiration maintenance · `app/Console/Commands`

### Notifications

Outbound email and Firebase delivery

- [Firebase service](https://github.com/everyscript/trabajonautas/blob/main/app/Services/FirebaseNotificationService.php): push integration · Push notification delivery boundary · `app/Services/FirebaseNotificationService.php`
- [Mailers](https://github.com/everyscript/trabajonautas/tree/main/app/Mail): email integration · Account welcome and renewal messages · `app/Mail`
- [Push assets](https://github.com/everyscript/trabajonautas/blob/main/public/firebase-messaging-sw.js): client assets · Service worker and browser notification scripts · `public/firebase-messaging-sw.js`

## Connections

- Welcome → Web Livewire: loads · Guest entry point hydrates public Livewire components
- Web Livewire → Business models: reads · Search, recent content, and purchase flows query domain data
- Web Livewire → Users: creates users · Purchase and registration flows can create or configure clients
- Dashboard → Panel: hosts · Dashboard shell renders operational widgets
- Dashboard → CRUD modules: hosts · Authenticated layout renders CRUD modules
- Panel → Business models: aggregates · Dashboard summaries are built from domain records
- CRUD modules → Business models: manages · Livewire modules create and edit core entities
- Reports → Business models: analyzes · Charts and exports read client and account data
- Reports → Users: segments · Reporting is centered on user/client attributes
- Fortify actions → Users: mutates · Fortify actions create and maintain user accounts
- Delete user → Users: deletes · Jetstream handles account removal
- Access guards → Users: guards · Middleware blocks disabled or multi-session access
- Permissions → CRUD modules: authorizes · Roles and permissions gate dashboard features
- Announcement observer → Notify job: dispatches · Announcement lifecycle changes enqueue delivery work
- Notify job → Firebase service: sends push · Queued delivery uses Firebase as the push channel
- Notify job → Delivery log: records · Delivery outcomes are written for tracking and audit
- Console commands → Delivery log: reconciles · Scheduled jobs scan stored state and update delivery/account status
- Console commands → Business models: updates · Commands handle expired accounts and unnotified clients
- Mailers → Users: emails · Welcome and renewal mail target users and clients
- Push assets → Firebase service: supports · Browser push depends on service worker and client scripts
- Routes and views → Welcome: serves · Routes connect HTTP entry points to the public landing page
- Routes and views → Dashboard: serves · Routes connect authenticated requests to the dashboard shell
- Routes and views → Fortify actions: uses · Authentication routes rely on Fortify/Jetstream actions
