# vladimirzobachov/mycrm architecture

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

- Interactive diagram: https://gitdiagram.com/vladimirzobachov/mycrm
- Repository: https://github.com/vladimirzobachov/mycrm

## Overview

#### Purpose and Entry Points
This is a server-rendered PHP application centered on user accounts and order workflows, inferred from order, user, login, registration, and notification templates. The HTTP entry point is `index.php`; Apache routing/access behavior may be controlled by `.htaccess`. The supplied README is empty.

#### Request and Presentation Layer
`index.php` likely coordinates request dispatch, authentication/session behavior, form handling, database access, and template rendering. HTML views are file-based rather than a frontend application:
- `templates/index.html`
- `templates/mai_create_order_owner.html`
- `templates/users.html`

Static browser assets are served from:
- `media/base.js`
- `media/style.css`
- `media/jquery-ui.js`

#### Order and User Workflow Domain
The principal domain boundary is an order-management process with distinct owner, administrator, and mounter-oriented communications. Templates indicate create, edit, status-change, and comment-change events, with separate recipient variants:
- `templates/mai_create_order_owner.html`
- `templates/mail_change_status_for_admin.html`
- `templates/mail_bind_mounter.html`

User lifecycle screens are represented by `templates/login.html`, `templates/register.html`, and `templates/user.html`.

#### Form Input and Configuration
Form definitions or field mappings are centralized separately from rendering, suggesting a configurable request-validation/data-binding boundary:
- `includes/form.class.php`
- `configs/form_data.php`

This layer should translate HTTP form data into domain/database operations and select resulting templates or notification actions.

#### Persistence Boundary
Database access is abstracted behind a concrete class and interface, with connection settings isolated from consumers:
- `includes/db_interface.class.php`
- `includes/db.class.php`
- `includes/dbconfig.php`

No database engine or schema is present in the tree. Treat the interface as the primary seam for persistence changes and avoid coupling request/template code directly to connection details.

#### Notification Delivery
Email notifications are a first-class side effect of order changes. Application mail orchestration and templates are separated from the vendored PHPMailer transport implementation:
- `includes/phpmailer/mailer.php`
- `includes/phpmailer/PHPMailer.php`
- `templates/mail_create_order_for_admin.html`

The external-service boundary is SMTP/email delivery; host credentials and transport choices are not visible in the supplied files.

#### Spreadsheet Export Capability and Runtime
The repository vendors PHPExcel, providing workbook creation, calculation, import/export, and format writers. It is likely available for reporting or data export, although no application-level caller is visible:
- `includes/PHPExcel/Classes/PHPExcel.php`
- `includes/PHPExcel/Classes/PHPExcel/IOFactory.php`
- `includes/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php`

The runtime is PHP deployed behind Apache. PHPExcel may rely on PHP extensions or optional cache backends, but their deployment configuration is not represented here.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP &amp; UI"]
  node_apache{{"Apache routing<br/>web server<br/>[.htaccess]"}}
  node_entry["Application entry<br/>PHP controller<br/>[index.php]"]
  node_forms["Form binding<br/>form layer<br/>[form.class.php]"]
  node_form_config["Form definitions<br/>field mappings<br/>[form_data.php]"]
  node_page_templates["Page templates<br/>HTML views<br/>[index.html]"]
  node_user_templates["User lifecycle views<br/>HTML views<br/>[login.html]"]
  node_browser_assets["Browser assets<br/>static assets<br/>[base.js]"]
end

subgraph group_domain["Workflows"]
  node_order_workflow["Order workflow<br/>domain process"]
  node_user_accounts["User accounts<br/>domain process<br/>[user.html]"]
end

subgraph group_persistence["Persistence"]
  node_db_interface["Database interface<br/>persistence seam"]
  node_db_adapter[("Database adapter<br/>database access<br/>[db.class.php]")]
  node_db_config["Connection settings<br/>database config<br/>[dbconfig.php]"]
end

subgraph group_notifications["Notifications"]
  node_mail_orchestrator["Mail orchestration<br/>notification service<br/>[mailer.php]"]
  node_mail_templates["Order mail templates<br/>email views"]
  node_phpmailer["PHPMailer transport<br/>vendored mail library<br/>[PHPMailer.php]"]
  node_smtp{{"SMTP/email delivery<br/>external service"}}
end

subgraph group_export["Export runtime"]
  node_phpexcel["PHPExcel<br/>spreadsheet library<br/>[PHPExcel.php]"]
  node_excel_io["Excel IO factory<br/>spreadsheet IO<br/>[IOFactory.php]"]
  node_excel_writer["Excel 2007 writer<br/>format writer<br/>[Excel2007.php]"]
end

node_apache -->|"routes requests"| node_entry
node_entry -->|"binds forms"| node_forms
node_forms -->|"uses mappings"| node_form_config
node_entry -->|"renders pages"| node_page_templates
node_entry -->|"renders account views"| node_user_templates
node_page_templates -->|"loads assets"| node_browser_assets
node_forms -->|"submits order actions"| node_order_workflow
node_forms -->|"submits account actions"| node_user_accounts
node_order_workflow -->|"persists orders"| node_db_interface
node_user_accounts -->|"persists users"| node_db_interface
node_db_interface -->|"implemented by"| node_db_adapter
node_db_adapter -->|"reads settings"| node_db_config
node_order_workflow -->|"triggers notifications"| node_mail_orchestrator
node_mail_orchestrator -->|"renders messages"| node_mail_templates
node_mail_orchestrator -->|"sends via"| node_phpmailer
node_phpmailer -->|"delivers email"| node_smtp
node_phpexcel -->|"loads IO support"| node_excel_io
node_excel_io -->|"selects writer"| node_excel_writer

click node_apache "https://github.com/vladimirzobachov/mycrm/blob/master/.htaccess"
click node_entry "https://github.com/vladimirzobachov/mycrm/blob/master/index.php"
click node_forms "https://github.com/vladimirzobachov/mycrm/blob/master/includes/form.class.php"
click node_form_config "https://github.com/vladimirzobachov/mycrm/blob/master/configs/form_data.php"
click node_page_templates "https://github.com/vladimirzobachov/mycrm/blob/master/templates/index.html"
click node_user_templates "https://github.com/vladimirzobachov/mycrm/blob/master/templates/login.html"
click node_browser_assets "https://github.com/vladimirzobachov/mycrm/blob/master/media/base.js"
click node_order_workflow "https://github.com/vladimirzobachov/mycrm/blob/master/templates/mai_create_order_owner.html"
click node_user_accounts "https://github.com/vladimirzobachov/mycrm/blob/master/templates/user.html"
click node_db_interface "https://github.com/vladimirzobachov/mycrm/blob/master/includes/db_interface.class.php"
click node_db_adapter "https://github.com/vladimirzobachov/mycrm/blob/master/includes/db.class.php"
click node_db_config "https://github.com/vladimirzobachov/mycrm/blob/master/includes/dbconfig.php"
click node_mail_orchestrator "https://github.com/vladimirzobachov/mycrm/blob/master/includes/phpmailer/mailer.php"
click node_mail_templates "https://github.com/vladimirzobachov/mycrm/blob/master/templates/mail_create_order_for_admin.html"
click node_phpmailer "https://github.com/vladimirzobachov/mycrm/blob/master/includes/phpmailer/PHPMailer.php"
click node_phpexcel "https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel.php"
click node_excel_io "https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel/IOFactory.php"
click node_excel_writer "https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel/Writer/Excel2007.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_apache,node_entry,node_forms,node_form_config,node_page_templates,node_user_templates,node_browser_assets toneBlue
class node_order_workflow,node_user_accounts toneAmber
class node_db_interface,node_db_adapter,node_db_config toneMint
class node_mail_orchestrator,node_mail_templates,node_phpmailer,node_smtp toneRose
class node_phpexcel,node_excel_io,node_excel_writer toneIndigo
```

## Components

### HTTP & UI

- [Apache routing](https://github.com/vladimirzobachov/mycrm/blob/master/.htaccess): web server · Routes requests and controls access behavior. · `.htaccess`
- [Application entry](https://github.com/vladimirzobachov/mycrm/blob/master/index.php): PHP controller · Coordinates dispatch, sessions, forms, persistence, and rendering. · `index.php`
- [Form binding](https://github.com/vladimirzobachov/mycrm/blob/master/includes/form.class.php): form layer · Maps request fields for validation and data binding. · `includes/form.class.php`
- [Form definitions](https://github.com/vladimirzobachov/mycrm/blob/master/configs/form_data.php): field mappings · `configs/form_data.php`
- [Page templates](https://github.com/vladimirzobachov/mycrm/blob/master/templates/index.html): HTML views · Server-rendered index, order, and user pages. · `templates/index.html`
- [User lifecycle views](https://github.com/vladimirzobachov/mycrm/blob/master/templates/login.html): HTML views · Login, registration, and user account screens. · `templates/login.html`
- [Browser assets](https://github.com/vladimirzobachov/mycrm/blob/master/media/base.js): static assets · JavaScript, jQuery UI, and stylesheet resources. · `media/base.js`

### Workflows

- [Order workflow](https://github.com/vladimirzobachov/mycrm/blob/master/templates/mai_create_order_owner.html): domain process · Creates and updates orders, statuses, assignments, and comments. · `templates/mai_create_order_owner.html`
- [User accounts](https://github.com/vladimirzobachov/mycrm/blob/master/templates/user.html): domain process · Authentication and registration lifecycle. · `templates/user.html`

### Persistence

- [Database interface](https://github.com/vladimirzobachov/mycrm/blob/master/includes/db_interface.class.php): persistence seam · Primary abstraction for persistence consumers. · `includes/db_interface.class.php`
- [Database adapter](https://github.com/vladimirzobachov/mycrm/blob/master/includes/db.class.php): database access · `includes/db.class.php`
- [Connection settings](https://github.com/vladimirzobachov/mycrm/blob/master/includes/dbconfig.php): database config · `includes/dbconfig.php`

### Notifications

- [Mail orchestration](https://github.com/vladimirzobachov/mycrm/blob/master/includes/phpmailer/mailer.php): notification service · Builds order-change notifications and invokes mail transport. · `includes/phpmailer/mailer.php`
- [Order mail templates](https://github.com/vladimirzobachov/mycrm/blob/master/templates/mail_create_order_for_admin.html): email views · Recipient-specific order notification content. · `templates/mail_create_order_for_admin.html`
- [PHPMailer transport](https://github.com/vladimirzobachov/mycrm/blob/master/includes/phpmailer/PHPMailer.php): vendored mail library · `includes/phpmailer/PHPMailer.php`
- **SMTP/email delivery**: external service · External email transport boundary.

### Export runtime

- [PHPExcel](https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel.php): spreadsheet library · Workbook creation, import/export, calculation, and format writers. · `includes/PHPExcel/Classes/PHPExcel.php`
- [Excel IO factory](https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel/IOFactory.php): spreadsheet IO · `includes/PHPExcel/Classes/PHPExcel/IOFactory.php`
- [Excel 2007 writer](https://github.com/vladimirzobachov/mycrm/blob/master/includes/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php): format writer · `includes/PHPExcel/Classes/PHPExcel/Writer/Excel2007.php`

## Connections

- Apache routing → Application entry: routes requests
- Application entry → Form binding: binds forms
- Form binding → Form definitions: uses mappings
- Application entry → Page templates: renders pages
- Application entry → User lifecycle views: renders account views
- Page templates → Browser assets: loads assets
- Form binding → Order workflow: submits order actions
- Form binding → User accounts: submits account actions
- Order workflow → Database interface: persists orders
- User accounts → Database interface: persists users
- Database interface → Database adapter: implemented by
- Database adapter → Connection settings: reads settings
- Order workflow → Mail orchestration: triggers notifications
- Mail orchestration → Order mail templates: renders messages
- Mail orchestration → PHPMailer transport: sends via
- PHPMailer transport → SMTP/email delivery: delivers email
- PHPExcel → Excel IO factory: loads IO support
- Excel IO factory → Excel 2007 writer: selects writer
