# eduayme/rescueapp architecture

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

- Interactive diagram: https://gitdiagram.com/eduayme/rescueapp
- Repository: https://github.com/eduayme/rescueapp

## Overview

1. **Overall shape**
   RescueApp is a monolithic Laravel web application for coordinating rescue missions for lost persons. The runtime is the standard Laravel HTTP stack: requests enter through `public/index.php`, pass through middleware, reach controllers in `app/Http/Controllers`, and render Blade templates in `resources/views`.

2. **Core domain boundary: a “search” mission**
   The central business object is the **Search** (`app/Models/Search.php`), which appears to act as the parent aggregate for the rest of the operational data. Most other rescue concepts hang off a search: lost people, incidents, tasks, action plans, and assigned resources. The `resources/views/searches/*` structure mirrors this hierarchy.

3. **Mission operations subsystem**
   The operational part of the app is split into separate controllers/models for:
   - **Lost people**: victim/person being searched for
   - **Incidents**: situation updates or field events attached to a search
   - **Tasks**: operational work items
   - **Action plans** and **to-do task AP**: structured planning for a search
   This suggests a workflow where users create a search, record the missing person, log incidents, and manage task execution and planning within that search context.

4. **Resource management subsystem**
   The app also manages response teams and personnel through dedicated entities:
   - **Groups**
   - **Leaders**
   - **Involved people**
   These live under `app/Models` and have their own views under `resources/views/searches/resources/*`, indicating they are operational resources assigned to a specific search rather than global admin records.

5. **Authentication, authorization, and user administration**
   Standard Laravel auth controllers are present, plus role/permission management controllers and views. The presence of `config/laratrust.php` and `database/migrations/2020_03_09_161313_laratrust_setup_tables.php` shows the app uses **Laratrust** for role-based access control. User management is a distinct subsystem with role assignment, permissions, and profile editing.

6. **Activity logging and audit trail**
   There is a dedicated `Activity` model/controller and a custom middleware named `AcitivityLog` (note the spelling). That implies user actions are recorded as operational history, which is important in emergency-response software where accountability and traceability matter.

7. **File and image handling**
   File uploads are a first-class part of the design. `app/Http/Traits/ImageUploadTrait.php` and the `public/uploads/*` directory show that images are stored on disk and organized by search/incident/lost-person context. The app therefore has a filesystem-backed media boundary rather than a separate object storage service in the repository.

8. **Presentation layer and localization**
   UI is server-rendered with Blade layouts and partials (`resources/views/layouts`, `resources/views/parts`). The application is heavily multilingual, with language packs in Catalan, German, English, Spanish, French, Italian, and Portuguese. This is a key architectural concern because labels/messages are externalized throughout the UI and forms.

9. **Validation and request boundaries**
   Form input is guarded by Laravel Form Requests, such as `Group/StoreUpdateRequest.php` and `Incident/StoreRequest.php`, `Incident/UpdateRequest.php`. That indicates controller logic is kept relatively thin, with validation and authorization rules separated from business actions.

10. **Data model and persistence**
    Persistence is Eloquent/MySQL-style relational storage via migrations and model classes. The migration set shows the schema evolved around users, searches, lost people, activities, action plans, tasks, groups, leaders, involved people, incidents, and incident images. This is the main data boundary; there is no evidence of a separate service-oriented backend.

11. **Documentation and content rendering**
    The repository includes `resources/docs/*` in multiple languages and a custom markdown parser service. This suggests some in-app documentation/help content is rendered from Markdown, likely using a custom parser to control formatting or extension behavior.

12. **Infrastructure and delivery**
    The project is containerized with Docker and Docker Compose, built/tested with Composer and Node tooling (`package.json`, `webpack.mix.js`). CI is configured through Travis. The app is intended to be deployed as a conventional PHP/Laravel web service with a public web root and local storage directories for runtime data.

13. **Testing surface**
    Tests focus on critical user-facing flows such as authentication and tasks (`tests/Feature/Auth/*`, `tests/Feature/TaskTest.php`, `tests/Feature/ActivityTest.php`). That implies the most important architectural contracts are around login/registration and core operational workflow rather than low-level unit isolation.

14. **How to draw the diagram**
    A good architecture diagram should center on the Laravel application boundary, with three major internal zones: **identity/access control**, **search operations**, and **resource/task management**. Surround those with supporting concerns: **localized Blade UI**, **filesystem uploads**, **relational database**, and **audit logging**. The strongest parent-child relationship is the search mission as the hub that owns most operational records.

Main entry points: [`app/Http/Controllers`](https://github.com/eduayme/rescueapp/tree/develop/app/Http/Controllers) (Controllers), [`app/Models/Search.php`](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Search.php) (Search), [`app/Http/Kernel.php`](https://github.com/eduayme/rescueapp/blob/develop/app/Http/Kernel.php) (HTTP kernel), [`app/Models/Role.php`](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Role.php) (Roles & perms)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Laravel runtime"]
  node_public_index["Front controller<br/>Laravel entrypoint<br/>[index.php]"]
  node_http_kernel["HTTP kernel<br/>middleware stack<br/>[Kernel.php]"]
  node_locale_middleware["Locale<br/>middleware<br/>[Locale.php]"]
  node_controllers["Controllers"]
  node_form_requests["Form requests<br/>validation boundary"]
end

subgraph group_search["Search missions"]
  node_search_model[("Search<br/>domain aggregate<br/>[Search.php]")]
  node_lost_person[("Lost person<br/>search record<br/>[LostPerson.php]")]
  node_incident[("Incident<br/>search event<br/>[Incident.php]")]
  node_task[("Task<br/>work item<br/>[Task.php]")]
  node_action_plan[("Action plan<br/>planning record<br/>[ActionPlan.php]")]
  node_resource_models[("Resources<br/>assigned personnel")]
end

subgraph group_identity["Identity & access"]
  node_auth_area["Auth stack<br/>login and reset"]
  node_user_admin["User admin<br/>account management<br/>[UserController.php]"]
  node_rbac_models[("Roles & perms<br/>access control<br/>[Role.php]")]
end

subgraph group_presentation["UI & localization"]
  node_layouts["Layouts<br/>Blade shell"]
  node_search_views["Search views<br/>Blade screens"]
  node_langs["Languages<br/>translations"]
  node_docs["Docs<br/>markdown help"]
end

subgraph group_support["Support systems"]
  node_activity(("Activity log<br/>audit trail<br/>[Activity.php]"))
  node_image_upload["Image upload<br/>filesystem media"]
  node_markdown_parser["Markdown parser<br/>rendering service"]
  node_database[("Relational DB<br/>migrations and Eloquent")]
end

node_public_index -->|"bootstraps"| node_http_kernel
node_http_kernel -->|"includes"| node_locale_middleware
node_http_kernel -->|"dispatches"| node_controllers
node_controllers -->|"validates with"| node_form_requests
node_controllers -->|"manages"| node_search_model
node_controllers -->|"manages"| node_lost_person
node_controllers -->|"manages"| node_incident
node_controllers -->|"manages"| node_task
node_controllers -->|"manages"| node_action_plan
node_controllers -->|"manages"| node_resource_models
node_search_model -->|"owns"| node_lost_person
node_search_model -->|"owns"| node_incident
node_search_model -->|"owns"| node_task
node_search_model -->|"owns"| node_action_plan
node_search_model -->|"coordinates"| node_resource_models
node_auth_area -->|"enforced by"| node_rbac_models
node_user_admin -->|"assigns"| node_rbac_models
node_layouts -->|"wraps"| node_search_views
node_search_views -->|"renders with"| node_langs
node_docs -->|"parsed by"| node_markdown_parser
node_controllers -->|"logs to"| node_activity
node_controllers -->|"uploads via"| node_image_upload
node_search_model -->|"persists in"| node_database
node_rbac_models -->|"persists in"| node_database
node_activity -->|"persists in"| node_database

click node_public_index "https://github.com/eduayme/rescueapp/blob/develop/public/index.php"
click node_http_kernel "https://github.com/eduayme/rescueapp/blob/develop/app/Http/Kernel.php"
click node_locale_middleware "https://github.com/eduayme/rescueapp/blob/develop/app/Http/Middleware/Locale.php"
click node_controllers "https://github.com/eduayme/rescueapp/tree/develop/app/Http/Controllers"
click node_form_requests "https://github.com/eduayme/rescueapp/tree/develop/app/Http/Requests"
click node_search_model "https://github.com/eduayme/rescueapp/blob/develop/app/Models/Search.php"
click node_lost_person "https://github.com/eduayme/rescueapp/blob/develop/app/Models/LostPerson.php"
click node_incident "https://github.com/eduayme/rescueapp/blob/develop/app/Models/Incident.php"
click node_task "https://github.com/eduayme/rescueapp/blob/develop/app/Models/Task.php"
click node_action_plan "https://github.com/eduayme/rescueapp/blob/develop/app/Models/ActionPlan.php"
click node_resource_models "https://github.com/eduayme/rescueapp/tree/develop/app/Models"
click node_auth_area "https://github.com/eduayme/rescueapp/tree/develop/app/Http/Controllers/Auth"
click node_user_admin "https://github.com/eduayme/rescueapp/blob/develop/app/Http/Controllers/UserController.php"
click node_rbac_models "https://github.com/eduayme/rescueapp/blob/develop/app/Models/Role.php"
click node_layouts "https://github.com/eduayme/rescueapp/tree/develop/resources/views/layouts"
click node_search_views "https://github.com/eduayme/rescueapp/tree/develop/resources/views/searches"
click node_langs "https://github.com/eduayme/rescueapp/tree/develop/resources/lang"
click node_docs "https://github.com/eduayme/rescueapp/tree/develop/resources/docs"
click node_activity "https://github.com/eduayme/rescueapp/blob/develop/app/Models/Activity.php"
click node_image_upload "https://github.com/eduayme/rescueapp/blob/develop/app/Http/Traits/ImageUploadTrait.php"
click node_markdown_parser "https://github.com/eduayme/rescueapp/blob/develop/app/Services/CustomMarkdownParser.php"
click node_database "https://github.com/eduayme/rescueapp/tree/develop/database/migrations"

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_public_index,node_http_kernel,node_locale_middleware,node_controllers,node_form_requests toneBlue
class node_search_model,node_lost_person,node_incident,node_task,node_action_plan,node_resource_models toneAmber
class node_auth_area,node_user_admin,node_rbac_models toneMint
class node_layouts,node_search_views,node_langs,node_docs toneRose
class node_activity,node_image_upload,node_markdown_parser,node_database toneIndigo
```

## Components

### Laravel runtime

HTTP entry, middleware, controllers, providers, and request handling.

- [Front controller](https://github.com/eduayme/rescueapp/blob/develop/public/index.php): Laravel entrypoint · Web entry into the application runtime. · `public/index.php`
- [HTTP kernel](https://github.com/eduayme/rescueapp/blob/develop/app/Http/Kernel.php): middleware stack · Registers and runs request middleware. · `app/Http/Kernel.php`
- [Locale](https://github.com/eduayme/rescueapp/blob/develop/app/Http/Middleware/Locale.php): middleware · Sets request language and localization context. · `app/Http/Middleware/Locale.php`
- [Controllers](https://github.com/eduayme/rescueapp/tree/develop/app/Http/Controllers): web controllers · Main application controllers for searches, tasks, incidents, resources, and auth. · `app/Http/Controllers`
- [Form requests](https://github.com/eduayme/rescueapp/tree/develop/app/Http/Requests): validation boundary · Request validation for constrained create and update flows. · `app/Http/Requests`

### Search missions

Core rescue mission aggregate and operational records.

- [Search](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Search.php): domain aggregate · Central mission record that anchors the rescue workflow. · `app/Models/Search.php`
- [Lost person](https://github.com/eduayme/rescueapp/blob/develop/app/Models/LostPerson.php): search record · Missing person profile attached to a search. · `app/Models/LostPerson.php`
- [Incident](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Incident.php): search event · Operational event or update recorded under a search. · `app/Models/Incident.php`
- [Task](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Task.php): work item · Operational task tracked within a search. · `app/Models/Task.php`
- [Action plan](https://github.com/eduayme/rescueapp/blob/develop/app/Models/ActionPlan.php): planning record · Structured plan for search execution. · `app/Models/ActionPlan.php`
- [Resources](https://github.com/eduayme/rescueapp/tree/develop/app/Models): assigned personnel · Groups, leaders, and involved people assigned to a search. · `app/Models`

### Identity & access

Authentication, users, roles, permissions, and profile management.

- [Auth stack](https://github.com/eduayme/rescueapp/tree/develop/app/Http/Controllers/Auth): login and reset · Built-in authentication controllers and flows. · `app/Http/Controllers/Auth`
- [User admin](https://github.com/eduayme/rescueapp/blob/develop/app/Http/Controllers/UserController.php): account management · User profile and user management controllers. · `app/Http/Controllers/UserController.php`
- [Roles & perms](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Role.php): access control · Laratrust-backed roles and permissions. · `app/Models/Role.php`

### UI & localization

Blade views, shared layout pieces, docs, and translated text.

- [Layouts](https://github.com/eduayme/rescueapp/tree/develop/resources/views/layouts): Blade shell · Shared application and secondary layouts. · `resources/views/layouts`
- [Search views](https://github.com/eduayme/rescueapp/tree/develop/resources/views/searches): Blade screens · Search, incident, task, resource, and finalization views. · `resources/views/searches`
- [Languages](https://github.com/eduayme/rescueapp/tree/develop/resources/lang): translations · Localized UI strings across multiple languages. · `resources/lang`
- [Docs](https://github.com/eduayme/rescueapp/tree/develop/resources/docs): markdown help · Multilingual markdown documentation content. · `resources/docs`

### Support systems

Audit logging, uploads, parsing, persistence, and delivery tooling.

- [Activity log](https://github.com/eduayme/rescueapp/blob/develop/app/Models/Activity.php): audit trail · User action history and operational logging. · `app/Models/Activity.php`
- [Image upload](https://github.com/eduayme/rescueapp/blob/develop/app/Http/Traits/ImageUploadTrait.php): filesystem media · Trait for storing uploaded images and files. · `app/Http/Traits/ImageUploadTrait.php`
- [Markdown parser](https://github.com/eduayme/rescueapp/blob/develop/app/Services/CustomMarkdownParser.php): rendering service · Custom markdown parsing for help content. · `app/Services/CustomMarkdownParser.php`
- [Relational DB](https://github.com/eduayme/rescueapp/tree/develop/database/migrations): migrations and Eloquent · MySQL-style persistence defined by migrations and models. · `database/migrations`

## Connections

- Front controller → HTTP kernel: bootstraps · Incoming web requests enter the Laravel HTTP pipeline.
- HTTP kernel → Locale: includes · Localization middleware participates in request handling.
- HTTP kernel → Controllers: dispatches · Requests flow onward to application controllers.
- Controllers → Form requests: validates with · Controllers delegate input validation to form requests.
- Controllers → Search: manages · Search controllers coordinate the core mission aggregate.
- Controllers → Lost person: manages · Lost-person controllers operate on missing-person records.
- Controllers → Incident: manages · Incident controllers record field updates and events.
- Controllers → Task: manages · Task controllers handle operational work items.
- Controllers → Action plan: manages · Planning controllers maintain action plans and to-do tasks.
- Controllers → Resources: manages · Resource controllers manage groups, leaders, and involved people.
- Search → Lost person: owns · Lost person records belong to a search.
- Search → Incident: owns · Incidents are attached to a search.
- Search → Task: owns · Tasks are tracked within a search.
- Search → Action plan: owns · Action plans are created for a search.
- Search → Resources: coordinates · Groups, leaders, and involved people are assigned per search.
- Auth stack → Roles & perms: enforced by · Authentication and admin flows are gated by roles and permissions.
- User admin → Roles & perms: assigns · User management includes role and permission assignment.
- Layouts → Search views: wraps · Blade layouts provide the shared UI shell.
- Search views → Languages: renders with · Views use localized strings for multilingual UI.
- Docs → Markdown parser: parsed by · Help content is rendered through a custom markdown parser.
- Controllers → Activity log: logs to · Operational actions are written to the activity trail.
- Controllers → Image upload: uploads via · Controllers use filesystem-backed image handling.
- Search → Relational DB: persists in · Core mission data is stored in the relational database.
- Roles & perms → Relational DB: persists in · Role and permission tables are created through migrations.
- Activity log → Relational DB: persists in · Audit records are stored in relational tables.
