# Application Architecture

The application is implemented as a dependency-free PHP 7.4+ and MySQL 8+ web application. It follows a front-controller structure that works with Apache shared hosting through `.htaccess`, while the included `router.php` supports PHP's local development server. No Node.js process, queue worker, or persistent background service is required after deployment.

| Layer | Responsibility | Key paths |
|---|---|---|
| Public front controller | Routes requests, initializes the session, and applies authentication guards | `public/index.php`, `public/.htaccess` |
| Configuration | Reads environment values or a local configuration file without committing credentials | `config/config.example.php`, `config/config.php` |
| Core services | PDO database connection, CSRF protection, validation, view helpers, audit-friendly timestamps | `app/Core/` |
| Domain services | Workflow progress, journal scheduling, knowledge-score aggregation, report-card calculation | `app/Services/` |
| Repositories | Parameterized MySQL read/write operations | `app/Repositories/` |
| Views | Responsive dashboard, data grids, forms, and printable report recap | `app/Views/` |
| Database | InnoDB schema with foreign keys and indexes | `database/schema.sql` |
| Verification | PHP CLI smoke tests for business rules and source linting | `tests/` |

The application uses PHP Data Objects (PDO) with MySQL native prepared statements. Passwords use `password_hash()` and `password_verify()`. Every write form submits a CSRF token, and HTML values are escaped in the view layer. Access is session-based with `admin` and `teacher` roles. This design supports conventional PHP/MySQL hosting without requiring a framework installation or Composer access.

The MySQL schema is normalized around users, classes, students, subjects, academic periods, schedules, score sets, score entries, journals, daily assessments, and report records. Module pages read their field definitions from PHP configuration arrays; this implements dynamic forms and tables while providing predictable validation and database columns.
