# neoapplications/neo-backup architecture

> Architecture diagram of the GitHub repository neoapplications/neo-backup, 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/neoapplications/neo-backup
- Repository: https://github.com/neoapplications/neo-backup

## Overview

##### Main Components Identification

The system should be divided into these major components:

a) User Interface Layer:
- Activities (MainActivityX, ComposeSms)
- Pages (HomePage, AppPage, BatchPage, etc.)
- Compose UI Components (under ui/compose)
- Navigation System (under ui/navigation)

b) Business Logic Layer:
- ViewModels (MainVM, AppVM, BatchVM, etc.)
- Actions (BackupAppAction, RestoreAppAction, etc.)
- Handlers (BackendController, ShellHandler, etc.)

c) Data Layer:
- Databases (ODatabase, ScheduleDatabase, etc.)
- DAOs (AppInfoDao, BackupDao, etc.)
- Repositories (PackageRepository, ScheduleRepository, etc.)

d) System Integration Layer:
- Root Access Interface
- File System Operations
- Shell Commands
- System Services Integration

##### Key Workflows to Highlight

a) Backup Process:
**UI -> ViewModel -> BackupAppAction -> ShellHandler -> Root Access -> File System**

b) Restore Process:
**UI -> ViewModel -> RestoreAppAction -> ShellHandler -> Root Access -> File System**

c) Scheduling System:
**ScheduleWork -> WorkHandler -> BackupAppAction -> NotificationHandler**

##### Additional Elements

- Version compatibility notes
- Encryption/decryption workflow
- Scheduled backup system
- Components requiring root access
- Database schema relationships

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef system fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% UI Layer
    subgraph UI
        Activities["Activities"]:::ui
        Pages["Pages"]:::ui
        ComposeUI["Compose UI Components"]:::ui
        Navigation["Navigation System"]:::ui
    end

    %% Business Logic Layer
    subgraph Logic
        ViewModels["ViewModels"]:::logic
        Actions["Actions"]:::logic
        Handlers["Handlers"]:::logic
    end

    %% Data Layer
    subgraph Data
        Databases["Databases"]:::data
        DAOs["DAOs"]:::data
        Repositories["Repositories"]:::data
    end

    %% System Integration Layer
    subgraph System
        RootAccess["Root Access Interface"]:::system
        FileSystem["File System Operations"]:::system
        ShellCommands["Shell Commands"]:::system
    end

    %% Additional Components
    Services["Services"]:::external
    Tasks["Tasks"]:::external
    Utils["Utils"]:::external

    %% Relationships
    Activities --> ViewModels
    Pages --> ViewModels
    ComposeUI --> Navigation
    Navigation --> ViewModels

    ViewModels --> Actions
    ViewModels --> Repositories
    Actions --> Handlers
    Actions --> Services

    Handlers --> RootAccess
    Handlers --> FileSystem
    Handlers --> ShellCommands

    Repositories --> DAOs
    DAOs --> Databases

    Services --> Tasks
    Tasks --> Handlers

    Utils --> FileSystem
    Utils --> ShellCommands

    %% Click Events
    click Activities "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/activities/"
    click Pages "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/pages/"
    click ComposeUI "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/ui/compose/"
    click Navigation "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/ui/navigation/"
    click ViewModels "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/viewmodels/"
    click Actions "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/actions/"
    click Handlers "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/handler/"
    click Databases "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/dbs/"
    click DAOs "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/dbs/dao/"
    click Repositories "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/dbs/repository/"
    click ShellCommands "https://github.com/NeoApplications/Neo-Backup/blob/main/src/main/java/com/machiav3lli/backup/handler/ShellHandler.kt"
    click FileSystem "https://github.com/NeoApplications/Neo-Backup/blob/main/src/main/java/com/machiav3lli/backup/utils/FileUtils.kt"
    click RootAccess "https://github.com/NeoApplications/Neo-Backup/blob/main/src/main/java/com/machiav3lli/backup/entity/RootFile.kt"
    click Services "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/services/"
    click Tasks "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/tasks/"
    click Utils "https://github.com/NeoApplications/Neo-Backup/tree/main/src/main/java/com/machiav3lli/backup/utils/"
```
