# izzatarroyyan12/sharencare architecture

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

- Interactive diagram: https://gitdiagram.com/izzatarroyyan12/sharencare
- Repository: https://github.com/izzatarroyyan12/sharencare

## Overview

##### Project Type and Purpose
- SharenCare is a Windows desktop application (using .NET 7.0 with WPF, as seen from presence of XAML files and .csproj settings) that serves as a donation platform for orphanages in Yogyakarta.
- The README details user flows for login, registration, and the different dashboard experiences for admin versus customer users. In essence, it is a client-side application with clearly defined UI pages and business logic components.

##### Analyzing the File Structure
- At the top level, the main project folder “SharenCare_cs” contains:
– Multiple XAML files and their associated C# code-behind (e.g., AddItemPage.xaml, LoginPage.xaml, CustomerDashPage.xaml, AdminDashPage.xaml, etc.) which represent the primary views/screens.
– A “Classes” folder with domain models (such as AdminUser.cs, User.cs, Item.cs) and possibly utility classes (like Converter.cs). This suggests that the solution is organized in layers (presentation vs. domain models).
- There are also standard build folders (bin, obj) and Visual Studio configuration files, confirming the typical MS solution structure for a WPF full-stack application (client + business logic).

##### Key Components
a. UI/Presentation Layer:
– Pages/Views: HomePage, LoginPage, RegisterPage, AdminDashPage, CustomerDashPage, AddItemPage, ListItemPage, and potentially additional windows (MainWindow, Window1, Window2).
b. Domain/Business Logic Layer:
– Data classes and logic inside the “Classes” folder that include AdminUser, User, and Item. The Converter class might be responsible for data type transformations in the UI.
c. Application Infrastructure:
– The App.xaml and its corresponding code (App.xaml.cs) which likely manages application-wide resources and application startup.
d. Navigation / Flow:
– The README clearly outlines a flow where the application starts with HomePage and then navigates to Login or Register pages, subsequently moving to either AdminDashPage or CustomerDashPage based on user authentication. From CustomerDashPage, additional navigation to AddItemPage and ListItemPage is provided.
e. Dependencies and Framework Configuration:
– The use of .NET 7.0 and WPF (with XAML) needs to be noted, alongside the potential utilization of MVVM (or a similar pattern) if further details in code-behind suggest separation of concerns, even though the implementation seems to use “code-behind” logic.

##### Architectural Patterns and Design Principles
- The overall design appears to adopt a layered or MVVM-like separation: distinct UI views (XAML pages) coupled with underlying business logic (domain classes).
- An emphasis on clear user navigation, segregation of user roles (admin vs. customer), and the separation of visual presentation (XAML) from the business/data model logic (under Classes) is evident.
- While there isn’t an external database explicitly reachable from the file tree, the design might be using in-memory data storage or basic file-based persistence (if any) as no data access layer is clearly delineated.

– The “Entry Point” (App.xaml) connecting to the “MainWindow”.
– From “MainWindow”, layout the HomePage.
– Then, branch off to LoginPage and RegisterPage.
– From LoginPage, branch out to AdminDashPage vs. CustomerDashPage based on user role.
– In parallel, attach the “Classes” layer which holds the business entities and potentially the converter/logic utility.
- Be sure to include interface details (such as button triggers) if needed in a side note for clarity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Infrastructure
    appInit["App Initialization"]:::app
    mainWin["MainWindow"]:::app

    %% UI/Presentation Layer
    home["HomePage"]:::ui
    login["LoginPage"]:::ui
    register["RegisterPage"]:::ui
    adminDash["AdminDashPage"]:::ui
    custDash["CustomerDashPage"]:::ui
    addItem["AddItemPage"]:::ui
    listItem["ListItemPage"]:::ui

    %% Domain/Business Logic Layer
    subgraph "Domain Models"
        adminUser["AdminUser"]:::domain
        userModel["User"]:::domain
        itemModel["Item"]:::domain
        converter["Converter"]:::domain
    end

    %% Navigation Flow
    appInit --> mainWin
    mainWin --> home
    home --> login
    home --> register
    login -->|"if user is admin"| adminDash
    login -->|"if user is customer"| custDash
    register -->|"new registration"| custDash
    custDash -->|"AddItem"| addItem
    custDash -->|"ViewItem"| listItem

    %% Relationship to Domain Models (usage)
    mainWin -.-> adminUser
    mainWin -.-> userModel
    mainWin -.-> itemModel
    mainWin -.-> converter

    %% Click Events
    click appInit "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/App.xaml"
    click mainWin "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/MainWindow.xaml"
    click home "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/HomePage.xaml"
    click login "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/LoginPage.xaml"
    click register "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/RegisterPage.xaml"
    click adminDash "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/AdminDashPage.xaml"
    click custDash "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/CustomerDashPage.xaml"
    click addItem "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/AddItemPage.xaml"
    click listItem "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/ListItemPage.xaml"
    click adminUser "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/Classes/AdminUser.cs"
    click userModel "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/Classes/User.cs"
    click itemModel "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/Classes/Item.cs"
    click converter "https://github.com/izzatarroyyan12/sharencare/blob/main/SharenCare_cs/Classes/Converter.cs"

    %% Styles
    classDef app fill:#AED6F1,stroke:#2980B9,stroke-width:2px;
    classDef ui fill:#C3FDB8,stroke:#0B3B0B,stroke-width:2px;
    classDef domain fill:#FADBD8,stroke:#C0392B,stroke-width:2px;
```
