# inkithai/erp-system architecture

> Architecture diagram of the GitHub repository inkithai/erp-system, 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/inkithai/erp-system
- Repository: https://github.com/inkithai/erp-system

## Overview

#### Purpose and Runtime
A small PHP/MySQL ERP application for managing customers and items, plus operational reports. It is intended to run on Apache and MySQL via XAMPP; the database schema/data is imported from `MySQL Database/ERP.sql`.

#### HTTP Entry and Navigation
`index.php` is the likely application landing page and main request entry. Page-oriented PHP scripts implement the UI and operations directly, with shared navigation likely provided by `sidebar.php`. Styling is supplied by `style/index.css`; static visual assets reside in `img`.

#### Database Boundary
`Connection.php` centralizes PHP-to-MySQL connectivity and is the primary persistence boundary used by application pages. `MySQL Database/ERP.sql` defines the required ERP database, so schema changes and local environment initialization flow through that SQL artifact rather than application migrations.

#### Customer Management Module
Customer-facing CRUD/read flows are split across dedicated server-rendered pages:
- `viewCustomer.php` displays/searches customer records.
- `editCustomer.php` handles customer creation or updates.
- `Connection.php` supplies database access.

Requests are expected to submit form data to PHP pages, which validate/process it inline and execute MySQL operations before rendering a response or returning to a list view.

#### Item Management Module
Item lifecycle management follows the same page-per-operation model:
- `viewItem.php` presents item records.
- `editItem.php` updates item data.
- `registerItem.php` adds inventory/item records.

These pages form the main item-data write/read boundary and depend on the shared database connection in `Connection.php`.

#### Reporting Pipeline
Reporting is separated from transactional maintenance:
- `reports.php` serves as the reports area or report-selection page.
- `itemReport.php` generates item-oriented output.
- `invoiceItemReport.php` generates invoice/item-oriented output.

Report pages query MySQL data through `Connection.php` and render results as HTML, making the database schema and its customer/item/invoice relationships the key reporting dependency.

#### Architectural Characteristics
The repository is a traditional multi-page, server-rendered PHP application rather than an API/service architecture. Control flow is browser request → individual PHP page → MySQL query/update → HTML response. Apache/PHP and MySQL are material runtime dependencies; Bootstrap, CSS, and JavaScript support the presentation layer, with repository-local CSS at `style/index.css`.

Main entry points: [`Connection.php`](https://github.com/inkithai/erp-system/blob/main/Connection.php) (MySQL connection), [`index.php`](https://github.com/inkithai/erp-system/blob/main/index.php) (Application entry), [`sidebar.php`](https://github.com/inkithai/erp-system/blob/main/sidebar.php) (Shared navigation), [`viewItem.php`](https://github.com/inkithai/erp-system/blob/main/viewItem.php) (Item list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_browser(("Browser<br/>client"))
  node_apache_php{{"Apache / PHP<br/>web runtime"}}
end

subgraph group_ui["Server-rendered UI"]
  node_index["Application entry<br/>PHP page<br/>[index.php]"]
  node_sidebar["Shared navigation<br/>PHP include<br/>[sidebar.php]"]
  node_customer_list["Customer list &amp; search<br/>PHP page<br/>[viewCustomer.php]"]
  node_customer_edit["Customer create / edit<br/>PHP page<br/>[editCustomer.php]"]
  node_item_list["Item list<br/>PHP page<br/>[viewItem.php]"]
  node_item_edit["Item edit<br/>PHP page<br/>[editItem.php]"]
  node_item_register["Item registration<br/>PHP page<br/>[registerItem.php]"]
  node_styles["Application styles<br/>CSS<br/>[index.css]"]
  node_images["Visual assets<br/>static assets"]
end

subgraph group_reports["Reporting"]
  node_reports_home["Reports area<br/>PHP page<br/>[reports.php]"]
  node_item_report["Item report<br/>PHP report<br/>[itemReport.php]"]
  node_invoice_item_report["Invoice item report<br/>PHP report"]
end

subgraph group_data["Data"]
  node_connection["MySQL connection<br/>PHP persistence boundary<br/>[Connection.php]"]
  node_mysql[("ERP MySQL database")]
  node_schema["ERP schema &amp; seed data<br/>SQL import<br/>[ERP.sql]"]
end

node_browser -->|"HTTP requests"| node_apache_php
node_apache_php -->|"serves"| node_index
node_index -->|"navigation"| node_sidebar
node_sidebar -->|"customer navigation"| node_customer_list
node_sidebar -->|"item navigation"| node_item_list
node_sidebar -->|"report navigation"| node_reports_home
node_customer_list -->|"create / edit"| node_customer_edit
node_item_list -->|"edit"| node_item_edit
node_item_list -->|"register"| node_item_register
node_reports_home -->|"selects"| node_item_report
node_reports_home -->|"selects"| node_invoice_item_report
node_customer_list -->|"reads"| node_connection
node_customer_edit -->|"reads / writes"| node_connection
node_item_list -->|"reads"| node_connection
node_item_edit -->|"reads / writes"| node_connection
node_item_register -->|"writes"| node_connection
node_item_report -->|"queries"| node_connection
node_invoice_item_report -->|"queries"| node_connection
node_connection -->|"MySQL operations"| node_mysql
node_schema -->|"imports schema and data"| node_mysql
node_index -->|"loads"| node_styles
node_index -->|"uses"| node_images

click node_index "https://github.com/inkithai/erp-system/blob/main/index.php"
click node_sidebar "https://github.com/inkithai/erp-system/blob/main/sidebar.php"
click node_customer_list "https://github.com/inkithai/erp-system/blob/main/viewCustomer.php"
click node_customer_edit "https://github.com/inkithai/erp-system/blob/main/editCustomer.php"
click node_item_list "https://github.com/inkithai/erp-system/blob/main/viewItem.php"
click node_item_edit "https://github.com/inkithai/erp-system/blob/main/editItem.php"
click node_item_register "https://github.com/inkithai/erp-system/blob/main/registerItem.php"
click node_reports_home "https://github.com/inkithai/erp-system/blob/main/reports.php"
click node_item_report "https://github.com/inkithai/erp-system/blob/main/itemReport.php"
click node_invoice_item_report "https://github.com/inkithai/erp-system/blob/main/invoiceItemReport.php"
click node_connection "https://github.com/inkithai/erp-system/blob/main/Connection.php"
click node_schema "https://github.com/inkithai/erp-system/blob/main/MySQL%20Database/ERP.sql"
click node_styles "https://github.com/inkithai/erp-system/blob/main/style/index.css"
click node_images "https://github.com/inkithai/erp-system/tree/main/img"

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_browser,node_apache_php toneBlue
class node_index,node_sidebar,node_customer_list,node_customer_edit,node_item_list,node_item_edit,node_item_register,node_styles,node_images toneAmber
class node_reports_home,node_item_report,node_invoice_item_report toneMint
class node_connection,node_mysql,node_schema toneRose
```

## Components

### Runtime

- **Browser**: client
- **Apache / PHP**: web runtime · Hosts the multi-page PHP application.

### Server-rendered UI

- [Application entry](https://github.com/inkithai/erp-system/blob/main/index.php): PHP page · `index.php`
- [Shared navigation](https://github.com/inkithai/erp-system/blob/main/sidebar.php): PHP include · `sidebar.php`
- [Customer list & search](https://github.com/inkithai/erp-system/blob/main/viewCustomer.php): PHP page · `viewCustomer.php`
- [Customer create / edit](https://github.com/inkithai/erp-system/blob/main/editCustomer.php): PHP page · Processes customer form writes inline. · `editCustomer.php`
- [Item list](https://github.com/inkithai/erp-system/blob/main/viewItem.php): PHP page · `viewItem.php`
- [Item edit](https://github.com/inkithai/erp-system/blob/main/editItem.php): PHP page · `editItem.php`
- [Item registration](https://github.com/inkithai/erp-system/blob/main/registerItem.php): PHP page · `registerItem.php`
- [Application styles](https://github.com/inkithai/erp-system/blob/main/style/index.css): CSS · `style/index.css`
- [Visual assets](https://github.com/inkithai/erp-system/tree/main/img): static assets · `img`

### Reporting

- [Reports area](https://github.com/inkithai/erp-system/blob/main/reports.php): PHP page · `reports.php`
- [Item report](https://github.com/inkithai/erp-system/blob/main/itemReport.php): PHP report · `itemReport.php`
- [Invoice item report](https://github.com/inkithai/erp-system/blob/main/invoiceItemReport.php): PHP report · `invoiceItemReport.php`

### Data

- [MySQL connection](https://github.com/inkithai/erp-system/blob/main/Connection.php): PHP persistence boundary · Centralizes database access for application pages. · `Connection.php`
- **ERP MySQL database**: database · Stores customer, item, and invoice relationships.
- [ERP schema & seed data](https://github.com/inkithai/erp-system/blob/main/MySQL%20Database/ERP.sql): SQL import · Initializes the required local database. · `MySQL Database/ERP.sql`

## Connections

- Browser → Apache / PHP: HTTP requests
- Apache / PHP → Application entry: serves
- Application entry → Shared navigation: navigation
- Shared navigation → Customer list & search: customer navigation
- Shared navigation → Item list: item navigation
- Shared navigation → Reports area: report navigation
- Customer list & search → Customer create / edit: create / edit
- Item list → Item edit: edit
- Item list → Item registration: register
- Reports area → Item report: selects
- Reports area → Invoice item report: selects
- Customer list & search → MySQL connection: reads
- Customer create / edit → MySQL connection: reads / writes
- Item list → MySQL connection: reads
- Item edit → MySQL connection: reads / writes
- Item registration → MySQL connection: writes
- Item report → MySQL connection: queries
- Invoice item report → MySQL connection: queries
- MySQL connection → ERP MySQL database: MySQL operations
- ERP schema & seed data → ERP MySQL database: imports schema and data
- Application entry → Application styles: loads
- Application entry → Visual assets: uses
