# estevao-alves/instally architecture

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

- Interactive diagram: https://gitdiagram.com/estevao-alves/instally
- Repository: https://github.com/estevao-alves/instally

## Overview

##### High-Level Architecture Components

The system follows a client-server architecture with these main components:

a) Frontend (InstallyApp):
- Subcomponents:
- UI Layer (Views, Components, Controls)
- ViewModels Layer (MVVM pattern)
- Services Layer (API communication)

b) Backend (InstallyAPI):
- Major subsystems:
- API Controllers/Endpoints
- Command Layer (CQRS pattern)
- Query Layer
- Data Access Layer

c) External Systems:
- WinGet CLI (show as an external service)
- SQLite Database (show as a persistent storage)

##### Component Relationships

- Frontend → Backend: REST API calls through RestDataService
- Backend → Database: Through Repository pattern
- Frontend → WinGet: Package installation operations
- Command/Query flow in the backend (CQRS pattern)

##### Detailed Component Breakdown

Frontend (InstallyApp):
**┌─ InstallyApp ─────────────────┐**
- ┌─ Views ──────────────────┐  │
- Pages                  │  │
- Components            │  │
- Controls             │  │
- ┘  │
- ┌─ ViewModels ──────────────┐ │
- MainPageViewModel      │ │
- ManageUserViewModel   │ │
- ┘ │
- ┌─ Services ───────────────┐ │
- RestDataService       │ │
- NavigationService    │ │
- ┘ │
- ┘

Backend (InstallyAPI):
**┌─ InstallyAPI ────────────────┐**
- ┌─ Commands ───────────────┐ │
- Collection Commands   │ │
- Package Commands     │ │
- User Commands       │ │
- ┘ │
- ┌─ Queries ────────────────┐│
- Collection Queries    ││
- Package Queries      ││
- User Queries        ││
- ┘│
- ┌─ Repository ──────────┐  │
- AppRepository      │  │
- ┘  │
- ┘

##### Important Details

- CQRS pattern implementation
- Validation pipeline
- Entity relationships
- Authentication flow
- Collection management flow
- Package installation workflow

##### Notes

Annotations for:
- WinGet integration points
- Database access patterns
- Command validation flow
- Collection management features

Remember to indicate the technology stack:
- .NET for both frontend and backend
- Avalonia UI for desktop interface
- SQLite for data persistence
- WinGet CLI integration

This will provide a comprehensive view of how Instally works while maintaining clarity and usefulness for development purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend["Desktop Client"]
        UI["UI Layer"]
        VM["ViewModels Layer"]
        SVC["Services Layer"]
        
        subgraph UIComponents["UI Components"]
            direction TB
            Pages["Pages"]:::ui
            Components["Components"]:::ui
            Controls["Controls"]:::ui
        end
        
        subgraph ViewModels["ViewModels"]
            direction TB
            BaseVM["ViewModelBase"]:::viewmodel
            MainVM["MainPageViewModel"]:::viewmodel
            UserVM["ManageUserViewModel"]:::viewmodel
        end
        
        subgraph Services["Client Services"]
            direction TB
            RestSvc["RestDataService"]:::service
            NavSvc["NavigationService"]:::service
            PkgSvc["Package Service"]:::service
        end
        
        UI --> UIComponents
        UI --> VM
        VM --> SVC
    end
    
    subgraph Backend["InstallyAPI"]
        direction TB
        
        subgraph Commands["Commands Layer"]
            direction TB
            CollCmd["Collection Commands"]:::command
            PkgCmd["Package Commands"]:::command
            UserCmd["User Commands"]:::command
        end
        
        subgraph Queries["Queries Layer"]
            direction TB
            CollQuery["Collection Queries"]:::query
            PkgQuery["Package Queries"]:::query
            UserQuery["User Queries"]:::query
        end
        
        subgraph DataAccess["Data Access Layer"]
            direction TB
            DbContext["ApplicationDbContext"]:::data
            Repo["AppRepository"]:::data
        end
        
        subgraph Entities["Entity Models"]
            direction TB
            BaseEntity["BaseEntity"]:::entity
            CollEntity["CollectionEntity"]:::entity
            PkgEntity["PackageEntity"]:::entity
            UserEntity["UserEntity"]:::entity
        end
        
        subgraph Validation["Validation Pipeline"]
            direction TB
            UserVal["User Validation"]:::validation
            PkgVal["Package Validation"]:::validation
        end
    end
    
    DB[(SQLite DB)]:::database
    WinGet["WinGet CLI"]:::external
    
    SVC --> Commands
    SVC --> Queries
    Commands --> DataAccess
    Queries --> DataAccess
    DataAccess --> DB
    PkgSvc --> WinGet
    
    %% Click Events
    click Pages "https://github.com/estevao-alves/Instally/tree/main/InstallyApp/Views/Pages/"
    click Components "https://github.com/estevao-alves/Instally/tree/main/InstallyApp/Views/Components/"
    click Controls "https://github.com/estevao-alves/Instally/tree/main/InstallyApp/Views/Controls/"
    click BaseVM "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/ViewModels/ViewModelBase.cs"
    click MainVM "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/ViewModels/MainPageViewModel.cs"
    click UserVM "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/Models/ViewModels/ManageUserViewModel.cs"
    click RestSvc "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/Services/RestDataService.cs"
    click NavSvc "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/Services/NavigationService.cs"
    click PkgSvc "https://github.com/estevao-alves/Instally/blob/main/InstallyApp/Services/GetPackages.cs"
    click CollCmd "https://github.com/estevao-alves/Instally/tree/main/InstallyAPI/Commands/CollectionCommands/"
    click PkgCmd "https://github.com/estevao-alves/Instally/tree/main/InstallyAPI/Commands/PackageCommands/"
    click UserCmd "https://github.com/estevao-alves/Instally/tree/main/InstallyAPI/Commands/UserCommands/"
    click CollQuery "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Queries/CollectionQuery.cs"
    click PkgQuery "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Queries/PackageQuery.cs"
    click UserQuery "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Queries/UserQuery.cs"
    click DbContext "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Data/ApplicationDbContext.cs"
    click Repo "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Repository/AppRepository.cs"
    click BaseEntity "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Entities/BaseEntity.cs"
    click CollEntity "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Entities/CollectionEntity.cs"
    click PkgEntity "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Entities/PackageEntity.cs"
    click UserEntity "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Entities/UserEntity.cs"
    click UserVal "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Commands/UserCommands/Pipeline/ValidationBehavior.cs"
    click PkgVal "https://github.com/estevao-alves/Instally/blob/main/InstallyAPI/Commands/PackageCommands/Validators/PackageValidators.cs"
    
    %% Styles
    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef viewmodel fill:#42A5F5,stroke:#1565C0,color:white
    classDef service fill:#64B5F6,stroke:#1565C0,color:white
    classDef command fill:#4CAF50,stroke:#2E7D32,color:white
    classDef query fill:#81C784,stroke:#2E7D32,color:white
    classDef data fill:#A5D6A7,stroke:#2E7D32,color:white
    classDef entity fill:#C8E6C9,stroke:#2E7D32,color:black
    classDef validation fill:#FF5252,stroke:#D32F2F,color:white
    classDef database fill:#9E9E9E,stroke:#616161,color:white
    classDef external fill:#FFC107,stroke:#FFA000,color:black
```
