# ryanb58/coolify architecture

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

- Interactive diagram: https://gitdiagram.com/ryanb58/coolify
- Repository: https://github.com/ryanb58/coolify

## Overview

##### Main Components Identification

a) Core Application Components:
- Frontend (Laravel Livewire + Vue.js components)
- Backend (Laravel PHP framework)
- Real-time Server (WebSocket server in docker/coolify-realtime)
- Helper Service (docker/coolify-helper)
- Database Layer (supports multiple databases)
- Queue System (Laravel Horizon)
- Scheduler Worker

b) External Services Integration:
- Git Providers (GitHub, GitLab, Bitbucket, Gitea)
- Docker Registry
- S3 Storage Services
- Email Services
- Monitoring Systems

**┌─ Client Layer ─────────────────────┐**
- Web Interface                    │
- API Consumers                    │
- ┬─┘
**┌─ Application Layer ───────────────┴─┐**
- ┌─ Web Server (Nginx) ─────────────┐│
- Static Assets                   ││
- PHP-FPM                        ││
- ┬─┘│
- ┌─ Core Services ────────────────┴─┐│
- Authentication                  ││
- Project Management             ││
- Deployment Pipeline            ││
- Resource Management            ││
- ┬─┘│
- ┌─ Background Services ───────────┴─┐│
- Queue Workers (Horizon)         ││
- Scheduler                       ││
- WebSocket Server               ││
- ┬─┘│
- ┼──┘
**┌─ Infrastructure Layer ────────────┴─┐**
- Database Servers                  │
- Docker Engine                     │
- Storage Systems                   │
- Cache (Redis)                     │
- ┬──┘
**┌─ External Services ───────────────┴─┐**
- Git Providers                     │
- Cloud Storage                     │
- Email Services                    │
- Monitoring                        │
- ┘

##### Key Interactions to Highlight

- User authentication flow
- Deployment pipeline process
- Real-time updates via WebSocket
- Background job processing
- Database interactions
- External service integrations

##### Additional Elements

Important aspects:
- Security boundaries
- Load balancing
- Data flow directions
- Scaling points
- Backup systems
- Monitoring points

##### Specific Implementation Details

- Docker containerization
- Multiple database support
- SSH connections to managed servers
- Git repository interactions
- Queue system for background jobs
- Real-time event broadcasting

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        WI[Web Interface]
        API[API Consumers]
    end

    subgraph Application
        subgraph WebServer
            Nginx[Nginx Web Server]
            FE["Frontend (Laravel Livewire + Vue)"]:::frontend
            BE["Backend (Laravel)"]:::backend
        end

        subgraph CoreServices
            Auth["Authentication"]:::auth
            PM["Project Management"]:::core
            DP["Deployment Pipeline"]:::core
            RM["Resource Management"]:::core
        end

        subgraph BackgroundServices
            QW["Queue Workers (Horizon)"]:::worker
            SW["Scheduler Worker"]:::worker
            WS["WebSocket Server"]:::worker
            HS["Helper Service"]:::worker
        end
    end

    subgraph Infrastructure
        DB[(Database Servers)]:::infra
        Docker[Docker Engine]:::infra
        Storage[Storage Systems]:::infra
        Cache[(Redis Cache)]:::infra
    end

    subgraph ExternalServices
        Git["Git Providers"]:::external
        S3["Cloud Storage"]:::external
        Email["Email Services"]:::external
        Monitor["Monitoring"]:::external
    end

    %% Client Layer Connections
    WI --> FE
    API --> BE

    %% Web Server Layer Connections
    FE --> BE
    BE --> Auth
    BE --> PM
    BE --> DP
    BE --> RM

    %% Core Services Connections
    Auth --> DB
    PM --> DB
    DP --> Docker
    RM --> Docker

    %% Background Services Connections
    BE --> QW
    BE --> SW
    BE --> WS
    BE --> HS
    QW --> Cache
    WS --> Cache

    %% Infrastructure Connections
    BE --> DB
    BE --> Cache
    BE --> Storage

    %% External Services Connections
    BE --> Git
    BE --> S3
    BE --> Email
    BE --> Monitor

    %% Styling
    classDef frontend fill:#3498db
    classDef backend fill:#2ecc71
    classDef auth fill:#9b59b6
    classDef core fill:#34495e
    classDef worker fill:#e67e22
    classDef infra fill:#e74c3c
    classDef external fill:#95a5a6

    %% Click Events
    click FE "https://github.com/Ryanb58/coolify/tree/main/resources/views/"
    click BE "https://github.com/Ryanb58/coolify/tree/main/app/Http/Controllers/"
    click WS "https://github.com/Ryanb58/coolify/tree/main/docker/coolify-realtime/"
    click HS "https://github.com/Ryanb58/coolify/tree/main/docker/coolify-helper/"
    click DB "https://github.com/Ryanb58/coolify/tree/main/app/Models/"
    click QW "https://github.com/Ryanb58/coolify/blob/main/app/Console/Commands/Horizon.php"
    click SW "https://github.com/Ryanb58/coolify/blob/main/app/Console/Commands/Scheduler.php"
    click Auth "https://github.com/Ryanb58/coolify/tree/main/app/Actions/Fortify/"
    click PM "https://github.com/Ryanb58/coolify/tree/main/app/Livewire/Project/"
    click DP "https://github.com/Ryanb58/coolify/blob/main/app/Jobs/ApplicationDeploymentJob.php"
    click RM "https://github.com/Ryanb58/coolify/tree/main/app/Livewire/Project/Resource/"
```
