# imaa-dev/tallerapp architecture

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

- Interactive diagram: https://gitdiagram.com/imaa-dev/tallerapp
- Repository: https://github.com/imaa-dev/tallerapp

## Overview

#### 1. System shape and entry points
TallerAdmin is a multi-tenant repair-workshop management system. It contains a Laravel application with an Inertia/React web client plus an Expo/React Native mobile client. Web requests enter Laravel through `server-app/public/index.php` and route definitions in `server-app/routes/web.php`, `server-app/routes/api.php`, and `server-app/routes/auth.php`. The mobile app is file-routed from `tallerapp-app/src/app/_layout.tsx`.

#### 2. Backend application boundary
Laravel owns authentication, authorization, persistence, workflow rules, payments, files, and notifications. Controllers are HTTP adapters, with domain operations delegated to service classes and typed DTOs: `server-app/app/Http/Controllers/ServiController.php`, `server-app/app/Services/ServiService.php`, `server-app/app/DTO/UpdateServiceDTO.php`. API-specific controllers under `server-app/app/Http/Controllers/api` support the mobile client separately from Inertia web routes.

#### 3. Tenancy, identity, and access control
Organizations are the tenancy boundary; users can be linked to organizations and act under a selected/resolved tenant. Request middleware resolves the tenant, requires organization selection and active status, and gates administrative actions: `server-app/app/Http/Middleware/ResolveTenant.php`, `server-app/app/Http/Middleware/EnsureOrganizationSelected.php`, `server-app/app/Http/Middleware/EnsureOrganizationIsActive.php`. Core identity/tenant records are `server-app/app/Models/User.php`, `server-app/app/Models/Organization.php`, and `server-app/app/Models/OrganizationUser.php`. Session/browser auth and Sanctum-style personal access tokens support web and API/mobile access.

#### 4. Repair-service lifecycle
The central aggregate is `Servi`: a repair service progresses through status-driven stages, with client/product context, diagnoses, reasons, spare parts, attached files, and repair documents. Main orchestration is in `server-app/app/Services/ServiService.php`; related stage services include `server-app/app/Services/DiagnosisService.php` and `server-app/app/Services/SparePartsService.php`. Persistence models such as `server-app/app/Models/Servi.php`, `server-app/app/Models/StatusService.php`, and `server-app/app/Models/RepairDocument.php` represent the historical operational record.

#### 5. Evidence, documents, and customer communication
Files and service-specific attachments cross from multipart HTTP inputs into storage through a file-service boundary: `server-app/app/Http/Controllers/FileController.php`, `server-app/app/Services/FileService.php`, `server-app/app/Models/ServiceFiles.php`. Repair reports and receipts are rendered from Blade templates, including `server-app/resources/views/receipt/repair_receipt.blade.php` and `server-app/resources/views/emails/repair.blade.php`. Queued jobs send inspection/repair notifications and generate receipts: `server-app/app/Jobs/InspectNotify.php`, `server-app/app/Jobs/RepairNotify.php`, `server-app/app/Jobs/ProcessReceipt.php`.

#### 6. Subscription and payment integration
Organizations have plans and subscription state. Payment logic is isolated behind payment, subscription, and PayPal services, while webhook handling records external events before changing subscription/payment state: `server-app/app/Http/Controllers/PayPalWebhookController.php`, `server-app/app/Services/PayPalService.php`, `server-app/app/Services/SubscriptionService.php`. Relevant domain records are `server-app/app/Models/Subscription.php`, `server-app/app/Models/PaymentSubscription.php`, and `server-app/app/Models/WebhooksEvent.php`. Scheduled commands expire subscriptions and clear pending logins.

#### 7. Client applications and runtime infrastructure
The web UI is React/TypeScript delivered through Inertia and Vite, bootstrapped at `server-app/resources/js/app.tsx`; service-management screens live in `server-app/resources/js/pages/service/`, and browser API calls are grouped under `server-app/resources/js/api/`. The Expo mobile client authenticates, selects an organization, then presents status-partitioned service views via `tallerapp-app/src/app/login.tsx`, `tallerapp-app/src/app/select-organization.tsx`, and `tallerapp-app/src/app/(protected)/(servicios)/_layout.tsx`. Laravel/PHP, MySQL, queue/cache, mail, filesystem storage, PayPal, Docker Compose, and Laravel Cloud are material runtime/infrastructure dependencies; deployment settings are expressed through `compose.yml` and `server-app/compose.yaml`.

Main entry points: [`server-app/app/Http/Controllers/ServiController.php`](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Controllers/ServiController.php) (Controllers), [`server-app/app/Services/ServiService.php`](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/ServiService.php) (Repair service orchestration), [`server-app/app/Http/Middleware/ResolveTenant.php`](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Middleware/ResolveTenant.php) (Tenant and access middleware), [`server-app/app/Services/FileService.php`](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/FileService.php) (File service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client applications"]
  node_web["Inertia React web<br/>web client<br/>[app.tsx]"]
  node_mobile["Expo mobile app<br/>mobile client<br/>[_layout.tsx]"]
end

subgraph group_http["Laravel HTTP boundary"]
  node_entry["Laravel entry point<br/>PHP runtime<br/>[index.php]"]
  node_routes["Web, API and auth routes<br/>route definitions<br/>[web.php]"]
  node_tenant["Tenant and access middleware<br/>[ResolveTenant.php]"]
  node_controllers["Controllers<br/>HTTP adapters"]
end

subgraph group_domain["Domain services"]
  node_servi["Repair service orchestration<br/>domain service<br/>[ServiService.php]"]
  node_repair_stages["Diagnosis and parts<br/>stage services"]
  node_dto["Service DTOs<br/>typed input"]
  node_files["File service<br/>file boundary<br/>[FileService.php]"]
  node_subscriptions["Subscription service<br/>billing domain service"]
end

subgraph group_data["Records and storage"]
  node_identity[("Users and organizations<br/>tenant identity records")]
  node_repair_records[("Repair records<br/>operational models<br/>[Servi.php]")]
  node_file_records[("Service file records<br/>attachment model<br/>[ServiceFiles.php]")]
  node_mysql[("MySQL<br/>database")]
  node_storage[("Filesystem storage<br/>object/file storage")]
end

subgraph group_integrations["Async and external services"]
  node_jobs["Notification and receipt jobs<br/>queued jobs<br/>[RepairNotify.php]"]
  node_templates["Email and receipt templates<br/>Blade templates"]
  node_paypal{{"PayPal payment integration<br/>payment gateway adapter<br/>[PayPalService.php]"}}
  node_webhook["PayPal webhook handler<br/>webhook controller"]
end

node_web -->|"browser requests"| node_entry
node_mobile -->|"API requests"| node_entry
node_entry -->|"dispatches"| node_routes
node_routes -->|"applies"| node_tenant
node_tenant -->|"authorizes tenant request"| node_controllers
node_tenant -->|"resolves membership"| node_identity
node_controllers -->|"maps input"| node_dto
node_controllers -->|"delegates lifecycle actions"| node_servi
node_controllers -->|"uploads attachments"| node_files
node_servi -->|"coordinates stages"| node_repair_stages
node_servi -->|"updates history"| node_repair_records
node_repair_stages -->|"records diagnosis and parts"| node_repair_records
node_files -->|"creates metadata"| node_file_records
node_files -->|"stores evidence"| node_storage
node_identity -->|"persists"| node_mysql
node_repair_records -->|"persists"| node_mysql
node_file_records -->|"persists"| node_mysql
node_servi -->|"queues notifications and receipts"| node_jobs
node_jobs -->|"renders"| node_templates
node_webhook -->|"applies recorded events"| node_subscriptions
node_subscriptions -->|"manages billing"| node_paypal
node_subscriptions -->|"persists subscription state"| node_mysql

click node_web "https://github.com/imaa-dev/tallerapp/blob/main/server-app/resources/js/app.tsx"
click node_mobile "https://github.com/imaa-dev/tallerapp/blob/main/tallerapp-app/src/app/_layout.tsx"
click node_entry "https://github.com/imaa-dev/tallerapp/blob/main/server-app/public/index.php"
click node_routes "https://github.com/imaa-dev/tallerapp/blob/main/server-app/routes/web.php"
click node_tenant "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Middleware/ResolveTenant.php"
click node_controllers "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Controllers/ServiController.php"
click node_servi "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/ServiService.php"
click node_repair_stages "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/DiagnosisService.php"
click node_dto "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/DTO/UpdateServiceDTO.php"
click node_files "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/FileService.php"
click node_subscriptions "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/SubscriptionService.php"
click node_identity "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/OrganizationUser.php"
click node_repair_records "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/Servi.php"
click node_file_records "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/ServiceFiles.php"
click node_jobs "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Jobs/RepairNotify.php"
click node_templates "https://github.com/imaa-dev/tallerapp/blob/main/server-app/resources/views/receipt/repair_receipt.blade.php"
click node_paypal "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/PayPalService.php"
click node_webhook "https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Controllers/PayPalWebhookController.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_mobile toneBlue
class node_entry,node_routes,node_tenant,node_controllers toneAmber
class node_servi,node_repair_stages,node_dto,node_files,node_subscriptions toneMint
class node_identity,node_repair_records,node_file_records,node_mysql,node_storage toneRose
class node_jobs,node_templates,node_paypal,node_webhook toneIndigo
```

## Components

### Client applications

- [Inertia React web](https://github.com/imaa-dev/tallerapp/blob/main/server-app/resources/js/app.tsx): web client · Service screens and browser API calls. · `server-app/resources/js/app.tsx`
- [Expo mobile app](https://github.com/imaa-dev/tallerapp/blob/main/tallerapp-app/src/app/_layout.tsx): mobile client · Authenticates, selects an organization, and shows services by status. · `tallerapp-app/src/app/_layout.tsx`

### Laravel HTTP boundary

- [Laravel entry point](https://github.com/imaa-dev/tallerapp/blob/main/server-app/public/index.php): PHP runtime · `server-app/public/index.php`
- [Web, API and auth routes](https://github.com/imaa-dev/tallerapp/blob/main/server-app/routes/web.php): route definitions · `server-app/routes/web.php`
- [Tenant and access middleware](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Middleware/ResolveTenant.php): middleware · Resolves the organization and enforces selection, active status, and access. · `server-app/app/Http/Middleware/ResolveTenant.php`
- [Controllers](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Controllers/ServiController.php): HTTP adapters · Web controllers and separate API controllers dispatch application operations. · `server-app/app/Http/Controllers/ServiController.php`

### Domain services

- [Repair service orchestration](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/ServiService.php): domain service · Coordinates the status-driven repair lifecycle. · `server-app/app/Services/ServiService.php`
- [Diagnosis and parts](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/DiagnosisService.php): stage services · `server-app/app/Services/DiagnosisService.php`
- [Service DTOs](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/DTO/UpdateServiceDTO.php): typed input · `server-app/app/DTO/UpdateServiceDTO.php`
- [File service](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/FileService.php): file boundary · Moves multipart service evidence into storage. · `server-app/app/Services/FileService.php`
- [Subscription service](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/SubscriptionService.php): billing domain service · `server-app/app/Services/SubscriptionService.php`

### Records and storage

- [Users and organizations](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/OrganizationUser.php): tenant identity records · Organization membership establishes the multi-tenant boundary. · `server-app/app/Models/OrganizationUser.php`
- [Repair records](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/Servi.php): operational models · Servi status and repair documents retain operational history. · `server-app/app/Models/Servi.php`
- [Service file records](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Models/ServiceFiles.php): attachment model · `server-app/app/Models/ServiceFiles.php`
- **MySQL**: database
- **Filesystem storage**: object/file storage

### Async and external services

- [Notification and receipt jobs](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Jobs/RepairNotify.php): queued jobs · Sends repair updates and generates receipts asynchronously. · `server-app/app/Jobs/RepairNotify.php`
- [Email and receipt templates](https://github.com/imaa-dev/tallerapp/blob/main/server-app/resources/views/receipt/repair_receipt.blade.php): Blade templates · `server-app/resources/views/receipt/repair_receipt.blade.php`
- [PayPal payment integration](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Services/PayPalService.php): payment gateway adapter · Processes payment activity and subscription changes. · `server-app/app/Services/PayPalService.php`
- [PayPal webhook handler](https://github.com/imaa-dev/tallerapp/blob/main/server-app/app/Http/Controllers/PayPalWebhookController.php): webhook controller · Records external events before billing state changes. · `server-app/app/Http/Controllers/PayPalWebhookController.php`

## Connections

- Inertia React web → Laravel entry point: browser requests
- Expo mobile app → Laravel entry point: API requests
- Laravel entry point → Web, API and auth routes: dispatches
- Web, API and auth routes → Tenant and access middleware: applies
- Tenant and access middleware → Controllers: authorizes tenant request
- Tenant and access middleware → Users and organizations: resolves membership
- Controllers → Service DTOs: maps input
- Controllers → Repair service orchestration: delegates lifecycle actions
- Controllers → File service: uploads attachments
- Repair service orchestration → Diagnosis and parts: coordinates stages
- Repair service orchestration → Repair records: updates history
- Diagnosis and parts → Repair records: records diagnosis and parts
- File service → Service file records: creates metadata
- File service → Filesystem storage: stores evidence
- Users and organizations → MySQL: persists
- Repair records → MySQL: persists
- Service file records → MySQL: persists
- Repair service orchestration → Notification and receipt jobs: queues notifications and receipts
- Notification and receipt jobs → Email and receipt templates: renders
- PayPal webhook handler → Subscription service: applies recorded events
- Subscription service → PayPal payment integration: manages billing
- Subscription service → MySQL: persists subscription state
