# nhmsv/supporter architecture

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

- Interactive diagram: https://gitdiagram.com/nhmsv/supporter
- Repository: https://github.com/nhmsv/supporter

## Overview

Mobily Supporter is a PHP web app for finding and composing customer-support replies, with language-specific reply boundaries, signatures, favorites, and reply-use history. A user enters the main page or invokes an AJAX action; the app initializes shared services, presents replies, and supports search, insertion, copying, and preference changes. The graph emphasizes those domain stages and the shared initialization layer. Some page and action code is unsampled, so only documented or excerpt-visible relationships are connected.

Main entry points: [`init.php`](https://github.com/nhmsv/supporter/blob/master/init.php) (Application initialization), [`index.php`](https://github.com/nhmsv/supporter/blob/master/index.php) (Reply workspace), [`db`](https://github.com/nhmsv/supporter/tree/master/db) (Application database), [`lib/class_preferences.php`](https://github.com/nhmsv/supporter/blob/master/lib/class_preferences.php) (User preferences)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry and views"]
  node_home["Reply workspace<br/>[index.php]"]
  node_header["Navigation and search<br/>[header.php]"]
  node_footer["Workspace scripts<br/>[footer.php]"]
end

subgraph group_reply["Reply workflows"]
  node_ajax["Reply AJAX actions<br/>[ajax.php]"]
  node_search["Reply search<br/>[replies.php]"]
  node_history["History search"]
  node_start["Start boundary"]
  node_end["End boundary"]
end

subgraph group_shared["Shared application services"]
  node_init["Application initialization<br/>[init.php]"]
  node_functions["Shared reply helpers<br/>[functions.php]"]
  node_replies["Reply operations<br/>[class_replies.php]"]
  node_core["Core settings and stats<br/>[class_core.php]"]
  node_users["User management<br/>[class_user.php]"]
end

subgraph group_state["Persistence and preferences"]
  node_dbclient["Database client<br/>[class_db.php]"]
  node_database[("Application database")]
  node_preferences["User preferences"]
  node_language["Language resources<br/>[class_language.php]"]
  node_registry["Service registry<br/>[class_registry.php]"]
  node_filter["Request filtering<br/>[class_filter.php]"]
end

node_user(("Support agent"))

node_user -->|"opens"| node_home
node_home -->|"requires"| node_init
node_home -->|"renders"| node_header
node_home -->|"renders"| node_footer
node_home -->|"constructs"| node_replies
node_init -->|"loads and connects"| node_dbclient
node_init -->|"registers services"| node_registry
node_init -->|"loads"| node_functions
node_init -->|"loads and creates"| node_filter
node_init -->|"creates"| node_core
node_init -->|"creates"| node_replies
node_init -->|"creates"| node_users
node_init -->|"creates"| node_preferences
node_init -->|"creates"| node_language
node_dbclient -.->|"connects"| node_database
node_search -->|"requires"| node_init
node_search -->|"queries replies"| node_database
node_history -->|"requires"| node_init
node_history -->|"queries history"| node_database
node_ajax -->|"requires"| node_init
node_ajax -->|"updates counter"| node_replies
node_ajax -->|"changes language"| node_preferences
node_start -->|"requires"| node_init
node_start -->|"updates boundary"| node_preferences
node_end -->|"requires"| node_init
node_end -->|"updates boundary"| node_preferences
node_home -->|"reads favorites"| node_database
node_footer -->|"reads autocomplete terms"| node_database

click node_home "https://github.com/nhmsv/supporter/blob/master/index.php"
click node_header "https://github.com/nhmsv/supporter/blob/master/views/header.php"
click node_footer "https://github.com/nhmsv/supporter/blob/master/views/footer.php"
click node_ajax "https://github.com/nhmsv/supporter/blob/master/views/actions/ajax.php"
click node_search "https://github.com/nhmsv/supporter/blob/master/views/actions/replies.php"
click node_history "https://github.com/nhmsv/supporter/blob/master/views/actions/replies-history.php"
click node_start "https://github.com/nhmsv/supporter/blob/master/views/actions/ajax-replies-start.php"
click node_end "https://github.com/nhmsv/supporter/blob/master/views/actions/ajax-replies-end.php"
click node_init "https://github.com/nhmsv/supporter/blob/master/init.php"
click node_functions "https://github.com/nhmsv/supporter/blob/master/lib/functions.php"
click node_replies "https://github.com/nhmsv/supporter/blob/master/lib/class_replies.php"
click node_core "https://github.com/nhmsv/supporter/blob/master/lib/class_core.php"
click node_users "https://github.com/nhmsv/supporter/blob/master/lib/class_user.php"
click node_dbclient "https://github.com/nhmsv/supporter/blob/master/lib/class_db.php"
click node_database "https://github.com/nhmsv/supporter/tree/master/db"
click node_preferences "https://github.com/nhmsv/supporter/blob/master/lib/class_preferences.php"
click node_language "https://github.com/nhmsv/supporter/blob/master/lib/class_language.php"
click node_registry "https://github.com/nhmsv/supporter/blob/master/lib/class_registry.php"
click node_filter "https://github.com/nhmsv/supporter/blob/master/lib/class_filter.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_home,node_header,node_footer toneBlue
class node_ajax,node_search,node_history,node_start,node_end toneAmber
class node_init,node_functions,node_replies,node_core,node_users toneMint
class node_dbclient,node_database,node_preferences,node_language,node_registry,node_filter toneRose
class node_user toneIndigo
```

## Components

### Web entry and views

- [Reply workspace](https://github.com/nhmsv/supporter/blob/master/index.php): `index.php`
- [Navigation and search](https://github.com/nhmsv/supporter/blob/master/views/header.php): `views/header.php`
- [Workspace scripts](https://github.com/nhmsv/supporter/blob/master/views/footer.php): `views/footer.php`

### Reply workflows

- [Reply AJAX actions](https://github.com/nhmsv/supporter/blob/master/views/actions/ajax.php): `views/actions/ajax.php`
- [Reply search](https://github.com/nhmsv/supporter/blob/master/views/actions/replies.php): `views/actions/replies.php`
- [History search](https://github.com/nhmsv/supporter/blob/master/views/actions/replies-history.php): `views/actions/replies-history.php`
- [Start boundary](https://github.com/nhmsv/supporter/blob/master/views/actions/ajax-replies-start.php): `views/actions/ajax-replies-start.php`
- [End boundary](https://github.com/nhmsv/supporter/blob/master/views/actions/ajax-replies-end.php): `views/actions/ajax-replies-end.php`

### Shared application services

- [Application initialization](https://github.com/nhmsv/supporter/blob/master/init.php): `init.php`
- [Shared reply helpers](https://github.com/nhmsv/supporter/blob/master/lib/functions.php): `lib/functions.php`
- [Reply operations](https://github.com/nhmsv/supporter/blob/master/lib/class_replies.php): `lib/class_replies.php`
- [Core settings and stats](https://github.com/nhmsv/supporter/blob/master/lib/class_core.php): `lib/class_core.php`
- [User management](https://github.com/nhmsv/supporter/blob/master/lib/class_user.php): `lib/class_user.php`

### Persistence and preferences

- [Database client](https://github.com/nhmsv/supporter/blob/master/lib/class_db.php): `lib/class_db.php`
- [Application database](https://github.com/nhmsv/supporter/tree/master/db): `db`
- [User preferences](https://github.com/nhmsv/supporter/blob/master/lib/class_preferences.php): `lib/class_preferences.php`
- [Language resources](https://github.com/nhmsv/supporter/blob/master/lib/class_language.php): `lib/class_language.php`
- [Service registry](https://github.com/nhmsv/supporter/blob/master/lib/class_registry.php): `lib/class_registry.php`
- [Request filtering](https://github.com/nhmsv/supporter/blob/master/lib/class_filter.php): `lib/class_filter.php`

### Other components

- **Support agent**

## Connections

- Support agent → Reply workspace: opens (evidence: `index.php`)
- Reply workspace → Application initialization: requires (evidence: `index.php`)
- Reply workspace → Navigation and search: renders (evidence: `index.php`)
- Reply workspace → Workspace scripts: renders (evidence: `index.php`)
- Reply workspace → Reply operations: constructs (evidence: `index.php`)
- Application initialization → Database client: loads and connects (evidence: `init.php`)
- Application initialization → Service registry: registers services (evidence: `init.php`)
- Application initialization → Shared reply helpers: loads (evidence: `init.php`)
- Application initialization → Request filtering: loads and creates (evidence: `init.php`)
- Application initialization → Core settings and stats: creates (evidence: `init.php`)
- Application initialization → Reply operations: creates (evidence: `init.php`)
- Application initialization → User management: creates (evidence: `init.php`)
- Application initialization → User preferences: creates (evidence: `init.php`)
- Application initialization → Language resources: creates (evidence: `init.php`)
- Database client → Application database: connects
- Reply search → Application initialization: requires (evidence: `views/actions/replies.php`)
- Reply search → Application database: queries replies (evidence: `views/actions/replies.php`)
- History search → Application initialization: requires (evidence: `views/actions/replies-history.php`)
- History search → Application database: queries history (evidence: `views/actions/replies-history.php`)
- Reply AJAX actions → Application initialization: requires (evidence: `views/actions/ajax.php`)
- Reply AJAX actions → Reply operations: updates counter (evidence: `views/actions/ajax.php`)
- Reply AJAX actions → User preferences: changes language (evidence: `views/actions/ajax.php`)
- Start boundary → Application initialization: requires (evidence: `views/actions/ajax-replies-start.php`)
- Start boundary → User preferences: updates boundary (evidence: `views/actions/ajax-replies-start.php`)
- End boundary → Application initialization: requires (evidence: `views/actions/ajax-replies-end.php`)
- End boundary → User preferences: updates boundary (evidence: `views/actions/ajax-replies-end.php`)
- Reply workspace → Application database: reads favorites (evidence: `index.php`)
- Workspace scripts → Application database: reads autocomplete terms (evidence: `views/footer.php`)
