# georgeyt9769/cardabase-app architecture

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

- Interactive diagram: https://gitdiagram.com/georgeyt9769/cardabase-app
- Repository: https://github.com/georgeyt9769/cardabase-app

## Overview

##### Project Type & Purpose
- Cardabase is a standalone, cross-platform mobile wallet app built with Flutter (Dart).
- It has no external backend—everything runs on the client, using encrypted local storage, camera/barcode plugins, and QR-based import/export.

##### High-Level Structure (from file tree & README)
- android/                → Native Android wrapper (Kotlin MainActivity, Gradle, platform integration, Fastlane)
- lib/                    → Flutter code:
– data/               → Local DB schema & access (cardabase_db.dart)
– pages/              → UI screens (Home, Create/Edit Card, Barcode, Settings, etc.)
– theme/              → Theme definitions & providers (color_schemes, theme_provider)
– util/               → Business logic & services (camera, barcode read/write, import/export, vibration, UI tiles)
- fastlane/               → CI/CD scripts & metadata for Android releases
- submodules/flutter/     → Embedded Flutter engine

##### Key Architectural Patterns
- Layered architecture:
- Presentation Layer (lib/pages)
- State & Theme Management (Provider pattern in lib/theme & util/brightness_provider, theme_provider)
- Business Logic & Services (lib/util)
- Data Layer (lib/data with local SQLite/Drift, encrypted storage)
- Platform Integration (Flutter Engine ↔ Android via plugins)
- Flutter’s reactive UI + Provider for dependency injection and state propagation.

##### Main Components & Interactions
[UI Layer]
↕ uses
[State & Theme Providers]
↕ orchestrate
[Business Services (util)]
↔ call
[Platform Plugins] (camera, file I/O, barcode scanner)
↔ invoke
[Native Android APIs]

[Business Services]
↕ read/write
[Data Layer (cardabase_db.dart)]
↕ store/retrieve
[Encrypted Local SQLite DB]

[Build & Deploy]
Code → Flutter toolchain → Android Gradle → APK → Fastlane → Play Store (or F-Droid)
(GitHub Actions triggers android-release.yml)

- That the app is monolithic on the client, with no external web services.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer (UI Screens)"
        direction TB
        homepage["Homepage"]:::frontend
        createcardnew["Create Card"]:::frontend
        editcard["Edit Card"]:::frontend
        generate_barcode_page["Generate Barcode"]:::frontend
        settings["Settings"]:::frontend
        password["Password"]:::frontend
        tags_page["Tags"]:::frontend
        info["Info"]:::frontend
        news["News"]:::frontend
        welcome_screen["Welcome Screen"]:::frontend
        lib_main["App Entry (main.dart)"]:::frontend
    end

    %% State & Theme
    subgraph "State & Theme Providers"
        direction TB
        theme_provider["theme_provider.dart"]:::state
        theme_def["theme.dart"]:::state
        color_schemes["color_schemes.g.dart"]:::state
        brightness_provider["brightness_provider.dart"]:::state
        vibration_provider["vibration_provider.dart"]:::state
        systemfont_provider["systemfont_provider.dart"]:::state
    end

    %% Business Logic & Services
    subgraph "Business Logic & Services"
        direction TB
        camera["camera.dart"]:::services
        read_barcode["read_barcode.dart"]:::services
        export_data["export_data.dart"]:::services
        import_data["import_data.dart"]:::services
        button_tile["button_tile.dart"]:::services
        card_tile["card_tile.dart"]:::services
        color_picker["color_picker.dart"]:::services
        setting_tile["setting_tile.dart"]:::services
        devoptions["devoptions.dart"]:::services
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        cardabase_db["cardabase_db.dart"]:::data
        sqlite["Encrypted SQLite DB"]:::data
    end

    %% Platform & Native
    subgraph "Platform & Native"
        direction TB
        flutter_engine["Flutter Engine"]:::platform
        camera_plugin["Camera Plugin"]:::platform
        file_io_plugin["File I/O Plugin"]:::platform
        barcode_scanner["Barcode Scanner Plugin"]:::platform
        native_host["Kotlin MainActivity"]:::platform
    end

    %% Release Pipeline
    subgraph "Release Pipeline"
        direction TB
        android_build_gradle["android/build.gradle"]:::ci
        app_build_gradle["android/app/build.gradle"]:::ci
        github_actions[".github/workflows/android-release.yml"]:::ci
        fastlane_root["fastlane/Fastfile"]:::ci
        fastlane_android["android/fastlane/Fastfile"]:::ci
    end

    %% Connections
    lib_main -->|"renders"| homepage
    homepage -->|"renders"| createcardnew
    createcardnew -->|"renders"| editcard
    editcard -->|"renders"| generate_barcode_page
    generate_barcode_page -->|"renders"| settings
    settings -->|"renders"| password
    password -->|"renders"| tags_page
    tags_page -->|"renders"| info
    info -->|"renders"| news
    news -->|"renders"| welcome_screen

    homepage -->|"uses"| theme_provider
    welcome_screen -->|"uses"| theme_def
    settings -->|"uses"| color_schemes

    theme_provider -->|"orchestrates"| camera
    brightness_provider -->|"orchestrates"| read_barcode

    camera -->|"calls"| camera_plugin
    read_barcode -->|"calls"| barcode_scanner
    export_data -->|"calls"| file_io_plugin

    camera_plugin -->|"invokes"| native_host
    file_io_plugin -->|"invokes"| native_host
    barcode_scanner -->|"invokes"| native_host
    flutter_engine -->|"hosts"| native_host

    camera -->|"reads/writes"| cardabase_db
    import_data -->|"reads"| cardabase_db
    cardabase_db -->|"stores"| sqlite

    %% CI/CD Flow
    lib_main -->|"build with"| android_build_gradle
    android_build_gradle -->|"includes"| app_build_gradle
    app_build_gradle -->|"trigger"| github_actions
    github_actions -->|"runs"| fastlane_root
    fastlane_root -->|"deploys via"| fastlane_android

    %% Click Events
    click native_host "https://github.com/georgeyt9769/cardabase-app/blob/main/android/app/src/main/kotlin/com/example/kard/MainActivity.kt"
    click android_build_gradle "https://github.com/georgeyt9769/cardabase-app/blob/main/android/build.gradle"
    click app_build_gradle "https://github.com/georgeyt9769/cardabase-app/blob/main/android/app/build.gradle"
    click github_actions "https://github.com/georgeyt9769/cardabase-app/blob/main/.github/workflows/android-release.yml"
    click fastlane_root "https://github.com/georgeyt9769/cardabase-app/tree/main/fastlane/Fastfile"
    click fastlane_android "https://github.com/georgeyt9769/cardabase-app/tree/main/android/fastlane/Fastfile"
    click flutter_engine "https://github.com/georgeyt9769/cardabase-app/tree/main/submodules/flutter"
    click homepage "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/homepage.dart"
    click createcardnew "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/createcardnew.dart"
    click editcard "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/editcard.dart"
    click generate_barcode_page "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/generate_barcode_page.dart"
    click settings "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/settings.dart"
    click password "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/password.dart"
    click tags_page "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/tags_page.dart"
    click info "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/info.dart"
    click news "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/news.dart"
    click welcome_screen "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/pages/welcome_screen.dart"
    click theme_provider "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/theme/theme_provider.dart"
    click theme_def "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/theme/theme.dart"
    click color_schemes "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/theme/color_schemes.g.dart"
    click brightness_provider "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/brightness_provider.dart"
    click vibration_provider "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/vibration_provider.dart"
    click systemfont_provider "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/systemfont_provider.dart"
    click camera "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/camera.dart"
    click read_barcode "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/read_barcode.dart"
    click export_data "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/export_data.dart"
    click import_data "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/import_data.dart"
    click button_tile "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/button_tile.dart"
    click card_tile "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/card_tile.dart"
    click color_picker "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/color_picker.dart"
    click setting_tile "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/setting_tile.dart"
    click devoptions "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/util/devoptions.dart"
    click cardabase_db "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/data/cardabase_db.dart"
    click lib_main "https://github.com/georgeyt9769/cardabase-app/blob/main/lib/main.dart"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef state fill:#d4edda,stroke:#333,stroke-width:1px
    classDef services fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef data fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef platform fill:#e2e3e5,stroke:#333,stroke-width:1px
    classDef ci fill:#f3e5ff,stroke:#333,stroke-width:1px
```
