# sambandhabhattarai/e-gym-app architecture

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

- Interactive diagram: https://gitdiagram.com/sambandhabhattarai/e-gym-app
- Repository: https://github.com/sambandhabhattarai/e-gym-app

## Overview

##### Main Components
- • Application Core & Entry Points:
- The starting point is defined in App.xaml, AppShell.xaml, and MauiProgram.cs.
- Solution file and project file (.csproj) which configure the build and overall project settings.
- • UI Layer (Views):
- All XAML pages under the Views/Pages folder – e.g., LoginPage, HomePage, WorkoutPage, etc.
- Class files associated with these pages (code-behind such as MainPage.xaml.cs, etc.).
- • ViewModel Layer:
- The ViewModels folder features the application’s execution logic and data-binding for the UI (e.g., LoginViewModel, HomePageViewModel, various exercise view models).
- This supports the MVVM (Model-View-ViewModel) pattern.
- • Model & Data Layer:
- Under Views/Classes, you have model definitions (e.g., User, Exercise, NotificationService, WorkoutDatabase, and UserDatabase) which serve as the data layer.
- • Converters:
- The Converters folder contains classes like the BooleanAndConverter used by the UI for data transformations.
- • Platform-Specific Implementations:
- The Platforms directory separates code for Android, iOS, Windows, MacCatalyst, and Tizen.
- Each platform includes its respective initialization files (e.g., MainActivity.cs for Android, AppDelegate.cs for iOS) and resource definitions.
- • Resources:

##### Relationships and Interactions
- • MVVM Pattern:
- That ViewModels interact with the underlying models (e.g., User, Exercise) and services (e.g., NotificationService, database services).
- • Platform Layer:
- That the .NET MAUI framework uses a single shared code base for all platforms, while platform-specific functionalities are abstracted in the Platforms folders.
- • Data Flow:
- How user inputs in the UI layer (pages) are processed by the ViewModels, which then interact with the Models (workout and user databases) to retrieve or store data.
- • Resources and Styling:
- That the UI components reference styles, images, and fonts organized under the Resources folder.

##### Architectural Patterns & Technologies
- • MVVM is the primary design pattern employed.
- • .NET MAUI is the framework that drives cross-platform support.
- • XAML coupled with C# code-behind for UI definitions.
- • Platform abstraction for device-specific implementations.
- • Dependency injection is likely utilized in MauiProgram.cs to manage services.

## Diagram (Mermaid)

```mermaid
graph TD
  %% Application Core & Entry Points
  subgraph "Application Core & Entry Points"
    AC1["App.xaml"]:::core
    AC2["App.xaml.cs"]:::core
    AC3["AppShell.xaml"]:::core
    AC4["AppShell.xaml.cs"]:::core
    AC5["MauiProgram.cs"]:::core
    AC6["Project Config (csproj)"]:::core
    AC7["Solution Config (sln)"]:::core
  end

  %% UI Layer (Views)
  subgraph "UI Layer (Views)"
    UI1["Pages (XAML + Code-behind)"]:::views
    UI2["MainPage (XAML + Code-behind)"]:::views
  end

  %% ViewModel Layer
  subgraph "ViewModel Layer"
    VM1["LoginViewModel.cs"]:::viewmodel
    VM2["HomePageViewModel.cs"]:::viewmodel
    VM3["BackExercisesViewModel.cs"]:::viewmodel
  end

  %% Model & Data Layer
  subgraph "Model & Data Layer"
    MD1["User.cs"]:::model
    MD2["Exercise.cs"]:::model
    MD3["NotificationService.cs"]:::model
    MD4["UserDatabase.cs"]:::model
    MD5["WorkoutDatabase.cs"]:::model
    MD6["EventModel.cs"]:::model
  end

  %% Converters
  subgraph "Converters"
    CV1["BooleanAndConverter.cs"]:::converters
  end

  %% Platform-Specific Implementations
  subgraph "Platform-Specific Implementations"
    P1["Android (MainActivity, MainApplication, Manifest)"]:::platform
    P2["iOS (AppDelegate, Program, Info.plist)"]:::platform
    P3["Windows (App.xaml, Manifest)"]:::platform
    P4["MacCatalyst (AppDelegate, Program, Info.plist)"]:::platform
    P5["Tizen (Main.cs, Manifest)"]:::platform
  end

  %% Resources
  subgraph "Resources"
    R1["Assets & Styles (Icons, Fonts, Images, Colors, Styles)"]:::resources
  end

  %% Relationships
  %% From Application Core to UI Layer and Platforms
  AC5 -->|"starts"| UI1
  AC5 --> P1
  AC5 --> P2
  AC5 --> P3
  AC5 --> P4
  AC5 --> P5

  %% UI Layer to ViewModel Layer (Data Binding)
  UI1 -->|"binds to"| VM1
  UI2 -->|"binds to"| VM1

  %% ViewModel Layer to Model & Data Layer (Business Logic/Data Operations)
  VM1 -->|"fetches/stores"| MD1
  VM1 -->|"accesses"| MD4
  VM1 -->|"triggers"| MD6
  VM2 -->|"updates"| MD5
  VM3 -->|"manages"| MD2
  VM3 -->|"utilizes"| MD3

  %% UI Layer uses Converters and Resources for styling
  UI1 -->|"converts"| CV1
  UI1 --> R1
  UI2 --> R1

  %% Click Events for Application Core & Entry Points
  click AC1 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/App.xaml"
  click AC2 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/App.xaml.cs"
  click AC3 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/AppShell.xaml"
  click AC4 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/AppShell.xaml.cs"
  click AC5 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/MauiProgram.cs"
  click AC6 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/E_GYM_APP.csproj"
  click AC7 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP.sln"

  %% Click Events for UI Layer (Views)
  click UI1 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Views/Pages"
  click UI2 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/MainPage.xaml"
  click UI2 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/MainPage.xaml.cs"

  %% Click Events for ViewModel Layer
  click VM1 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/ViewModels/LoginViewModel.cs"
  click VM2 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/ViewModels/HomePageViewModel.cs"
  click VM3 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/ViewModels/BackExercisesViewModel.cs"

  %% Click Events for Model & Data Layer
  click MD1 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/User.cs"
  click MD2 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/Exercise.cs"
  click MD3 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/NotificationService.cs"
  click MD4 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/UserDatabase.cs"
  click MD5 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/WorkoutDatabase.cs"
  click MD6 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Views/Classes/EventModel.cs"

  %% Click Event for Converters
  click CV1 "https://github.com/sambandhabhattarai/e-gym-app/blob/master/E_GYM_APP/Converters/BooleanAndConverter.cs"

  %% Click Events for Platform-Specific Implementations
  click P1 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Platforms/Android"
  click P2 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Platforms/iOS"
  click P3 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Platforms/Windows"
  click P4 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Platforms/MacCatalyst"
  click P5 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Platforms/Tizen"

  %% Click Event for Resources
  click R1 "https://github.com/sambandhabhattarai/e-gym-app/tree/master/E_GYM_APP/Resources"

  %% Styles
  classDef core fill:#AED6F1,stroke:#343434,stroke-width:2px;
  classDef views fill:#F9E79F,stroke:#343434,stroke-width:2px;
  classDef viewmodel fill:#D5F5E3,stroke:#343434,stroke-width:2px;
  classDef model fill:#FADBD8,stroke:#343434,stroke-width:2px;
  classDef converters fill:#F2D7D5,stroke:#343434,stroke-width:2px;
  classDef platform fill:#D6EAF8,stroke:#343434,stroke-width:2px;
  classDef resources fill:#EBDEF0,stroke:#343434,stroke-width:2px;
```
