# rks-ad/lawupwebstackfull architecture

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

- Interactive diagram: https://gitdiagram.com/rks-ad/lawupwebstackfull
- Repository: https://github.com/rks-ad/lawupwebstackfull

## Overview

#### Purpose and runtime
A server-rendered legal-services marketplace: users discover lawyers/services, book consultations and order services; lawyers manage offerings, orders, payments, and withdrawals; admins operate the platform. It is a PHP Laravel application rooted under `src/core`, fronted by a public PHP entry point and containerized with Nginx.
- `src/index.php`
- `src/core/artisan`
- `Dockerfile`
- `docker/nginx.conf`

#### Application entry and routing
Laravel bootstraps through its standard application bootstrap, with route domains separated by audience and integration boundary. Site/public routes, user and lawyer portals, administration, API, payment IPNs, broadcasting channels, and scheduled commands are independently declared.
- `src/core/bootstrap/app.php`
- `src/core/routes/web.php`
- `src/core/routes/user.php`
- `src/core/routes/lawyer.php`
- `src/core/routes/admin.php`
- `src/core/routes/ipn.php`

#### Identity, roles, and access gates
Three principal identities—admin, user, lawyer—have separate authentication controllers, models, portal controllers, and views. Middleware enforces authentication, account status, role routing, KYC, staged registration, service entitlement, template/language selection, and maintenance mode before business actions execute.
- `src/core/app/Models/User.php`
- `src/core/app/Models/Lawyer.php`
- `src/core/app/Models/Admin.php`
- `src/core/app/Http/Middleware/KycMiddleware.php`
- `src/core/app/Http/Middleware/LawyerServiceAccess.php`

#### Marketplace workflow
The central transactional flow is: lawyers create categorized services; users browse marketplace content, submit bookings or service orders; both parties monitor progress, reviews, chats, and support. Persistent Eloquent models form the shared domain boundary, while audience-specific controllers expose the same lifecycle to each role.
- `src/core/app/Models/Service.php`
- `src/core/app/Models/ServiceOrder.php`
- `src/core/app/Models/Booking.php`
- `src/core/app/Http/Controllers/User/ServiceOrderController.php`
- `src/core/app/Http/Controllers/Lawyer/ServiceController.php`

#### Money, plans, and payouts
Deposits fund user/lawyer actions such as plans and boosts; transactions record financial state; withdrawal requests flow to admin-managed withdrawal methods. `PaymentController` is the common orchestration boundary, delegating initiation/callback handling to a large gateway adapter set; IPN routes receive external provider notifications.
- `src/core/app/Http/Controllers/Gateway/PaymentController.php`
- `src/core/app/Models/Deposit.php`
- `src/core/app/Models/Transaction.php`
- `src/core/app/Models/Withdrawal.php`
- `src/core/app/Http/Controllers/Gateway/Stripe/ProcessController.php`

#### Communication and notifications
Chat is modeled separately from marketplace orders and mediated by `ChatService`; message events and Blade partials indicate realtime delivery via configured broadcasting/Pusher. A configurable notification subsystem renders templates and sends email, SMS (including Textmagic), and push notifications; Firebase browser messaging assets support web push.
- `src/core/app/Services/ChatService.php`
- `src/core/app/Events/MessageSent.php`
- `src/core/app/Notify/NotifyProcess.php`
- `src/core/config/broadcasting.php`
- `src/assets/global/js/firebase/configs.js`

#### Administration and presentation
Admins manage marketplace records, payment gateways, KYC, frontend content/pages, language, notification templates, cron configuration, reports, and system settings. The application is Blade-rendered with a selectable “basic” template; frontend assets live outside Laravel’s core and are served from `src/assets`.
- `src/core/app/Http/Controllers/Admin/AdminController.php`
- `src/core/app/Http/Controllers/Admin/PageBuilderController.php`
- `src/core/resources/views/templates/basic/layouts/frontend.blade.php`
- `src/core/resources/views/admin/layouts/app.blade.php`
- `src/assets/templates/basic`

#### Infrastructure and operational boundaries
Configuration is environment-driven (`.env.example`) for database, mail, sessions/cache/queue, external services, and filesystem storage. Laravel’s scheduler/cron controller and cron models provide application-managed periodic execution. Uploaded/public and framework runtime data belong under `storage`, requiring writable persistent storage in deployment.
- `src/core/.env.example`
- `src/core/config/database.php`
- `src/core/config/services.php`
- `src/core/app/Http/Controllers/CronController.php`
- `src/core/app/Models/CronSchedule.php`

Main entry points: [`src/core/app/Http/Controllers/Gateway/PaymentController.php`](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Gateway/PaymentController.php) (Payment orchestration), [`src/core/app/Http/Controllers/User/ServiceOrderController.php`](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/User/ServiceOrderController.php) (Marketplace portals), [`src/core/app/Models/ServiceOrder.php`](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Models/ServiceOrder.php) (Services, orders & bookings), [`src/core/app/Http/Controllers/Admin/AdminController.php`](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Admin/AdminController.php) (Admin operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge &amp; Runtime"]
  node_nginx["Nginx container<br/>web server<br/>[nginx.conf]"]
  node_public_entry["Public entry point<br/>PHP entry<br/>[index.php]"]
  node_runtime_storage[("Environment &amp; persistent storage<br/>runtime boundary<br/>[.env.example]")]
end

subgraph group_app["Laravel Application"]
  node_bootstrap["Laravel bootstrap<br/>application bootstrap<br/>[app.php]"]
  node_routes["Audience &amp; IPN routes<br/>route boundary<br/>[web.php]"]
  node_access["Identity &amp; access gates<br/>auth middleware<br/>[KycMiddleware.php]"]
  node_scheduler["Application scheduler<br/>cron controller<br/>[CronController.php]"]
end

subgraph group_marketplace["Marketplace Domain"]
  node_marketplace_controllers["Marketplace portals<br/>role controllers"]
  node_marketplace_domain[("Services, orders &amp; bookings<br/>Eloquent domain<br/>[ServiceOrder.php]")]
end

subgraph group_money["Payments &amp; Payouts"]
  node_payment_controller["Payment orchestration<br/>gateway controller"]
  node_gateway_adapter["Stripe gateway adapter<br/>payment adapter"]
  node_financial_domain[("Deposits &amp; payouts<br/>financial models<br/>[Transaction.php]")]
end

subgraph group_comms["Communication"]
  node_chat_service["Chat service<br/>application service<br/>[ChatService.php]"]
  node_message_event["Realtime message event<br/>broadcast event<br/>[MessageSent.php]"]
  node_notifications["Notification delivery<br/>notification service<br/>[NotifyProcess.php]"]
end

subgraph group_presentation["Administration &amp; UI"]
  node_admin_portal["Admin operations<br/>admin controllers"]
  node_page_builder["Page builder<br/>content controller"]
  node_blade_ui["Blade templates<br/>server-rendered UI<br/>[frontend.blade.php]"]
  node_assets["Public assets<br/>frontend assets"]
end

node_nginx -->|"serves"| node_public_entry
node_public_entry -->|"boots"| node_bootstrap
node_bootstrap -->|"registers"| node_routes
node_routes -->|"protects portal actions"| node_access
node_access -->|"authorizes"| node_marketplace_controllers
node_marketplace_controllers -->|"creates and updates"| node_marketplace_domain
node_routes -->|"payment and IPN endpoints"| node_payment_controller
node_payment_controller -->|"delegates processing"| node_gateway_adapter
node_gateway_adapter -.->|"provider callback"| node_payment_controller
node_payment_controller -->|"records financial state"| node_financial_domain
node_marketplace_controllers -->|"funds orders and plans"| node_payment_controller
node_marketplace_controllers -->|"supports participant chat"| node_chat_service
node_chat_service -->|"emits"| node_message_event
node_message_event -.->|"triggers delivery"| node_notifications
node_admin_portal -->|"operates records"| node_marketplace_domain
node_admin_portal -->|"manages withdrawals"| node_financial_domain
node_admin_portal -->|"manages content"| node_page_builder
node_page_builder -->|"publishes pages"| node_blade_ui
node_blade_ui -->|"uses"| node_assets
node_scheduler -.->|"runs periodic work"| node_marketplace_domain
node_bootstrap -->|"loads configuration"| node_runtime_storage
node_marketplace_domain -->|"persists data and uploads"| node_runtime_storage

click node_nginx "https://github.com/rks-ad/lawupwebstackfull/blob/main/docker/nginx.conf"
click node_public_entry "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/index.php"
click node_bootstrap "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/bootstrap/app.php"
click node_routes "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/routes/web.php"
click node_access "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Middleware/KycMiddleware.php"
click node_marketplace_controllers "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/User/ServiceOrderController.php"
click node_marketplace_domain "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Models/ServiceOrder.php"
click node_payment_controller "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Gateway/PaymentController.php"
click node_gateway_adapter "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Gateway/Stripe/ProcessController.php"
click node_financial_domain "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Models/Transaction.php"
click node_chat_service "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Services/ChatService.php"
click node_message_event "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Events/MessageSent.php"
click node_notifications "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Notify/NotifyProcess.php"
click node_admin_portal "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Admin/AdminController.php"
click node_page_builder "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Admin/PageBuilderController.php"
click node_blade_ui "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/resources/views/templates/basic/layouts/frontend.blade.php"
click node_assets "https://github.com/rks-ad/lawupwebstackfull/tree/main/src/assets/templates/basic"
click node_scheduler "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/CronController.php"
click node_runtime_storage "https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/.env.example"

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_nginx,node_public_entry,node_runtime_storage toneBlue
class node_bootstrap,node_routes,node_access,node_scheduler toneAmber
class node_marketplace_controllers,node_marketplace_domain toneMint
class node_payment_controller,node_gateway_adapter,node_financial_domain toneRose
class node_chat_service,node_message_event,node_notifications toneIndigo
class node_admin_portal,node_page_builder,node_blade_ui,node_assets toneTeal
```

## Components

### Edge & Runtime

- [Nginx container](https://github.com/rks-ad/lawupwebstackfull/blob/main/docker/nginx.conf): web server · Serves the public PHP entry point. · `docker/nginx.conf`
- [Public entry point](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/index.php): PHP entry · `src/index.php`
- [Environment & persistent storage](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/.env.example): runtime boundary · Environment config and writable Laravel runtime/upload storage. · `src/core/.env.example`

### Laravel Application

- [Laravel bootstrap](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/bootstrap/app.php): application bootstrap · `src/core/bootstrap/app.php`
- [Audience & IPN routes](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/routes/web.php): route boundary · Public, user, lawyer, admin, and provider callbacks are separated. · `src/core/routes/web.php`
- [Identity & access gates](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Middleware/KycMiddleware.php): auth middleware · Admin, user, and lawyer access is gated by role, status, KYC, and entitlements. · `src/core/app/Http/Middleware/KycMiddleware.php`
- [Application scheduler](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/CronController.php): cron controller · Application-managed periodic execution and schedules. · `src/core/app/Http/Controllers/CronController.php`

### Marketplace Domain

- [Marketplace portals](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/User/ServiceOrderController.php): role controllers · User ordering and lawyer service management expose the shared lifecycle. · `src/core/app/Http/Controllers/User/ServiceOrderController.php`
- [Services, orders & bookings](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Models/ServiceOrder.php): Eloquent domain · Shared marketplace records for offerings and transactions. · `src/core/app/Models/ServiceOrder.php`

### Payments & Payouts

- [Payment orchestration](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Gateway/PaymentController.php): gateway controller · Initiates payments and handles provider callbacks. · `src/core/app/Http/Controllers/Gateway/PaymentController.php`
- [Stripe gateway adapter](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Gateway/Stripe/ProcessController.php): payment adapter · Representative external gateway processing boundary. · `src/core/app/Http/Controllers/Gateway/Stripe/ProcessController.php`
- [Deposits & payouts](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Models/Transaction.php): financial models · Tracks deposits, transactions, withdrawals, and financial state. · `src/core/app/Models/Transaction.php`

### Communication

- [Chat service](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Services/ChatService.php): application service · Keeps chat lifecycle separate from marketplace orders. · `src/core/app/Services/ChatService.php`
- [Realtime message event](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Events/MessageSent.php): broadcast event · `src/core/app/Events/MessageSent.php`
- [Notification delivery](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Notify/NotifyProcess.php): notification service · Renders templates and dispatches email, SMS, and push. · `src/core/app/Notify/NotifyProcess.php`

### Administration & UI

- [Admin operations](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Admin/AdminController.php): admin controllers · Operates records, gateways, KYC, content, reports, and settings. · `src/core/app/Http/Controllers/Admin/AdminController.php`
- [Page builder](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/app/Http/Controllers/Admin/PageBuilderController.php): content controller · `src/core/app/Http/Controllers/Admin/PageBuilderController.php`
- [Blade templates](https://github.com/rks-ad/lawupwebstackfull/blob/main/src/core/resources/views/templates/basic/layouts/frontend.blade.php): server-rendered UI · Basic selectable frontend template and admin layouts. · `src/core/resources/views/templates/basic/layouts/frontend.blade.php`
- [Public assets](https://github.com/rks-ad/lawupwebstackfull/tree/main/src/assets/templates/basic): frontend assets · Template assets and Firebase browser messaging configuration. · `src/assets/templates/basic`

## Connections

- Nginx container → Public entry point: serves
- Public entry point → Laravel bootstrap: boots
- Laravel bootstrap → Audience & IPN routes: registers
- Audience & IPN routes → Identity & access gates: protects portal actions
- Identity & access gates → Marketplace portals: authorizes
- Marketplace portals → Services, orders & bookings: creates and updates
- Audience & IPN routes → Payment orchestration: payment and IPN endpoints
- Payment orchestration → Stripe gateway adapter: delegates processing
- Stripe gateway adapter → Payment orchestration: provider callback
- Payment orchestration → Deposits & payouts: records financial state
- Marketplace portals → Payment orchestration: funds orders and plans
- Marketplace portals → Chat service: supports participant chat
- Chat service → Realtime message event: emits
- Realtime message event → Notification delivery: triggers delivery
- Admin operations → Services, orders & bookings: operates records
- Admin operations → Deposits & payouts: manages withdrawals
- Admin operations → Page builder: manages content
- Page builder → Blade templates: publishes pages
- Blade templates → Public assets: uses
- Application scheduler → Services, orders & bookings: runs periodic work
- Laravel bootstrap → Environment & persistent storage: loads configuration
- Services, orders & bookings → Environment & persistent storage: persists data and uploads
