Home / Developer Documentation / System Architecture

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

  1. Entry Point: index.php receives all requests
  2. Bootstrap: includes/bootstrap.php loads core classes
  3. Router: includes/Router.php determines which controller to use
  4. Controller: Admin/client/auth controllers handle the request
  5. 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 modules table

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