# lsxprime/aegis architecture

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

- Interactive diagram: https://gitdiagram.com/lsxprime/aegis
- Repository: https://github.com/lsxprime/aegis

## Overview

##### Main Components

a) Client-Side Components:
- Core Licensing Library (Aegis)
- License Manager
- Feature Manager
- Validation System
- Hardware Identification System
- Serialization System

b) Server-Side Components:
- Aegis.Server Core
- ASP.NET Core Implementation
- Database Layer
- Authentication System
- License Management API
- Heartbeat Monitor

**┌─ Client Application Layer**
- Integration Points with Aegis
- Aegis Core Layer
- License Management
- Feature Management
- Validation System
- Communication Layer
- API Endpoints
- Heartbeat System
- Server Layer
- Authentication
- License Management
- Database

##### Component Relationships

- License validation flow
- Feature verification process
- Authentication flow
- Heartbeat communication
- Database interactions

##### Detailed Components

Client Side:
**┌─ Aegis Core**
- LicenseManager
- Load/Validate/Manage Licenses
- FeatureManager
- Feature Control/Access
- LicenseValidator
- Validation Rules
- SecurityUtils
- Encryption/Signatures

Server Side:
**┌─ Aegis.Server**
- Controllers
- Authentication
- Licenses
- Services
- LicenseService
- HeartbeatMonitor
- Data
- AegisDbContext

##### Key Interactions to Highlight

- License Validation Flow:
- Client → License Load → Validation Rules → Server Verification (if online) → Result
- Feature Access Flow:
- Application → FeatureManager → License Check → Access Control
- Concurrent License Flow:
- Client → Server Authentication → License Activation → Heartbeat Loop → Deactivation

##### Additional Elements

Include:
- Version information
- Security measures (encryption, JWT, etc.)
- Database schema overview
- API endpoint summary

##### Implementation Notes

- The modular nature of the system
- Security implementations
- Extensibility points (custom validators, serializers)
- Integration points for client applications

##### Technical Details

- Supported license types
- Validation modes (online/offline)
- Database technology (Entity Framework Core)
- Authentication method (JWT)
- Communication protocols (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#a8d1f0,stroke:#000
    classDef server fill:#90EE90,stroke:#000
    classDef security fill:#FFB6C6,stroke:#000
    classDef communication fill:#FFE4B5,stroke:#000
    classDef database fill:#E6E6FA,stroke:#000

    %% Client Application Layer
    subgraph ClientApp["Client Application Layer"]
        App["Client Application"]
        IntegrationPoint["Integration Points"]
    end

    %% Aegis Core Layer
    subgraph CoreLayer["Aegis Core Layer"]
        CoreLib["Core Licensing Library"]:::client
        LicMgr["License Manager"]:::client
        FeatMgr["Feature Manager"]:::client
        ValSys["Validation System"]:::client
        HardwareID["Hardware ID System"]:::client
        SerialSys["Serialization System"]:::client
    end

    %% Communication Layer
    subgraph CommLayer["Communication Layer"]
        APIEndpoints["API Endpoints"]:::communication
        Heartbeat["Heartbeat System"]:::communication
    end

    %% Server Layer
    subgraph ServerLayer["Server Layer"]
        ServerCore["Aegis Server Core"]:::server
        AspCore["ASP.NET Core Implementation"]:::server
        AuthSystem["Authentication System"]:::security
        LicenseAPI["License Management API"]:::server
        HeartbeatMon["Heartbeat Monitor"]:::server
        DB[(Database)]:::database
    end

    %% Relationships
    App --> IntegrationPoint
    IntegrationPoint --> CoreLib
    CoreLib --> LicMgr
    CoreLib --> FeatMgr
    CoreLib --> ValSys
    CoreLib --> HardwareID
    CoreLib --> SerialSys
    
    LicMgr --> APIEndpoints
    FeatMgr --> APIEndpoints
    ValSys --> APIEndpoints
    
    APIEndpoints --> ServerCore
    Heartbeat --> HeartbeatMon
    
    ServerCore --> AuthSystem
    ServerCore --> LicenseAPI
    ServerCore --> AspCore
    
    LicenseAPI --> DB
    AuthSystem --> DB
    HeartbeatMon --> DB

    %% Click Events
    click CoreLib "https://github.com/LSXPrime/Aegis/tree/master/src/Aegis/"
    click LicMgr "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis/LicenseManager.cs"
    click FeatMgr "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis/FeatureManager.cs"
    click ValSys "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis/LicenseValidator.cs"
    click HardwareID "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis/Utilities/DefaultHardwareIdentifier.cs"
    click SerialSys "https://github.com/LSXPrime/Aegis/tree/master/src/Aegis/Serialization/"
    click ServerCore "https://github.com/LSXPrime/Aegis/tree/master/src/Aegis.Server/"
    click AspCore "https://github.com/LSXPrime/Aegis/tree/master/samples/Aegis.Server.AspNetCore/"
    click DB "https://github.com/LSXPrime/Aegis/tree/master/src/Aegis.Server/Data/"
    click AuthSystem "https://github.com/LSXPrime/Aegis/blob/master/samples/Aegis.Server.AspNetCore/Controllers/AuthenticationController.cs"
    click LicenseAPI "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis.Server/Services/LicenseService.cs"
    click HeartbeatMon "https://github.com/LSXPrime/Aegis/blob/master/src/Aegis.Server/Services/HeartbeatMonitor.cs"

    %% Legend
    subgraph Legend
        Client["Client Components"]:::client
        Server["Server Components"]:::server
        Security["Security Components"]:::security
        Comm["Communication Components"]:::communication
        Data["Database Components"]:::database
    end
```
