# cytopia/devilbox architecture

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

- Interactive diagram: https://gitdiagram.com/cytopia/devilbox
- Repository: https://github.com/cytopia/devilbox

## Overview

##### Main Components Overview

**┌─────────────────────────────────────────────────────────────────┐**
- Devilbox Environment                         │

- ┌─────────┐    ┌──────────┐    ┌─────────┐    ┌────────────┐  │
- Webserver│    │   PHP    │    │ Database│    │  Services  │  │
- (HTTPD)  │◄──►│ (FPM)   │◄──►│ (SQL/   │◄──►│(Cache/Mail/│  │
- NoSQL) │    │  Queue)    │  │
- ┘    └──────────┘    └─────────┘    └────────────┘  │
- ▲            ▲              ▲                ▲          │
- ┼────────────┼──────────────┼────────────────┼─────────┘

- ┌─────┴────────────┴──────────────┴────────────────┴─────┐
- Docker Network                        │
- ┘

##### Detailed Component Breakdown

a) Webserver Layer:
**┌─────────────────────────┐**
- Web Servers        │
- ┤
- Apache 2.2          │
- Apache 2.4          │
- Nginx stable        │
- Nginx mainline      │
- ┘

b) PHP Layer:
**┌─────────────────────────┐**
- PHP Versions       │
- ┤
- PHP 5.2 - 5.6       │
- PHP 7.0 - 7.4       │
- PHP 8.0 - 8.2       │
- ┘

##### Service Integration Layer

How different services connect:
**┌─────────────────────────────────────────────────┐**
- Service Integration               │
- ┤
- ┌─────────┐  ┌─────────┐  ┌─────────────────┐  │
- MySQL   │  │ MongoDB │  │ Cache Services  │  │
- MariaDB │  │ Redis   │  │ - Memcached    │  │
- Percona │  └─────────┘  │ - Redis        │  │
- ┘              └─────────────────┘  │
- ┘

##### Development Tools Integration

Development tooling layer:
**┌─────────────────────────────────────────────┐**
- Development Tools                 │
- ┤
- ┌─────────┐  ┌─────────┐  ┌─────────────┐  │
- Composer│  │ Node.js │  │ Build Tools │  │
- PHP CLI │  │ npm/yarn│  │ - Webpack   │  │
- XDebug  │  └─────────┘  │ - Gulp      │  │
- ┘              └─────────────┘  │
- ┘

##### Project Structure

**┌─────────────────────────────────────────┐**
- Project Structure            │
- ┤
- cfg/ (Configuration)                │
- data/ (Project Files)               │
- log/ (Log Files)                    │
- .devilbox/ (Internal Files)         │
- ┘

##### Networking Layer

How the networking is configured:
**┌────────────────────────────────────────┐**
- Networking Layer               │
- ┤
- Auto DNS Resolution                │
- Custom Domains (.dvl.to)           │
- SSL/TLS Support                    │
- Reverse Proxy Integration          │
- ┘

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Devilbox Environment"
        subgraph "Web Server Layer"
            WS["Web Servers"]
            A22["Apache 2.2"]:::webserver
            A24["Apache 2.4"]:::webserver
            NS["Nginx Stable"]:::webserver
            NM["Nginx Mainline"]:::webserver
            WS --> A22 & A24 & NS & NM
        end

        subgraph "PHP Layer"
            PHP["PHP-FPM"]
            P52["PHP 5.2-5.6"]:::php
            P70["PHP 7.0-7.4"]:::php
            P80["PHP 8.0-8.2"]:::php
            PHP --> P52 & P70 & P80
        end

        subgraph "Database Layer"
            DB["Databases"]
            MySQL["MySQL"]:::database
            Maria["MariaDB"]:::database
            Perc["Percona"]:::database
            Mongo["MongoDB"]:::database
            Redis["Redis"]:::database
            DB --> MySQL & Maria & Perc & Mongo & Redis
        end

        subgraph "Service Layer"
            SVC["Services"]
            Cache["Cache Services"]:::service
            Mail["Mail Interface"]:::service
            DBUI["Database UI"]:::service
            SVC --> Cache & Mail & DBUI
        end

        subgraph "Development Tools"
            DEV["Dev Tools"]
            Composer["Composer"]:::tool
            Debug["Debug Tools"]:::tool
            XDebug["XDebug Interface"]:::tool
            DEV --> Composer & Debug & XDebug
        end

        subgraph "Project Structure"
            PS["Project Files"]
            CFG["Configuration"]:::files
            DATA["Project Data"]:::files
            LOGS["Logs"]:::files
            DEVIL["Internal Files"]:::files
            PS --> CFG & DATA & LOGS & DEVIL
        end

        subgraph "Infrastructure"
            INF["Core Infrastructure"]
            Docker["Docker Compose"]:::infra
            Env["Environment Config"]:::infra
            Override["Override Templates"]:::infra
            INF --> Docker & Env & Override
        end
    end

    %% Relationships
    WS <--> PHP
    PHP <--> DB
    DB <--> SVC
    DEV <--> PHP
    PS --- INF

    %% Click Events
    click A22 "https://github.com/cytopia/devilbox/tree/master/cfg/apache-2.2/"
    click A24 "https://github.com/cytopia/devilbox/tree/master/cfg/apache-2.4/"
    click NS "https://github.com/cytopia/devilbox/tree/master/cfg/nginx-stable/"
    click NM "https://github.com/cytopia/devilbox/tree/master/cfg/nginx-mainline/"
    click PHP "https://github.com/cytopia/devilbox/tree/master/cfg/php-fpm-*/"
    click MySQL "https://github.com/cytopia/devilbox/tree/master/cfg/mysql-*/"
    click Maria "https://github.com/cytopia/devilbox/tree/master/cfg/mariadb-*/"
    click Perc "https://github.com/cytopia/devilbox/tree/master/cfg/percona-*/"
    click DBUI "https://github.com/cytopia/devilbox/blob/master/.devilbox/www/htdocs/db_*.php"
    click Mail "https://github.com/cytopia/devilbox/blob/master/.devilbox/www/htdocs/mail.php"
    click Redis "https://github.com/cytopia/devilbox/blob/master/.devilbox/www/htdocs/db_redis.php"
    click Docker "https://github.com/cytopia/devilbox/blob/master/docker-compose.yml"
    click Env "https://github.com/cytopia/devilbox/tree/master/env-example"
    click Override "https://github.com/cytopia/devilbox/blob/master/compose/docker-compose.override.yml-*"
    click Debug "https://github.com/cytopia/devilbox/blob/master/.devilbox/www/htdocs/debug.php"
    click XDebug "https://github.com/cytopia/devilbox/blob/master/.devilbox/www/htdocs/info_xdebug.php"

    %% Styling
    classDef webserver fill:#f96
    classDef php fill:#99f
    classDef database fill:#9f9
    classDef service fill:#f9f
    classDef tool fill:#ff9
    classDef files fill:#9ff
    classDef infra fill:#999
```
