# davidvegacl/agendastic architecture

> Architecture diagram of the GitHub repository davidvegacl/agendastic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/davidvegacl/agendastic
- Repository: https://github.com/davidvegacl/agendastic

## Overview

##### Main Components
- Frontend Client: Represent the user interface that includes the booking pages, login/logout pages, error pages, and general UI assets. This involves the views (found under application/views) and asset folders (assets/css, assets/js, assets/img).
- Backend Administration: Capture the admin/backoffice interface components—for example, the backend controllers (in application/controllers/Backend and backend API endpoints) and corresponding views under application/views/backend.
- API Layer: Highlight the RESTful API endpoints implemented for clients and administrative interactions. This is visible through the application/controllers/api/v1 directory as well as the engine/Api/V1 section which includes request and response handling, authorization, parsing, and processing.
- Business Logic & Domain Models: Show the MVC-based flow where controllers (in application/controllers) interact with models (in application/models) and utilize helpers, libraries, and engine-specific classes (engine/Notifications, engine/Types) to enforce business rules like client registration, service management, appointments scheduling, and sync with external systems.
- Integration Services: Emphasize external integrations, such as Google Calendar synchronization (using libraries under application/libraries/external/google-api-php-client and classes like Google_sync.php) and email notifications (engine/Notifications/Email.php). Also, note that there is internationalization support (views and language folders in both application and system) and configuration files to establish these integrations.
- Core Framework: Represent the underlying CodeIgniter framework itself (system folder) that handles routing, session management, security, and overall application bootstrapping.

##### Relationships and Interactions
- Out how the client (browser) interacts with the Frontend UI and Backend Admin UI.
- That user actions trigger requests routed via CodeIgniter’s routing mechanism (configured in application/config/routes.php) to specific controllers.
- How controllers then call models to perform business logic and query/update the database.
- That for API calls (e.g., using engine/Api/V1), the processing passes through authorization, parsing, and processor modules before returning a response.

##### Architectural Patterns and Design Principles
- The system follows the MVC (Model-View-Controller) pattern through its application, system, and engine folders.
- It is modular with separate components for API handling (versioned under /api/v1), business logic, and external integrations.
- The use of helper functions, libraries, and configuration files assures a separation of concerns.

##### Relevant Technologies and Frameworks
- Framework: CodeIgniter (evidenced by the system and application folders).
- Web Technologies: HTML, CSS, JavaScript (assets folder holds frontend files).
- External APIs: Google Calendar integration via the google-api-php-client.
- Database: Likely MySQL (or another relational database configured in application/config/database.php).
- Language Support: Internationalization with language files in multiple languages.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    CB("Client Browser"):::client

    subgraph "Presentation Layer: Frontend Client"
        F1("Appointments Views"):::frontend
        F2("User Views"):::frontend
        F3("General Views"):::frontend
        A1("CSS Assets"):::frontend
        A2("JS Assets"):::frontend
        A3("Image Assets"):::frontend
    end

    subgraph "Presentation Layer: Backend Administration"
        B1("Backend Controller: Backend.php"):::backend
        B2("Backend Controller: Backend_api.php"):::backend
        B3("Backend Views"):::backend
    end

    subgraph "API Layer"
        API1("API Endpoints"):::api
        API2("API Engine"):::api
    end

    subgraph "Business Logic & Domain Models"
        BL1("Appointments Controller"):::business
        BL2("Models"):::business
        BL3("Helpers & Libraries"):::business
        BL4("Engine Types"):::business
        BL5("Engine Notifications"):::business
    end

    subgraph "Integration Services"
        IS1("Google Calendar Integration"):::integration
        IS2("Email Notifications"):::integration
    end

    subgraph "Data Persistence"
        DP1("Database Config"):::persistence
        DP2("Migrations"):::persistence
        DP3("DB Libraries"):::persistence
    end

    CF("CodeIgniter Core"):::core

    %% Connections
    CB -->|"access"| F1
    CB -->|"adminAccess"| B3

    F1 -->|"request"| BL1
    B1 -->|"triggers"| BL1
    B2 -->|"triggers"| BL1
    B3 -->|"adminAction"| BL1
    API1 -->|"APIcall"| BL1
    API1 -->|"processes"| API2
    API2 -->|"response"| CB

    BL1 -->|"usesModels"| BL2
    BL1 -->|"usesHelpers"| BL3
    BL3 -->|"includes"| BL4
    BL3 -->|"includes"| BL5

    BL1 -->|"queries"| DP1
    BL1 -->|"queries"| DP2
    BL1 -->|"queries"| DP3

    BL1 -->|"invokes"| IS1
    BL1 -->|"invokes"| IS2

    BL1 -->|"viaFramework"| CF
    DP3 -->|"viaDBLibs"| CF

    %% Styles
    classDef client fill:#FAD7A0,stroke:#333,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#333,stroke-width:2px;
    classDef api fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef business fill:#D2B4DE,stroke:#333,stroke-width:2px;
    classDef integration fill:#F5CBA7,stroke:#333,stroke-width:2px;
    classDef persistence fill:#F1948A,stroke:#333,stroke-width:2px;
    classDef core fill:#D5D8DC,stroke:#333,stroke-width:2px;

    %% Click Events - Frontend Client
    click F1 "https://github.com/davidvegacl/agendastic/tree/master/application/views/appointments"
    click F2 "https://github.com/davidvegacl/agendastic/tree/master/application/views/user"
    click F3 "https://github.com/davidvegacl/agendastic/tree/master/application/views/general"
    click A1 "https://github.com/davidvegacl/agendastic/tree/master/assets/css"
    click A2 "https://github.com/davidvegacl/agendastic/tree/master/assets/js"
    click A3 "https://github.com/davidvegacl/agendastic/tree/master/assets/img"

    %% Click Events - Backend Administration
    click B1 "https://github.com/davidvegacl/agendastic/blob/master/application/controllers/Backend.php"
    click B2 "https://github.com/davidvegacl/agendastic/blob/master/application/controllers/Backend_api.php"
    click B3 "https://github.com/davidvegacl/agendastic/tree/master/application/views/backend"

    %% Click Events - API Layer
    click API1 "https://github.com/davidvegacl/agendastic/tree/master/application/controllers/api/v1"
    click API2 "https://github.com/davidvegacl/agendastic/tree/master/engine/Api/V1"

    %% Click Events - Business Logic & Domain Models
    click BL1 "https://github.com/davidvegacl/agendastic/blob/master/application/controllers/Appointments.php"
    click BL2 "https://github.com/davidvegacl/agendastic/tree/master/application/models"
    click BL3 "https://github.com/davidvegacl/agendastic/tree/master/application/helpers"
    click BL4 "https://github.com/davidvegacl/agendastic/tree/master/engine/Types"
    click BL5 "https://github.com/davidvegacl/agendastic/tree/master/engine/Notifications"

    %% Click Events - Integration Services
    click IS1 "https://github.com/davidvegacl/agendastic/blob/master/application/controllers/Google.php"
    click IS2 "https://github.com/davidvegacl/agendastic/blob/master/engine/Notifications/Email.php"

    %% Click Events - Data Persistence
    click DP1 "https://github.com/davidvegacl/agendastic/blob/master/application/config/database.php"
    click DP2 "https://github.com/davidvegacl/agendastic/tree/master/application/migrations"
    click DP3 "https://github.com/davidvegacl/agendastic/tree/master/system/database"

    %% Click Event - Core Framework
    click CF "https://github.com/davidvegacl/agendastic/tree/master/system"
```
