# internxt/drive-desktop-linux architecture

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

- Interactive diagram: https://gitdiagram.com/internxt/drive-desktop-linux
- Repository: https://github.com/internxt/drive-desktop-linux

## Overview

##### Main Components

a) Frontend Layer:
- Renderer Process (React Application)
- Components (/src/apps/renderer/components)
- Pages (/src/apps/renderer/pages)
- Hooks (/src/apps/renderer/hooks)
- Context Providers (/src/apps/renderer/context)

b) Backend Layer:
- Main Process (/src/apps/main)
- IPC Communication
- System Services
- Background Processes
- File System Integration

c) Core Domains:
- Virtual Drive (/src/context/virtual-drive)
- Storage Management (/src/context/storage)
- User Management (/src/context/user)
- Backup System (/src/apps/backups)

d) Infrastructure:
- Database Layer
- File System Integration
- Network Communication
- Caching System

##### Relationships and Interactions

- IPC communication between Renderer and Main processes
- Data flow between Virtual Drive and Storage systems
- Event propagation through the EventBus system
- File synchronization workflow
- Backup process flow

##### Specific Implementation Details

Specialized sections for:
- FUSE integration for virtual drive mounting
- Backup system architecture
- File synchronization mechanism
- Thumbnail generation system
- Error handling and recovery

**┌─────────────────────────────────────────────┐**
- UI Layer (React)              │
- ┤
- IPC Communication Layer           │
- ┤
- Main Process Services Layer         │
- ┤
- Domain Core Layer              │
- ┤
- Infrastructure Layer              │
- ┘

##### Key Architectural Patterns to Highlight

- Domain-Driven Design (evident in the context organization)
- Event-driven architecture (EventBus implementation)
- Repository pattern (for data access)
- Dependency injection (shown in DI containers)
- Clean Architecture (separation of concerns in layers)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white
    classDef drive fill:#e74c3c,stroke:#c0392b,color:white
    classDef event fill:#f1c40f,stroke:#f39c12,color:black
    classDef infra fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef user fill:#1abc9c,stroke:#16a085,color:white

    %% Frontend Layer
    subgraph Frontend
        UI["React UI"]:::frontend
        Components["Components"]:::frontend
        Pages["Pages"]:::frontend
        Hooks["Hooks"]:::frontend
        Context["Context Providers"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        MainProcess["Main Process"]:::backend
        IPC["IPC Communication"]:::backend
        BGProcess["Background Processes"]:::backend
        Windows["Window Management"]:::backend
    end

    %% Core Domains
    subgraph CoreDomains
        VirtualDrive["Virtual Drive System"]:::drive
        StorageManagement["Storage Management"]:::storage
        UserManagement["User Management"]:::user
        BackupSystem["Backup System"]:::drive
    end

    %% Infrastructure
    subgraph Infrastructure
        Database["Database Layer"]:::infra
        FileSystem["File System Integration"]:::infra
        Network["Network Communication"]:::infra
        EventBus["Event Bus"]:::event
        Thumbnails["Thumbnail System"]:::infra
    end

    %% Relationships
    UI --> |User Actions| IPC
    IPC --> MainProcess
    MainProcess --> BGProcess
    MainProcess --> Windows
    BGProcess --> BackupSystem
    BGProcess --> VirtualDrive
    VirtualDrive --> StorageManagement
    StorageManagement --> FileSystem
    UserManagement --> Network
    EventBus --> MainProcess
    EventBus --> VirtualDrive
    EventBus --> BackupSystem
    Thumbnails --> FileSystem
    Database --> StorageManagement

    %% Component Mappings
    click Components "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/renderer/components"
    click Pages "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/renderer/pages"
    click Hooks "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/renderer/hooks"
    click Context "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/renderer/context"
    click MainProcess "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main"
    click IPC "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main/ipc"
    click BGProcess "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main/background-processes"
    click Windows "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main/windows"
    click VirtualDrive "https://github.com/internxt/drive-desktop-linux/tree/main/src/context/virtual-drive"
    click StorageManagement "https://github.com/internxt/drive-desktop-linux/tree/main/src/context/storage"
    click UserManagement "https://github.com/internxt/drive-desktop-linux/tree/main/src/context/user"
    click BackupSystem "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/backups"
    click Database "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main/database"
    click Network "https://github.com/internxt/drive-desktop-linux/tree/main/src/apps/main/network"
    click EventBus "https://github.com/internxt/drive-desktop-linux/blob/main/src/context/shared/domain/EventBus.ts"
    click Thumbnails "https://github.com/internxt/drive-desktop-linux/tree/main/src/context/virtual-drive/thumbnails"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Backend_L["Backend"]:::backend
        Storage_L["Storage"]:::storage
        Drive_L["Drive Systems"]:::drive
        Event_L["Event System"]:::event
        Infra_L["Infrastructure"]:::infra
        User_L["User Management"]:::user
    end
```
