System Architecture
Understanding the system structure and design patterns
System Architecture
Directory Structure
/
├── admin/ # Admin area controllers
├── auth/ # Authentication controllers
├── client/ # Client area controllers
├── core/ # Core system classes
│ ├── ModuleInterface.php
│ ├── ModuleManager.php
│ ├── PaymentManager.php
│ └── ...
├── includes/ # Bootstrap, router, database, helpers
├── modules/ # Modular plugins
│ ├── gateways/ # Payment gateway modules
│ ├── registrars/ # Domain registrar modules
│ └── servers/ # Server modules
├── views/ # View templates
├── webhooks/ # Webhook handlers
└── index.php # Main entry point
Request Flow
- Entry Point:
index.phpreceives all requests - Bootstrap:
includes/bootstrap.phploads core classes - Router:
includes/Router.phpdetermines which controller to use - Controller: Admin/client/auth controllers handle the request
- View: Templates in
views/render the response
Module System
The system uses an auto-discovery module system:
- Modules are automatically detected in
/modules/directories - Each module must implement
ModuleInterface - Modules are registered in the database when enabled
- Configuration is stored per-module in the
modulestable
Database Layer
- Database Class: Singleton pattern for database connections
- Prepared Statements: All queries use prepared statements for security
- Transaction Support: Database transactions for atomic operations
Authentication System
- Session-Based: PHP sessions for authentication state
- Role-Based Access: Users, clients, and staff have different access levels
- Password Hashing: Bcrypt with
password_hash() - Passkeys: WebAuthn support for passwordless login