# linuxserver/heimdall architecture

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

- Interactive diagram: https://gitdiagram.com/linuxserver/heimdall
- Repository: https://github.com/linuxserver/heimdall

## Overview

##### Main Components Identification

The system should be represented with these key components:

a) Frontend Layer:
- Vue.js components (in resources/assets/js/components)
- Static assets (CSS, JavaScript, images)
- Blade templates (in resources/views)

b) Backend Layer:
- Laravel Framework (PHP 8.1+)
- Controllers (app/Http/Controllers)
- Models (app/Item.php, app/User.php, etc.)
- Service Providers (app/Providers)

c) Database Layer:
- SQLite database
- Migrations (database/migrations)
- Seeders (database/seeders)

d) External Services:
- Search providers integration
- Enhanced apps API connections
- Docker container support

**[Client Browser] ←→ [Web Server (Apache/Nginx)]**
- ↓
**[Frontend Layer]**
- Vue.js Components
- Blade Templates
- Asset Pipeline
- ↓
**[Application Layer]**
- Controllers
- Middleware
- Authentication
- Application Logic
- ↓
**[Service Layer]**
- Enhanced Apps Service
- Search Provider Service
- Settings Service
- ↓
**[Data Layer]**
- SQLite Database
- File Storage
- ↓
**[External Services]**
- Enhanced Apps APIs
- Search Providers

##### Key Relationships to Highlight

- Authentication flow between components
- API communication with enhanced applications
- Data flow between frontend and backend
- Search provider integration

##### Technical Details

- PHP 8.1+ requirement
- Laravel 10 framework
- Vue.js frontend framework
- SQLite database
- Required PHP extensions
- Docker multi-arch support

##### Additional Elements

- Version information
- Scaling capabilities
- Security layers (middleware, CSRF protection)
- Caching mechanisms

Remember to include notes about the system requirements and dependencies, as they are crucial for deployment and maintenance.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph WebServer["Web Server Layer"]
        Apache["Apache/Nginx"]
    end

    subgraph FrontEnd["Frontend Layer"]
        VueComponents["Vue.js Components"]:::frontend
        BladeTemplates["Blade Templates"]:::frontend
        Assets["Static Assets"]:::frontend
        AssetPipeline["Asset Pipeline"]:::frontend
    end

    subgraph AppLayer["Application Layer"]
        Controllers["Controllers"]:::backend
        Middleware["Middleware"]:::backend
        Auth["Authentication"]:::security
        AppLogic["Application Logic"]:::backend
    end

    subgraph ServiceLayer["Service Layer"]
        EnhancedApps["Enhanced Apps Service"]:::service
        SearchProvider["Search Provider Service"]:::service
        Settings["Settings Service"]:::service
    end

    subgraph DataLayer["Data Layer"]
        Database[(SQLite Database)]:::database
        FileStorage["File Storage"]:::storage
    end

    subgraph ExternalServices["External Services"]
        EnhancedAPI["Enhanced Apps APIs"]:::external
        SearchAPI["Search Providers"]:::external
    end

    %% Relationships
    Browser <--> Apache
    Apache --> VueComponents
    Apache --> BladeTemplates
    
    VueComponents --> Controllers
    BladeTemplates --> Controllers
    Assets --> AssetPipeline
    
    Controllers --> Auth
    Controllers --> AppLogic
    Middleware --> AppLogic
    
    AppLogic --> EnhancedApps
    AppLogic --> SearchProvider
    AppLogic --> Settings
    
    EnhancedApps --> Database
    SearchProvider --> Database
    Settings --> Database
    Settings --> FileStorage
    
    EnhancedApps --> EnhancedAPI
    SearchProvider --> SearchAPI

    %% Click Events
    click VueComponents "https://github.com/linuxserver/Heimdall/tree/2.x/resources/assets/js/components"
    click BladeTemplates "https://github.com/linuxserver/Heimdall/tree/2.x/resources/views"
    click Assets "https://github.com/linuxserver/Heimdall/tree/2.x/public/css"
    click Controllers "https://github.com/linuxserver/Heimdall/tree/2.x/app/Http/Controllers"
    click Middleware "https://github.com/linuxserver/Heimdall/tree/2.x/app/Http/Middleware"
    click Auth "https://github.com/linuxserver/Heimdall/tree/2.x/app/Http/Controllers/Auth"
    click EnhancedApps "https://github.com/linuxserver/Heimdall/blob/2.x/app/EnhancedApps.php"
    click SearchProvider "https://github.com/linuxserver/Heimdall/blob/2.x/app/Search.php"
    click Database "https://github.com/linuxserver/Heimdall/tree/2.x/database/migrations"
    click FileStorage "https://github.com/linuxserver/Heimdall/tree/2.x/storage"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef storage fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#1abc9c,stroke:#16a085,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        SecurityComp["Security Component"]:::security
        ServiceComp["Service Component"]:::service
        DatabaseComp["Database"]:::database
        StorageComp["Storage"]:::storage
        ExternalComp["External Service"]:::external
    end
```
