# leoafarias/sidekick architecture

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

- Interactive diagram: https://gitdiagram.com/leoafarias/sidekick
- Repository: https://github.com/leoafarias/sidekick

## Overview

##### Project Type and Purpose
- This is a cross-platform desktop application built with Flutter. Its primary purpose is to provide a user-friendly interface for managing Flutter versions, exploring releases, sandboxing, searching versions, and generally streamlining the Flutter development experience.
- The README emphasizes that it’s available on Linux, macOS, and Windows and highlights key features like managing Flutter versions and exploring releases.

##### File Structure
- Notice the top-level directories:
- “lib”: Contains most of the application’s code. The main entry is in lib/main.dart, and subdirectories (e.g., “modules”, “components” with atoms, molecules, and organisms) indicate a well-modularized UI architecture following a design system.
- “linux”, “macos”, “windows”: Each has its own platform-specific native code, build configurations (e.g., CMakeLists.txt, platform-specific resources and build files). This separation highlights the cross-platform support and integration of Flutter with native layers.
- Additional directories like “localizations” indicate support for multiple languages.
- Build scripts and configuration files (e.g., AppImageBuilder.yml, snapcraft.yaml, and various GitHub workflow files) are present, indicating CI/CD integrations.

##### README for Additional Insights
- The project’s README describes its feature set and confirms its multi-platform nature.
- It shows emphasis on functionalities such as Flutter version management, release navigation, sandboxing, and the integration of internationalization.
- Visual assets and badges suggest the importance of UI and user experience—reinforcing the modular design in the “lib/src/components” and “modules” folders.

a. Main Components:
- UI Layer: Represented by Flutter’s front-end code, which is built upon a well-defined hierarchy (atoms, molecules, organisms contained in “lib/src/components”). Also include screens in “lib/src/screens”.
- Modules/Business Logic: Clearly divided into multiple modules within “lib/src/modules”:
– Common module: Application shell, shared constants, DTOs, and utilities.
– FVM (Flutter Version Management): Handles Flutter versioning tasks (components, dialogs, configurations, and service providers).
– Projects module: Deals with project-specific operations such as project lists, release selections, etc.
– Releases, Sandbox, Search, Selected Detail, Settings, and Updater: Each module manages its own set of screens/components and corresponding providers, DTOs, and services.
- Native Platform Integrations: Represent the native bindings and platform-specific integration for Linux, macOS, and Windows. These sections handle initializing and embedding Flutter as well as native communications.
- Internationalization: An independent layer or service that handles multiple languages, indicated in the “lib/i18n” and “localizations” directories.
- Deployment/Build Pipeline: Represented by configuration files (GitHub workflows, snapcraft, AppImage builder, etc.) which connect to the CI/CD pipeline.

b. Relationships and Interactions:
- The UI layer interacts directly with module providers (state management) in each module (for example, projects.provider.dart, fvm.provider.dart, etc.) using well-organized data controllers.
- Modules might interact with shared utility files and DTOs that standardize communication between components.
- The native platform code (in linux/, macos/, windows/) serves as a bootstrapper, sending data to and receiving commands from the Flutter engine.
- The internationalization service is used by most modules to render localized text.

c. Architectural Patterns and Design Principles:
- Separation of Concerns: The design divides the UI, business logic, and platform-specific code into distinct directories.
- Component-Based Architecture: UI elements are further refined into atoms, molecules, and organisms for maintainability.
- Modular Design: Function-specific modules (e.g., fvm, projects, updater) organize related functionalities and code.
- Use of Providers and DTOs: State and data management are clearly established through the provider pattern and data transfer objects.

d. Relevant Technologies and Frameworks:
- Flutter & Dart: Core application framework and language.
- Platform-specific tools (CMake for Linux/Windows, Xcode configurations for macOS).
- Build and CI/CD: GitHub workflows, snapcraft, and AppImage configurations.
- Internationalization Libraries: Tools within “lib/i18n” and resources under “localizations”.

## Diagram (Mermaid)

```mermaid
graph TD
  %% Deployment/Build Pipeline Subgraph
  subgraph "Deployment/Build Pipeline"
    GH["GitHub Workflows"]:::deployment
    AIB["AppImage Builder"]:::deployment
    SNAP["Snapcraft"]:::deployment
  end

  %% UI Layer Subgraph
  subgraph "UI Layer"
    UI_Components["UI Components"]:::ui
    UI_Screens["UI Screens"]:::ui
    UI_Components -->|"contains"| UI_Screens
  end

  %% Business Logic Modules Subgraph
  subgraph "Business Logic Modules"
    Common_Module["Common Module"]:::module
    FVM_Module["FVM Module"]:::module
    Projects_Module["Projects Module"]:::module
    Releases_Module["Releases Module"]:::module
    Sandbox_Module["Sandbox Module"]:::module
    Search_Module["Search Module"]:::module
    Selected_Detail_Module["Selected Detail Module"]:::module
    Settings_Module["Settings Module"]:::module
    Updater_Module["Updater Module"]:::module
    Compatibility_Checks_Module["Compatibility Checks Module"]:::module
  end

  %% Native Platform Integrations Subgraph
  subgraph "Native Platform Integrations"
    Linux_Native["Linux"]:::native
    MacOS_Native["macOS"]:::native
    Windows_Native["Windows"]:::native
  end

  %% Internationalization Subgraph
  subgraph "Internationalization"
    Intl_Service["Internationalization Service"]:::intl
    Intl_Localizations["Localizations"]:::intl
    Intl_Service --- Intl_Localizations
  end

  %% Arrows for Deployment/Build Pipeline
  GH -->|"builds"| UI_Components
  GH -->|"builds"| Common_Module
  GH -->|"builds"| Linux_Native
  GH -->|"builds"| MacOS_Native
  GH -->|"builds"| Windows_Native

  %% Arrows for UI and Modules
  UI_Screens -->|"triggers"| Common_Module

  %% Arrows within Business Logic Modules (from Common Module to specialized modules)
  Common_Module -->|"utilizes"| FVM_Module
  Common_Module -->|"utilizes"| Projects_Module
  Common_Module -->|"utilizes"| Releases_Module
  Common_Module -->|"utilizes"| Sandbox_Module
  Common_Module -->|"utilizes"| Search_Module
  Common_Module -->|"utilizes"| Selected_Detail_Module
  Common_Module -->|"utilizes"| Settings_Module
  Common_Module -->|"utilizes"| Updater_Module
  Common_Module -->|"utilizes"| Compatibility_Checks_Module

  %% Modules interacting with Native Platform Integrations
  Common_Module -->|"interfaces"| Linux_Native
  Common_Module -->|"interfaces"| MacOS_Native
  Common_Module -->|"interfaces"| Windows_Native

  %% Native Platform sending data back to UI
  Linux_Native -->|"sends updates"| UI_Screens
  MacOS_Native -->|"sends updates"| UI_Screens
  Windows_Native -->|"sends updates"| UI_Screens

  %% Internationalization interactions
  Intl_Service -->|"localizes"| UI_Screens
  Intl_Service -->|"localizes"| Common_Module

  %% Styling Definitions
  classDef ui fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
  classDef module fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
  classDef native fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
  classDef intl fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
  classDef deployment fill:#D1C4E9,stroke:#4527A0,stroke-width:2px;

  %% Click Events
  click UI_Components "https://github.com/leoafarias/sidekick/tree/main/lib/src/components"
  click UI_Screens "https://github.com/leoafarias/sidekick/tree/main/lib/src/screens"
  click Common_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/common"
  click FVM_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/fvm"
  click Projects_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/projects"
  click Releases_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/releases"
  click Sandbox_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/sandbox"
  click Search_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/search"
  click Selected_Detail_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/selected_detail"
  click Settings_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/settings"
  click Updater_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/updater"
  click Compatibility_Checks_Module "https://github.com/leoafarias/sidekick/tree/main/lib/src/modules/compatibility_checks"
  click Intl_Service "https://github.com/leoafarias/sidekick/tree/main/lib/i18n"
  click Intl_Localizations "https://github.com/leoafarias/sidekick/tree/main/localizations"
  click Linux_Native "https://github.com/leoafarias/sidekick/tree/main/linux"
  click MacOS_Native "https://github.com/leoafarias/sidekick/tree/main/macos"
  click Windows_Native "https://github.com/leoafarias/sidekick/tree/main/windows"
  click GH "https://github.com/leoafarias/sidekick/tree/main/.github/workflows"
  click AIB "https://github.com/leoafarias/sidekick/blob/main/AppImageBuilder.yml"
  click SNAP "https://github.com/leoafarias/sidekick/blob/main/snapcraft.yaml"
```
