# joha546/unity-donors architecture

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

- Interactive diagram: https://gitdiagram.com/joha546/unity-donors
- Repository: https://github.com/joha546/unity-donors

## Overview

##### Main Components Identification

a) Presentation Layer (Frontend)
- MVC Views (located in /Views directory)
- Static content (CSS, JavaScript, Templates)
- Client-side components

b) Application Layer (Backend)
- Controllers (handling business logic)
- Models (data representations)
- Helper Classes

c) Data Layer
- Entity Framework context
- Database tables and relationships
- Data access components

d) External Services
- Email/SMS notification system
- Stripe payment integration

**[Client Layer]**
- ↑↓
**[Web Layer]**
- ↑↓
**[Business Layer]**
- ↑↓
**[Data Access Layer]**
- ↑↓
**[Database]**

##### Component Details

Client Layer:
- Main views: Home, Dashboard, Registration, Finder
- User types: Donors, Seekers, Blood Banks, Hospitals
- Frontend technologies: Bootstrap, jQuery, Custom JS

Web Layer:
- Controllers (AccountsController, BloodBankController, etc.)
- Route configuration
- Authentication/Authorization

Business Layer:
- Model View (MV) classes
- Business logic components
- Helper classes

Data Access Layer:
- Entity Framework context
- Database tables (User, Donor, BloodBank, Request, etc.)
- Data access patterns

##### Key Relationships to Highlight

- User authentication flow
- Blood donation request process
- Donor-Seeker matching system
- Campaign management
- Stock management for blood banks

##### Additional Elements

Specific components:
- Security layer showing authentication
- API endpoints for external communications
- Cache layer if implemented
- Email/SMS notification service
- Payment processing service

##### Specific Implementation Notes

- The MVC architecture pattern
- Entity Framework integration
- Role-based access control
- Blood matching algorithm
- Real-time notification system

##### Technical Details

Database Schema:
- Tables: Users, Donors, BloodBanks, Requests
- Important relationships between entities
- Critical fields for blood donation matching

API Layer:
- REST endpoints
- Controller actions
- Service interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef business fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Client Layer
    subgraph ClientLayer
        Client["Web Browser"]:::frontend
        StaticContent["Static Content"]:::frontend
    end

    %% Web/Presentation Layer
    subgraph PresentationLayer
        Views["Views"]:::frontend
        AccountViews["Account Views"]:::frontend
        BloodBankViews["Blood Bank Views"]:::frontend
        FinderViews["Finder Views"]:::frontend
        DashboardViews["Dashboard Views"]:::frontend
    end

    %% Business Layer
    subgraph BusinessLayer
        Controllers["Controllers"]:::business
        AccountController["Accounts Controller"]:::business
        BloodBankController["Blood Bank Controller"]:::business
        FinderController["Finder Controller"]:::business
        DashboardController["Dashboard Controller"]:::business
        
        Models["Models"]:::business
        UserModel["User Model"]:::business
        BloodBankModel["Blood Bank Model"]:::business
        FinderModel["Finder Model"]:::business
        CampaignModel["Campaign Model"]:::business
        
        Helpers["Helper Classes"]:::business
        FileHelper["File Helper"]:::business
    end

    %% Data Layer
    subgraph DataLayer
        EFContext["Entity Framework Context"]:::data
        Database["Blood Donation Database"]:::data
    end

    %% External Services
    subgraph ExternalServices
        EmailService["Email Service"]:::external
        SMSService["SMS Service"]:::external
        PaymentService["Payment Processing"]:::external
    end

    %% Relationships
    Client --> StaticContent
    Client --> Views
    Views --> Controllers
    Controllers --> Models
    Models --> EFContext
    EFContext --> Database
    Controllers --> ExternalServices

    %% Component Details
    Views --> AccountViews & BloodBankViews & FinderViews & DashboardViews
    Controllers --> AccountController & BloodBankController & FinderController & DashboardController
    Models --> UserModel & BloodBankModel & FinderModel & CampaignModel
    Helpers --> FileHelper

    %% Click Events
    click Views "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Views"
    click StaticContent "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Content"
    click Controllers "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Controllers"
    click Models "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Models"
    click AccountController "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Controllers/AccountsController.cs"
    click BloodBankController "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Controllers/BloodBankController.cs"
    click FinderController "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Controllers/FinderController.cs"
    click DashboardController "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Controllers/DashboardController.cs"
    click UserModel "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Models/UserMV.cs"
    click BloodBankModel "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Models/BloodBankMV.cs"
    click FinderModel "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Models/FinderMV.cs"
    click CampaignModel "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Models/CampaignMV.cs"
    click FileHelper "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/UnityDonors/Helper_Class/FileHelper.cs"
    click EFContext "https://github.com/joha546/Unity-Donors/blob/main//Application/UnityDonors/DatabaseLayer/OnlineBloodDonationModel.edmx"
    click AccountViews "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Views/Accounts"
    click BloodBankViews "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Views/BloodBank"
    click FinderViews "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Views/Finder"
    click DashboardViews "https://github.com/joha546/Unity-Donors/tree/main//Application/UnityDonors/UnityDonors/Views/Dashboard"
```
