# qianjedmarrforro/lifeflow architecture

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

- Interactive diagram: https://gitdiagram.com/qianjedmarrforro/lifeflow
- Repository: https://github.com/qianjedmarrforro/lifeflow

## Overview

1. **Overall shape**
   - This is a monolithic Laravel 11-style PHP web application with server-rendered Blade views.
   - The architectural center is the standard Laravel MVC stack: HTTP routes → controllers → Eloquent models → Blade templates, with database-backed state and Laravel services for auth, sessions, mail/notifications, and storage.

2. **Primary domain: blood donation management**
   - The repo is organized around a blood bank / donation workflow.
   - Core domain objects are `BloodRequest`, `Donation`, `Report`, and `User`, with an additional `blood_inventories` table migration suggesting inventory tracking as part of the domain state.

3. **Request handling boundary**
   - `routes/web.php` is the main entrypoint for browser traffic.
   - Requests are dispatched to controllers under `app/Http/Controllers`, including:
     - `BloodRequestController`
     - `DonationController`
     - `ReportController`
     - `DashboardController`
     - `ProfileController`
     - `AdminController`
   - This indicates a traditional server-side application rather than an API-first design.

4. **Authentication and account management**
   - Auth is handled inside `app/Http/Controllers/Auth` with controllers for login, registration, and authenticated session lifecycle.
   - `app/Http/Requests/Auth/LoginRequest.php` provides request validation for login.
   - User identity is persisted in the `users` table and likely tied into Laravel’s built-in session auth guard.

5. **Role-oriented UI split**
   - The views are clearly divided between general-user pages and admin pages.
   - Public/user-facing pages include welcome, about, information, bulletin, blood request creation/listing, donation pages, profile, and donor records.
   - Admin pages live under `resources/views/admin`, including dashboards, user management, donation details, blood requests, and reports.
   - This suggests the main boundary is not between services, but between user roles and corresponding controller/view flows.

6. **Blood request workflow**
   - Blood requests appear to be a first-class object with their own create/index pages and admin review pages.
   - The `blood_requests` table also has an `is_read` field added later, implying request state is tracked beyond simple CRUD.
   - `RequestStatusNotification` indicates changes in request status trigger user notification events.

7. **Donation workflow**
   - Donation submission is handled by `DonationController` and supported by the `DonationSubmitted` notification.
   - There are both donation creation and donation detail pages, plus an admin donations screen.
   - Migrations show later schema evolution for donation identification fields (`id_type` additions), so donation records likely support donor verification or categorization.

8. **Reporting and admin analytics**
   - `ReportController` and `resources/views/admin/reports/*` show a reporting subsystem built from persisted data rather than a separate analytics service.
   - The report UI is split into partials for donations and requests tables, suggesting the admin report page aggregates multiple domain datasets into one dashboard-like view.

9. **Persistence model**
   - Data is stored in a relational database through Laravel migrations and Eloquent models.
   - Tables present in migrations: users, cache, jobs, blood_requests, blood_inventories, donations, reports, notifications.
   - The presence of `notifications` and `jobs` tables shows Laravel’s built-in async and notification infrastructure is available, even if the app may mainly use synchronous web flows.

10. **Notifications and state propagation**
   - Notifications are implemented with Laravel notification classes rather than a custom messaging subsystem.
   - `DonationSubmitted` and `RequestStatusNotification` likely bridge controller actions to user-facing alerts, with persistence in the database notifications table.
   - This is the main cross-cutting mechanism connecting operational events to user feedback.

11. **Frontend and presentation layer**
   - UI rendering is done with Blade templates and a small component layer (`resources/views/components`, `app/View/Components/Logo.php`).
   - Static assets are built with Vite (`vite.config.js`) and live under `resources/css` and `resources/js`.
   - This is a classic server-rendered Laravel frontend, not a SPA architecture.

12. **Middleware and session behavior**
   - `PreventBackHistory` suggests custom middleware to control browser back-navigation after logout or auth transitions.
   - Session, cache, and logging are configured through standard Laravel config, with `.env.example` indicating environment-driven deployment.

13. **Runtime and deployment boundaries**
   - The app runs through the Laravel public entrypoint (`public/index.php`) and uses the usual `artisan` console for maintenance tasks, migrations, and seeding.
   - `storage/` holds logs, compiled views, sessions, and file-backed application data; `database/factories` and `seeders` support local/test data generation.

14. **What to draw in an architecture diagram**
   - Show a single Laravel web application boundary.
   - Inside it: browser routes → controllers → Eloquent models/migrations → database.
   - Add side paths from controllers/models to Laravel notifications and sessions/auth.
   - Separate the admin UI and public/user UI as two presentation slices over the same domain/data store.

Main entry points: [`routes/web.php`](https://github.com/qianjedmarrforro/lifeflow/blob/main/routes/web.php) (Web routes), [`resources/views`](https://github.com/qianjedmarrforro/lifeflow/tree/main/resources/views) (Blade UI), [`app/Http/Controllers/BloodRequestController.php`](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/BloodRequestController.php) (Blood requests), [`app/Http/Controllers/DonationController.php`](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/DonationController.php) (Donations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_blade_views["Blade UI<br/>views"]
  node_blade_components["UI components<br/>blade components"]
end

subgraph group_app["Application"]
  node_routes_web["Web routes<br/>route map<br/>[web.php]"]
  node_auth_login_controller["Auth login<br/>controller"]
  node_auth_session_controller["Auth session<br/>controller"]
  node_auth_register_controller["Register<br/>controller"]
  node_blood_request_controller["Blood requests<br/>controller"]
  node_donation_controller["Donations<br/>controller"]
  node_report_controller["Reports<br/>controller"]
  node_dashboard_controller["Dashboard<br/>controller"]
  node_profile_controller["Profile<br/>controller"]
  node_admin_controller["Admin<br/>controller"]
  node_prevent_back_history{{"Back guard<br/>middleware"}}
  node_login_request["Login request<br/>form request<br/>[LoginRequest.php]"]
end

subgraph group_domain["Domain"]
  node_user_model[("User<br/>eloquent model<br/>[User.php]")]
  node_blood_request_model[("BloodRequest<br/>eloquent model<br/>[BloodRequest.php]")]
  node_donation_model[("Donation<br/>eloquent model<br/>[Donation.php]")]
  node_report_model[("Report<br/>eloquent model<br/>[Report.php]")]
  node_donation_submitted["Donation notice<br/>notification"]
  node_request_status_notification["Status notice<br/>notification"]
end

subgraph group_infra["Infrastructure"]
  node_app_entry["App entry<br/>bootstrap<br/>[index.php]"]
  node_migrations["Migrations<br/>schema"]
  node_storage[("Storage")]
  node_config["Config"]
end

node_app_entry -->|"boots"| node_routes_web
node_routes_web -->|"dispatches"| node_dashboard_controller
node_routes_web -->|"dispatches"| node_blood_request_controller
node_routes_web -->|"dispatches"| node_donation_controller
node_routes_web -->|"dispatches"| node_report_controller
node_routes_web -->|"dispatches"| node_profile_controller
node_routes_web -->|"dispatches"| node_admin_controller
node_routes_web -->|"dispatches"| node_auth_login_controller
node_routes_web -->|"dispatches"| node_auth_session_controller
node_routes_web -->|"dispatches"| node_auth_register_controller
node_auth_login_controller -->|"validates"| node_login_request
node_auth_login_controller -->|"authenticates"| node_user_model
node_auth_session_controller -->|"logs in/out"| node_user_model
node_auth_register_controller -->|"creates"| node_user_model
node_dashboard_controller -->|"renders"| node_blade_views
node_blood_request_controller -->|"uses"| node_blood_request_model
node_blood_request_controller -->|"notifies"| node_request_status_notification
node_donation_controller -->|"uses"| node_donation_model
node_donation_controller -->|"notifies"| node_donation_submitted
node_report_controller -->|"uses"| node_report_model
node_admin_controller -->|"renders"| node_blade_views
node_profile_controller -->|"renders"| node_blade_views
node_blood_request_controller -->|"renders"| node_blade_views
node_donation_controller -->|"renders"| node_blade_views
node_blade_views -->|"uses"| node_blade_components
node_blood_request_model -->|"stored by"| node_migrations
node_donation_model -->|"stored by"| node_migrations
node_report_model -->|"stored by"| node_migrations
node_user_model -->|"stored by"| node_migrations
node_blood_request_model -.->|"persists"| node_storage
node_donation_submitted -->|"writes"| node_storage
node_request_status_notification -->|"writes"| node_storage
node_config -.->|"configures"| node_auth_session_controller
node_config -.->|"configures"| node_storage
node_prevent_back_history -->|"guards"| node_auth_session_controller

click node_routes_web "https://github.com/qianjedmarrforro/lifeflow/blob/main/routes/web.php"
click node_auth_login_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/LoginController.php"
click node_auth_session_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_auth_register_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_blood_request_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/BloodRequestController.php"
click node_donation_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/DonationController.php"
click node_report_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/ReportController.php"
click node_dashboard_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/DashboardController.php"
click node_profile_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/ProfileController.php"
click node_admin_controller "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/AdminController.php"
click node_prevent_back_history "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Middleware/PreventBackHistory.php"
click node_login_request "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Requests/Auth/LoginRequest.php"
click node_user_model "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/User.php"
click node_blood_request_model "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/BloodRequest.php"
click node_donation_model "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/Donation.php"
click node_report_model "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/Report.php"
click node_donation_submitted "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Notifications/DonationSubmitted.php"
click node_request_status_notification "https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Notifications/RequestStatusNotification.php"
click node_blade_views "https://github.com/qianjedmarrforro/lifeflow/tree/main/resources/views"
click node_blade_components "https://github.com/qianjedmarrforro/lifeflow/tree/main/resources/views/components"
click node_app_entry "https://github.com/qianjedmarrforro/lifeflow/blob/main/public/index.php"
click node_migrations "https://github.com/qianjedmarrforro/lifeflow/tree/main/database/migrations"
click node_storage "https://github.com/qianjedmarrforro/lifeflow/tree/main/storage"
click node_config "https://github.com/qianjedmarrforro/lifeflow/tree/main/config"

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_blade_views,node_blade_components toneBlue
class node_routes_web,node_auth_login_controller,node_auth_session_controller,node_auth_register_controller,node_blood_request_controller,node_donation_controller,node_report_controller,node_dashboard_controller,node_profile_controller,node_admin_controller,node_prevent_back_history,node_login_request toneAmber
class node_user_model,node_blood_request_model,node_donation_model,node_report_model,node_donation_submitted,node_request_status_notification toneMint
class node_app_entry,node_migrations,node_storage,node_config toneRose
```

## Components

### Presentation

Browser-facing Blade views and shared UI components

- [Blade UI](https://github.com/qianjedmarrforro/lifeflow/tree/main/resources/views): views · Public and admin server-rendered pages · `resources/views`
- [UI components](https://github.com/qianjedmarrforro/lifeflow/tree/main/resources/views/components): blade components · Shared layout and logo components · `resources/views/components`

### Application

HTTP entrypoints, controllers, middleware, auth, and request validation

- [Web routes](https://github.com/qianjedmarrforro/lifeflow/blob/main/routes/web.php): route map · Main browser routing entrypoint · `routes/web.php`
- [Auth login](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/LoginController.php): controller · Login and session sign-in flow · `app/Http/Controllers/Auth/LoginController.php`
- [Auth session](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): controller · Authenticated session lifecycle · `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Register](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): controller · User registration flow · `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Blood requests](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/BloodRequestController.php): controller · Create, list, and manage blood requests · `app/Http/Controllers/BloodRequestController.php`
- [Donations](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/DonationController.php): controller · Donation submission and detail flows · `app/Http/Controllers/DonationController.php`
- [Reports](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/ReportController.php): controller · Aggregated admin reporting · `app/Http/Controllers/ReportController.php`
- [Dashboard](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/DashboardController.php): controller · Role-based landing pages and summary views · `app/Http/Controllers/DashboardController.php`
- [Profile](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/ProfileController.php): controller · Profile display and edit flows · `app/Http/Controllers/ProfileController.php`
- [Admin](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Controllers/AdminController.php): controller · Admin screens and management actions · `app/Http/Controllers/AdminController.php`
- [Back guard](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Middleware/PreventBackHistory.php): middleware · Prevents stale browser history after auth transitions · `app/Http/Middleware/PreventBackHistory.php`
- [Login request](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Http/Requests/Auth/LoginRequest.php): form request · Validation for sign-in input · `app/Http/Requests/Auth/LoginRequest.php`

### Domain

Core models, notifications, and business state

- [User](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/User.php): eloquent model · Authenticated account and role identity · `app/Models/User.php`
- [BloodRequest](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/BloodRequest.php): eloquent model · Blood request state and tracking · `app/Models/BloodRequest.php`
- [Donation](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/Donation.php): eloquent model · Donation records and donor details · `app/Models/Donation.php`
- [Report](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Models/Report.php): eloquent model · Persisted reporting records · `app/Models/Report.php`
- [Donation notice](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Notifications/DonationSubmitted.php): notification · Sent when a donation is submitted · `app/Notifications/DonationSubmitted.php`
- [Status notice](https://github.com/qianjedmarrforro/lifeflow/blob/main/app/Notifications/RequestStatusNotification.php): notification · Sent when a blood request changes status · `app/Notifications/RequestStatusNotification.php`

### Infrastructure

Persistence, config, runtime, and framework bootstrapping

- [App entry](https://github.com/qianjedmarrforro/lifeflow/blob/main/public/index.php): bootstrap · Laravel HTTP bootstrap and public entrypoint · `public/index.php`
- [Migrations](https://github.com/qianjedmarrforro/lifeflow/tree/main/database/migrations): schema · Database tables and schema evolution · `database/migrations`
- [Storage](https://github.com/qianjedmarrforro/lifeflow/tree/main/storage): runtime storage · Logs, sessions, cached views, and files · `storage`
- [Config](https://github.com/qianjedmarrforro/lifeflow/tree/main/config): framework config · Auth, database, mail, queue, session, and services settings · `config`

## Connections

- App entry → Web routes: boots · HTTP requests enter through the Laravel bootstrap and route map
- Web routes → Dashboard: dispatches · Browser routes resolve to dashboard flows
- Web routes → Blood requests: dispatches · Routes for blood request pages and actions
- Web routes → Donations: dispatches · Routes for donation pages and actions
- Web routes → Reports: dispatches · Routes for admin reports
- Web routes → Profile: dispatches · Routes for profile pages
- Web routes → Admin: dispatches · Routes for admin management screens
- Web routes → Auth login: dispatches · Login routes
- Web routes → Auth session: dispatches · Session lifecycle routes
- Web routes → Register: dispatches · Registration routes
- Auth login → Login request: validates · Sign-in input is validated before authentication
- Auth login → User: authenticates · Login verifies user identity
- Auth session → User: logs in/out · Authenticated session is tied to the user account
- Register → User: creates · Registration persists new accounts
- Dashboard → Blade UI: renders · Dashboard pages are server-rendered
- Blood requests → BloodRequest: uses · Blood request controller reads and writes request state
- Blood requests → Status notice: notifies · Request status changes trigger user alerts
- Donations → Donation: uses · Donation controller persists donation records
- Donations → Donation notice: notifies · Submitted donations trigger notifications
- Reports → Report: uses · Reporting is backed by persisted report data
- Admin → Blade UI: renders · Admin screens are Blade templates
- Profile → Blade UI: renders · Profile pages are Blade templates
- Blood requests → Blade UI: renders · Blood request pages are Blade templates
- Donations → Blade UI: renders · Donation pages are Blade templates
- Blade UI → UI components: uses · Shared layout and logo components support pages
- BloodRequest → Migrations: stored by · Blood request state lives in relational tables
- Donation → Migrations: stored by · Donation records are schema-backed
- Report → Migrations: stored by · Reports are persisted in the database
- User → Migrations: stored by · User accounts are schema-backed
- BloodRequest → Storage: persists · Notifications and app state may use storage-backed runtime data
- Donation notice → Storage: writes · Notifications are stored via Laravel notification storage
- Status notice → Storage: writes · Notifications are stored via Laravel notification storage
- Config → Auth session: configures · Auth/session behavior is framework-configured
- Config → Storage: configures · Runtime storage paths and drivers are configured centrally
- Back guard → Auth session: guards · Middleware protects auth transitions and logout history
