# sabrehagen/desktop-environment architecture

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

- Interactive diagram: https://gitdiagram.com/sabrehagen/desktop-environment
- Repository: https://github.com/sabrehagen/desktop-environment

## Overview

##### Main Components

a. Container Layer:
- Docker Container (Primary Environment)

b. Core Services:
- Window Manager (i3)
- Terminal (Alacritty)
- Development Tools (VS Code)
- Browser (Google Chrome)
- Communication Tools (Discord, Telegram)
- System Monitoring (gotop)
- File Management (pcmanfm)

c. Deployment Targets (show as parallel paths):
- Local Desktop Deployment
- Cloud Deployment
- GitHub Actions Runtime
- Google Cloud (via cloud-computer integration)

d. External Services:
- ngrok (for cloud access)
- GitHub Container Registry
- GitHub Actions

##### Architectural Patterns to Highlight

a. Container Architecture:
- Isolation boundary of the Docker container
- Volume mounts for persistence
- Network interfaces

b. Deployment Pipeline:
- GitHub Actions workflow path
- Container registry integration
- Cloud deployment path

##### Implementation Details

- Scripts Layer (docker/scripts/*)
- Bootstrap, build, and management scripts
- Configuration Layer
- Window manager config
- System keybindings
- Runtime Layer
- Desktop applications
- System services

##### Access Patterns

Illustrate:
- Local access path
- Remote access through ngrok
- Cloud deployment access

##### Access Layer (Local and Remote Access)

- Keep the container boundary clear and prominent
- Both local and cloud deployment paths
- Self-contained nature of the environment
- Annotations for key configuration points
- Version control and CI/CD integration points

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Infrastructure
        Docker["Docker Runtime"]:::infra
        GHActions["GitHub Actions"]:::infra
        GHCR["GitHub Container Registry"]:::infra
        GCloud["Google Cloud Platform"]:::infra
        Ngrok["ngrok Service"]:::external
    end

    subgraph "Desktop Environment Container"
        WM["Window Manager (i3)"]:::core
        Term["Terminal (Alacritty)"]:::core
        VSCode["VS Code"]:::dev
        Chrome["Google Chrome"]:::app
        Discord["Discord"]:::app
        Telegram["Telegram"]:::app
        Gotop["System Monitor (gotop)"]:::system
        FileMan["File Manager (pcmanfm)"]:::system
    end

    subgraph "Scripts Layer"
        Bootstrap["Bootstrap Script"]:::script
        EnvConfig["Environment Config"]:::script
        StartService["Start Service"]:::script
        StopService["Stop Service"]:::script
        BuildSystem["Build System"]:::script
        VolumeManager["Volume Manager"]:::script
        SessionMgr["Session Manager"]:::script
    end

    subgraph "CI/CD Pipeline"
        BuildPipe["Build Pipeline"]:::cicd
        DeployPipe["Deploy Pipeline"]:::cicd
        DotfilesBuild["Dotfiles Build"]:::cicd
    end

    %% Relationships
    Docker --> WM
    GHActions --> GHCR
    GHCR --> Docker
    Ngrok --> Docker
    
    %% Script relationships
    Bootstrap --> Docker
    EnvConfig --> Docker
    StartService --> Docker
    StopService --> Docker
    BuildSystem --> GHCR
    
    %% CI/CD relationships
    BuildPipe --> GHCR
    DeployPipe --> GCloud
    DotfilesBuild --> Docker

    %% Click events
    click Docker "https://github.com/sabrehagen/desktop-environment/tree/master/docker/Dockerfile"
    click BuildPipe "https://github.com/sabrehagen/desktop-environment/blob/master/.github/workflows/build.yml"
    click DeployPipe "https://github.com/sabrehagen/desktop-environment/blob/master/.github/workflows/deploy.yml"
    click DotfilesBuild "https://github.com/sabrehagen/desktop-environment/blob/master/.github/workflows/build-from-dotfiles.yml"
    click Bootstrap "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/bootstrap.sh"
    click EnvConfig "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/environment.sh"
    click StartService "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/start.sh"
    click StopService "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/stop.sh"
    click BuildSystem "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/build.sh"
    click VolumeManager "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/wipe-volume.sh"
    click SessionMgr "https://github.com/sabrehagen/desktop-environment/blob/master/docker/scripts/tmux.sh"

    %% Styling
    classDef infra fill:#gray,stroke:#333,stroke-width:2px
    classDef core fill:#green,stroke:#333,stroke-width:2px
    classDef dev fill:#purple,stroke:#333,stroke-width:2px
    classDef app fill:#lightblue,stroke:#333,stroke-width:2px
    classDef system fill:#lightgray,stroke:#333,stroke-width:2px
    classDef external fill:#orange,stroke:#333,stroke-width:2px
    classDef script fill:#yellow,stroke:#333,stroke-width:2px
    classDef cicd fill:#pink,stroke:#333,stroke-width:2px
```
