# erp-system-paa/erp architecture

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

- Interactive diagram: https://gitdiagram.com/erp-system-paa/erp
- Repository: https://github.com/erp-system-paa/erp

## Overview

This is a PHP-based PAA ERP portal. The visible user journey is account registration or login, then role-based access to the portal and its attendance tools: staff can scan QR codes, while admins can view attendance and manage employee accounts. The source also includes account recovery and separate admin authentication. The README is empty, and the homepage’s broader ERP claims are not backed by sampled feature implementations, so those capabilities are not mapped. Some attendance interactions are not shown; omitted links reflect that evidence limit.

Main entry points: [`include/config.php`](https://github.com/erp-system-paa/erp/blob/main/include/config.php) (Session and access helpers), [`auth/login.php`](https://github.com/erp-system-paa/erp/blob/main/auth/login.php) (User login), [`auth/register.php`](https://github.com/erp-system-paa/erp/blob/main/auth/register.php) (User registration), [`auth/admin_login.php`](https://github.com/erp-system-paa/erp/blob/main/auth/admin_login.php) (Admin login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_login["User login<br/>[login.php]"]
  node_register["User registration<br/>[register.php]"]
  node_recovery["Password recovery<br/>[forget_pass.php]"]
  node_admin_login["Admin login<br/>[admin_login.php]"]
  node_admin_register["Admin registration<br/>[admin_register.php]"]
  node_admin_recovery["Admin recovery"]
  node_user_logout["User logout<br/>[log_out.php]"]
  node_admin_logout["Admin logout<br/>[admin_logout.php]"]
end

subgraph group_attendance["Attendance"]
  node_scanner["QR attendance scanner<br/>[attendance.php]"]
  node_scan_handler["Scan processing<br/>[process_scan.php]"]
  node_employee_lookup["Employee lookup<br/>[get_employee.php]"]
  node_qr_badge["QR badge generator<br/>[generate_qr.php]"]
  node_attendance_list["Attendance list<br/>[list.php]"]
  node_today_attendance["Today’s attendance<br/>[today.php]"]
end

subgraph group_admin["Administration"]
  node_dashboard["Admin dashboard"]
  node_navigation["Role-aware navigation<br/>[admin_nav.php]"]
  node_user_management["User management"]
end

subgraph group_core["Shared Services"]
  node_portal["ERP portal<br/>[index.php]"]
  node_shared_config["Session and access helpers<br/>[config.php]"]
  node_database[("ERP MySQL database")]
end

node_visitor(("Portal user"))

node_visitor -->|"signs in"| node_login
node_visitor -->|"creates account"| node_register
node_visitor -.->|"requests reset"| node_recovery
node_visitor -.->|"admin signs in"| node_admin_login
node_visitor -.->|"creates admin"| node_admin_register
node_visitor -.->|"requests reset"| node_admin_recovery
node_login -->|"uses auth helpers"| node_shared_config
node_register -->|"uses auth helpers"| node_shared_config
node_recovery -->|"uses configuration"| node_shared_config
node_admin_login -->|"uses auth helpers"| node_shared_config
node_admin_register -->|"uses auth helpers"| node_shared_config
node_admin_recovery -->|"uses configuration"| node_shared_config
node_register -->|"creates account"| node_database
node_admin_register -->|"creates account"| node_database
node_login -.->|"checks credentials"| node_database
node_admin_login -.->|"checks credentials"| node_database
node_shared_config -->|"opens connection"| node_database
node_login -.->|"redirects after sign-in"| node_portal
node_register -->|"redirects after registration"| node_login
node_portal -->|"checks session"| node_shared_config
node_portal -->|"redirects when unauthenticated"| node_login
node_dashboard -->|"checks role"| node_shared_config
node_dashboard -->|"redirects unauthorized"| node_admin_login
node_dashboard -->|"renders"| node_navigation
node_user_management -->|"uses session and database"| node_shared_config
node_user_management -->|"loads navigation"| node_navigation
node_user_management -->|"reads and writes users"| node_database
node_scanner -->|"loads configuration"| node_shared_config
node_attendance_list -->|"requires login"| node_shared_config
node_attendance_list -.->|"queries records"| node_database
node_today_attendance -->|"checks session"| node_shared_config
node_today_attendance -.->|"reads attendance"| node_database
node_qr_badge -->|"loads configuration"| node_shared_config
node_qr_badge -.->|"loads employee data"| node_database
node_visitor -.->|"ends session"| node_user_logout
node_visitor -.->|"ends session"| node_admin_logout

click node_login "https://github.com/erp-system-paa/erp/blob/main/auth/login.php"
click node_register "https://github.com/erp-system-paa/erp/blob/main/auth/register.php"
click node_recovery "https://github.com/erp-system-paa/erp/blob/main/auth/forget_pass.php"
click node_admin_login "https://github.com/erp-system-paa/erp/blob/main/auth/admin_login.php"
click node_admin_register "https://github.com/erp-system-paa/erp/blob/main/auth/admin_register.php"
click node_admin_recovery "https://github.com/erp-system-paa/erp/blob/main/auth/admin_forget_pass.php"
click node_user_logout "https://github.com/erp-system-paa/erp/blob/main/auth/log_out.php"
click node_admin_logout "https://github.com/erp-system-paa/erp/blob/main/auth/admin_logout.php"
click node_portal "https://github.com/erp-system-paa/erp/blob/main/index.php"
click node_dashboard "https://github.com/erp-system-paa/erp/blob/main/admin/admin_dashboard.php"
click node_navigation "https://github.com/erp-system-paa/erp/blob/main/component/admin_nav.php"
click node_user_management "https://github.com/erp-system-paa/erp/blob/main/finance/user_management.php"
click node_scanner "https://github.com/erp-system-paa/erp/blob/main/attendance/attendance.php"
click node_scan_handler "https://github.com/erp-system-paa/erp/blob/main/attendance/process_scan.php"
click node_employee_lookup "https://github.com/erp-system-paa/erp/blob/main/attendance/get_employee.php"
click node_qr_badge "https://github.com/erp-system-paa/erp/blob/main/attendance/generate_qr.php"
click node_attendance_list "https://github.com/erp-system-paa/erp/blob/main/attendance/list.php"
click node_today_attendance "https://github.com/erp-system-paa/erp/blob/main/attendance/today.php"
click node_shared_config "https://github.com/erp-system-paa/erp/blob/main/include/config.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_login,node_register,node_recovery,node_admin_login,node_admin_register,node_admin_recovery,node_user_logout,node_admin_logout,node_visitor toneBlue
class node_scanner,node_scan_handler,node_employee_lookup,node_qr_badge,node_attendance_list,node_today_attendance toneAmber
class node_dashboard,node_navigation,node_user_management toneMint
class node_portal,node_shared_config,node_database toneRose
```

## Components

### Authentication

- [User login](https://github.com/erp-system-paa/erp/blob/main/auth/login.php): `auth/login.php`
- [User registration](https://github.com/erp-system-paa/erp/blob/main/auth/register.php): `auth/register.php`
- [Password recovery](https://github.com/erp-system-paa/erp/blob/main/auth/forget_pass.php): `auth/forget_pass.php`
- [Admin login](https://github.com/erp-system-paa/erp/blob/main/auth/admin_login.php): `auth/admin_login.php`
- [Admin registration](https://github.com/erp-system-paa/erp/blob/main/auth/admin_register.php): `auth/admin_register.php`
- [Admin recovery](https://github.com/erp-system-paa/erp/blob/main/auth/admin_forget_pass.php): `auth/admin_forget_pass.php`
- [User logout](https://github.com/erp-system-paa/erp/blob/main/auth/log_out.php): `auth/log_out.php`
- [Admin logout](https://github.com/erp-system-paa/erp/blob/main/auth/admin_logout.php): `auth/admin_logout.php`

### Attendance

- [QR attendance scanner](https://github.com/erp-system-paa/erp/blob/main/attendance/attendance.php): `attendance/attendance.php`
- [Scan processing](https://github.com/erp-system-paa/erp/blob/main/attendance/process_scan.php): `attendance/process_scan.php`
- [Employee lookup](https://github.com/erp-system-paa/erp/blob/main/attendance/get_employee.php): `attendance/get_employee.php`
- [QR badge generator](https://github.com/erp-system-paa/erp/blob/main/attendance/generate_qr.php): `attendance/generate_qr.php`
- [Attendance list](https://github.com/erp-system-paa/erp/blob/main/attendance/list.php): `attendance/list.php`
- [Today’s attendance](https://github.com/erp-system-paa/erp/blob/main/attendance/today.php): `attendance/today.php`

### Administration

- [Admin dashboard](https://github.com/erp-system-paa/erp/blob/main/admin/admin_dashboard.php): `admin/admin_dashboard.php`
- [Role-aware navigation](https://github.com/erp-system-paa/erp/blob/main/component/admin_nav.php): `component/admin_nav.php`
- [User management](https://github.com/erp-system-paa/erp/blob/main/finance/user_management.php): `finance/user_management.php`

### Shared Services

- [ERP portal](https://github.com/erp-system-paa/erp/blob/main/index.php): `index.php`
- [Session and access helpers](https://github.com/erp-system-paa/erp/blob/main/include/config.php): `include/config.php`
- **ERP MySQL database**

### Other components

- **Portal user**

## Connections

- Portal user → User login: signs in
- Portal user → User registration: creates account (evidence: `auth/register.php`)
- Portal user → Password recovery: requests reset
- Portal user → Admin login: admin signs in
- Portal user → Admin registration: creates admin
- Portal user → Admin recovery: requests reset
- User login → Session and access helpers: uses auth helpers (evidence: `auth/login.php`)
- User registration → Session and access helpers: uses auth helpers (evidence: `auth/register.php`)
- Password recovery → Session and access helpers: uses configuration (evidence: `auth/forget_pass.php`)
- Admin login → Session and access helpers: uses auth helpers (evidence: `auth/admin_login.php`)
- Admin registration → Session and access helpers: uses auth helpers (evidence: `auth/admin_register.php`)
- Admin recovery → Session and access helpers: uses configuration (evidence: `auth/admin_forget_pass.php`)
- User registration → ERP MySQL database: creates account (evidence: `auth/register.php`)
- Admin registration → ERP MySQL database: creates account (evidence: `auth/admin_register.php`)
- User login → ERP MySQL database: checks credentials
- Admin login → ERP MySQL database: checks credentials
- Session and access helpers → ERP MySQL database: opens connection (evidence: `include/config.php`)
- User login → ERP portal: redirects after sign-in
- User registration → User login: redirects after registration (evidence: `auth/register.php`)
- ERP portal → Session and access helpers: checks session (evidence: `index.php`)
- ERP portal → User login: redirects when unauthenticated (evidence: `index.php`)
- Admin dashboard → Session and access helpers: checks role (evidence: `admin/admin_dashboard.php`)
- Admin dashboard → Admin login: redirects unauthorized (evidence: `admin/admin_dashboard.php`)
- Admin dashboard → Role-aware navigation: renders (evidence: `admin/admin_dashboard.php`)
- User management → Session and access helpers: uses session and database (evidence: `finance/user_management.php`)
- User management → Role-aware navigation: loads navigation (evidence: `finance/user_management.php`)
- User management → ERP MySQL database: reads and writes users (evidence: `finance/user_management.php`)
- QR attendance scanner → Session and access helpers: loads configuration (evidence: `attendance/attendance.php`)
- Attendance list → Session and access helpers: requires login (evidence: `attendance/list.php`)
- Attendance list → ERP MySQL database: queries records
- Today’s attendance → Session and access helpers: checks session (evidence: `attendance/today.php`)
- Today’s attendance → ERP MySQL database: reads attendance
- QR badge generator → Session and access helpers: loads configuration (evidence: `attendance/generate_qr.php`)
- QR badge generator → ERP MySQL database: loads employee data
- Portal user → User logout: ends session
- Portal user → Admin logout: ends session
