# cryptomator/android architecture

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

- Interactive diagram: https://gitdiagram.com/cryptomator/android
- Repository: https://github.com/cryptomator/android

## Overview

##### Project type and purpose
- This is a native Android client application (“Cryptomator for Android”) providing transparent client-side encryption of files stored in various cloud services or local storage.
- It uses a multi-module Gradle project structured around Clean Architecture (presentation, domain, data, util layers), plus generator modules for build-time code generation and a buildsystem module for Docker-based reproducible builds.

##### File structure
- Top-level modules:
- presentation: UI layer (Activities, Fragments, Presenters, DI modules)
- domain: business logic (UseCases, Entities, Repository interfaces)
- data: data layer (Repository implementations, CloudContentRepositoryFactories, DB, crypto, local storage, network clients)
- util: shared utilities (cryptography helpers, file/cache utils, logging)
- generator & generator-api: annotation processors and supporting API for auto-generating boilerplate
- buildsystem: Dockerfile and scripts for reproducible builds
- fastlane, playstore, fdroid, lite, apkStorePlaystore: CI/CD and distribution metadata
- Configuration files: build.gradle in each module, settings.gradle, Gemfile, .github workflows, Docker config.

##### README for additional insights
- Confirms multi-flavor Android build targeting Google Play, F-Droid, Accrescent, etc.
- Mentions dependencies (JDK17, Gradle), reproducible builds via Docker.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        UI["Android UI\n(Activities, Fragments, Presenters)"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        UseCases["Use Cases\n(Interactors)"]:::domain
        Entities["Entities"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        RepoImpl["Repository Implementations"]:::data
        SQLiteDB["SQLite DB\n(DatabaseFactory)"]:::data
        CryptoMod["Crypto Module"]:::data
        subgraph "Cloud Clients"
            direction TB
            Dropbox["Dropbox Client"]:::external
            OneDrive["OneDrive Client"]:::external
            pCloud["pCloud Client"]:::external
            GoogleDrive["Google Drive Client"]:::external
            S3["S3 Client"]:::external
            WebDAV["WebDAV Client"]:::external
        end
        LocalStorage["Local Storage Access"]:::data
    end

    %% Utilities & Generator
    subgraph "Utilities & Generator"
        direction TB
        Util["Util Module\n(Shared Utilities)"]:::util
        Generator["Annotation Processor\n(generator)"]:::generator
        GenAPI["Annotation API\n(generator-api)"]:::generator
    end

    %% Build & CI
    subgraph "Build & CI"
        direction TB
        Docker["Docker Buildsystem"]:::build
        GitHubActions["GitHub Actions\n(.github/workflows)"]:::build
        Fastlane["Fastlane\n(Fastfile, Appfile)"]:::build
    end

    %% External Services
    subgraph "External Services"
        direction TB
        CloudGroup["Cloud Services & OS"]:::external
        AndroidOS["Android OS APIs"]:::external
    end

    %% Connections
    UI -->|"invokes"| UseCases
    UseCases -->|"use"| RepoInterfaces
    RepoInterfaces -->|"bound to"| RepoImpl
    RepoImpl -->|"SQL"| SQLiteDB
    RepoImpl -->|"crypto ops"| CryptoMod
    RepoImpl -->|"OkHttp/REST"| Dropbox
    RepoImpl -->|"OkHttp/REST"| OneDrive
    RepoImpl -->|"OkHttp/REST"| pCloud
    RepoImpl -->|"OkHttp/REST"| GoogleDrive
    RepoImpl -->|"OkHttp/REST"| S3
    RepoImpl -->|"OkHttp/REST"| WebDAV
    RepoImpl -->|"file I/O"| LocalStorage
    UI -->|"uses"| Util
    UseCases -->|"uses"| Util
    RepoImpl -->|"uses"| Util
    Generator -->|"generates code for"| UI
    Generator -->|"generates code for"| UseCases
    GenAPI -->|"defines annotations"| Generator
    Docker -->|"builds"| UI
    Docker -->|"builds"| UseCases
    Docker -->|"builds"| RepoImpl
    Docker -->|"builds"| Util
    GitHubActions -->|"orchestrates"| Docker
    Fastlane -->|"publishes builds"| Docker
    RepoImpl -->|"invokes"| AndroidOS
    RepoImpl -->|"invokes"| CloudGroup

    %% Click Events
    click UI "https://github.com/cryptomator/android/tree/develop/presentation/src/main/java/org/cryptomator/presentation"
    click UseCases "https://github.com/cryptomator/android/tree/develop/domain/src/main/java/org/cryptomator/domain"
    click RepoInterfaces "https://github.com/cryptomator/android/tree/develop/domain/src/main/java/org/cryptomator/domain"
    click RepoImpl "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/repository"
    click SQLiteDB "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/db"
    click CryptoMod "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/crypto"
    click Dropbox "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/dropbox"
    click OneDrive "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/onedrive"
    click pCloud "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/pcloud"
    click GoogleDrive "https://github.com/cryptomator/android/tree/develop/data/src/apkStorePlaystore/java/org/cryptomator/data/cloud/googledrive"
    click S3 "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/s3"
    click WebDAV "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/webdav"
    click LocalStorage "https://github.com/cryptomator/android/tree/develop/data/src/main/java/org/cryptomator/data/cloud/local"
    click Util "https://github.com/cryptomator/android/tree/develop/util/src/main/java/org/cryptomator/util"
    click Generator "https://github.com/cryptomator/android/tree/develop/generator/src/main/java/org/cryptomator/generator"
    click GenAPI "https://github.com/cryptomator/android/tree/develop/generator-api/src/main/java/org/cryptomator/generator"
    click Docker "https://github.com/cryptomator/android/tree/develop/buildsystem/Dockerfile"
    click GitHubActions "https://github.com/cryptomator/android/blob/develop/.github/workflows/build.yml"
    click Fastlane "https://github.com/cryptomator/android/tree/develop/fastlane/Fastfile"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#000;
    classDef domain fill:#90EE90,stroke:#000;
    classDef data fill:#FFFFE0,stroke:#000;
    classDef util fill:#D3D3D3,stroke:#000;
    classDef generator fill:#D3D3D3,stroke:#000;
    classDef external fill:#FFA500,stroke:#000;
    classDef build fill:#A9A9A9,stroke:#000;
```
