# mrmlik12/note-shr architecture

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

- Interactive diagram: https://gitdiagram.com/mrmlik12/note-shr
- Repository: https://github.com/mrmlik12/note-shr

## Overview

##### Main Components
- Core Business Logic: This is primarily contained in the NoteSHR.Core project, which holds the models, converters, services, and view model base classes. It encapsulates the “brain” of the application including data definitions, persistence interfaces (IDataPersistence), and business domain logic (e.g., working with boards, notes, and nodes).
- Platform-Specific Frontends:
– Desktop: Represented by the NoteSHR.Desktop project.
– Browser/Web: Represented by the NoteSHR.Browser project which also contains assets (HTML, CSS, and JS files in the AppBundle folder).
– Mobile: Separate projects for NoteSHR.Android and NoteSHR.iOS.
- File Handling & Data Persistence: The NoteSHR.File project handles import/export operations, conversion of board files, and may interact with persistence mechanisms. Include services and utilities related to the file system (e.g., BoardConverter, BoardExporter, BoardImporter, PathUtils).
- Build & Test Infrastructure: Although not part of runtime architecture, the build directory (along with NUKE build scripts) and test projects (under test/NoteSHR.File.Tests) help automate and validate the project build and behaviors.

##### Relationships and Interactions
- All UI frontends (Desktop, Browser, Android, iOS) should be shown as separate client components that interact with the common business logic.
- The shared business logic (in NoteSHR.Core) drives the overall application state, and is consumed by the MVVM implementation in the main NoteSHR UI project.
- File operations managed by NoteSHR.File provide persistence capabilities across these platforms—link this module to both the Core and the UI components which trigger import/export features.

##### Architectural Patterns and Design Principles
- MVVM Pattern: Emphasize how the separation of View (UI components) and ViewModel (in the shared NoteSHR project and NoteSHR.Core) helps maintain platform agnosticism.
- Layered Architecture: Visually differentiate the presentation layer (views/controls), the business logic layer (models/services in NoteSHR.Core), and the persistence/file handling layer (NoteSHR.File). This separation enhances maintainability and allows for parallel development on various fronts.
- Cross-Platform Code Sharing: Highlight that despite having different platform projects, most business logic and UI logic (especially ViewModels) are shared—helping reduce code duplication.

##### Incorporate Technologies and Frameworks
- The build system (NUKE) should be noted as part of the CI/CD pipeline, since it integrates build, test, and publish workflows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Clients
    subgraph "Platform Clients"
        Desktop["NoteSHR.Desktop – Desktop Client"]:::frontend
        Browser["NoteSHR.Browser – Browser Client"]:::frontend
        Android["NoteSHR.Android – Android Client"]:::frontend
        iOS["NoteSHR.iOS – iOS Client"]:::frontend
    end

    %% Application Layers
    subgraph "Application Layers"
        UI["NoteSHR – UI/Presentation (MVVM)"]:::frontend
        Core["NoteSHR.Core – Business Logic"]:::business
        File["NoteSHR.File – File Handling & Persistence"]:::persistence
    end

    %% CI/CD & Test Infrastructure
    subgraph "CI/CD & Tests"
        Build["Build Infrastructure (.nuke & build)"]:::infrastructure
        Test["Test Infrastructure (NoteSHR.File.Tests)"]:::infrastructure
    end

    %% Annotations/Notes
    MVVM["Note: Uses MVVM, ReactiveUI, Avalonia & PanAndZoom"]:::frontend

    %% Relationships - Platform Clients to UI
    Desktop -->|"triggers"| UI
    Browser  -->|"triggers"| UI
    Android  -->|"triggers"| UI
    iOS      -->|"triggers"| UI

    %% Relationships - UI to Core and File Handling
    UI -->|"calls"| Core
    UI -->|"triggers"| File
    Core -->|"invokes"| File

    %% Annotation arrow
    MVVM -.-> UI

    %% Relationships within Infrastructure
    Build -->|"validates"| Test

    %% Click Events
    click Core "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.Core"
    click UI "https://github.com/mrmlik12/note-shr/tree/main/src/NoteSHR"
    click Desktop "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.Desktop"
    click Browser "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.Browser"
    click Android "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.Android"
    click iOS "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.iOS"
    click File "https://github.com/mrmlik12/note-shr/blob/main/src/NoteSHR.File"
    click Build "https://github.com/mrmlik12/note-shr/blob/main/.nuke"
    click Test "https://github.com/mrmlik12/note-shr/blob/main/test/NoteSHR.File.Tests"

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef business fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef persistence fill:#F9E79F,stroke:#F39C12,stroke-width:2px;
    classDef infrastructure fill:#FDEBD0,stroke:#F5B041,stroke-width:2px;
```
