# learnathon-by-geeky-solutions/earendel architecture

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

- Interactive diagram: https://gitdiagram.com/learnathon-by-geeky-solutions/earendel
- Repository: https://github.com/learnathon-by-geeky-solutions/earendel

## Overview

##### Project Type & Purpose
- This is a full-stack **Interview as a Service** platform, with a **modular monolithic** .NET 8 backend exposing APIs for multiple Angular front-ends (Interviewer, Candidate, Admin, HR).
- It uses **Clean Architecture**, **Domain-Driven Design (DDD)**, **CQRS**, **Event-Driven** patterns and supports **multi-tenancy**.

##### Key Architectural Layers & Components
A. External Clients
- Angular UIs (Interviewer, Candidate, Admin, HR portals)
- Swagger / API testing tools
B. Edge & API Gateway
- NGINX (ingress)
- Aspire API & Service Management
C. Backend Host
- ASP.NET Core Web Host (Api/Server and Aspire.AppHost)
- Framework Core & Infrastructure libraries (cross-cutting concerns: Auth/JWT, Audit, Caching, Logging, HealthChecks, Rate-Limiting, SignalR, Hangfire)
- Shared library (Authorization, Constants, Extensions)
D. Modules (each follows DDD + Clean Arch)
- Candidate, Jobs, Evaluator, Experties, HRView, InterviewerView, Interviews, Notifications, Quizzes – each with
– Domain (entities, events, exceptions)
– Application (commands, queries, handlers, validators)
– Infrastructure (EF Core DbContext, Repositories, Endpoints, Messaging consumers)
E. Data & Persistence
- PostgreSQL (per-tenant or shared schemas)
- EF Core migrations & DbInitializers
F. Messaging & Real-Time
- RabbitMQ (domain events, inter-module messaging)
- SignalR (real-time notifications)
G. Background Processing
- Hangfire (scheduled & fire-and-forget jobs)
H. Caching & External Services
- Redis (distributed caching)
- SMTP / Mail service
- Zoom SDK integration
I. Monitoring & Observability
- Prometheus (metrics scraping)
- Grafana (dashboards)
- Aspire / Serilog (logging)
J. Deployment & Infra
- Docker & docker-compose
- Kubernetes manifests (deployments, services, persistent volumes)

##### Relationships & Data Flows
- UI → HTTP/HTTPS calls → NGINX → ASP.NET Web Host → Module Endpoints →
– Commands → Mediator → Application Handlers → Domain & Infrastructure → PostgreSQL
– Queries → read models → PostgreSQL
- Application Handlers publish DomainEvents → RabbitMQ → subscribed Module Consumers
- Background jobs (Hangfire) enqueue & process tasks via the same host
- Caching layer (Redis) wraps read/write for high-speed lookups
- SignalR pushes notifications (e.g., new assignments, interview status) back to UIs
- Host exports metrics (Prometheus endpoints) → Prometheus scrapes → Grafana visualizes
- Aspire monitors API traffic & service health; logs shipped via Serilog to Aspire

##### Architectural Patterns & Principles
- **Modular Monolith**: modules loaded into one process, clear module boundaries
- **Clean Architecture**: separation into Core, Application, Infrastructure, Presentation
- **DDD**: Entities, Value Objects, Domain Events per module
- **CQRS**: distinct command and query models
- **Event-Driven**: asynchronous messaging via RabbitMQ
- **SOLID**, **Dependency Injection**, **Multi-Tenancy** via tenant middlewares

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Swimlanes
    subgraph "External Clients" 
        direction TB
        UI1["Interviewer Portal"]:::ui
        UI2["Candidate Portal"]:::ui
        UI3["Admin Portal"]:::ui
        UI4["HR Portal"]:::ui
        Swagger["Swagger / API Testing"]:::ui
    end

    subgraph "Edge & API Gateway"
        direction TB
        NGINX["NGINX (Ingress)"]:::gateway
        AspireHost["Aspire API & Service Management"]:::gateway
    end

    subgraph "API Host"
        direction TB
        ASPNETHost["ASP.NET Core Web Host"]:::api
        AspireAppHost["Aspire.AppHost"]:::api
        CoreLib["Framework Core"]:::api
        InfraLib["Framework Infrastructure"]:::api
        SharedLib["Shared Library"]:::api
    end

    subgraph Modules
        direction TB
        subgraph "Candidate Module" 
            Candidate["Candidate"]:::module
        end
        subgraph "Jobs Module" 
            Jobs["Jobs"]:::module
        end
        subgraph "Evaluator Module" 
            Evaluator["Evaluator"]:::module
        end
        subgraph "Experties Module" 
            Experties["Experties"]:::module
        end
        subgraph "HRView Module" 
            HRView["HRView"]:::module
        end
        subgraph "InterviewerView Module" 
            InterviewerView["InterviewerView"]:::module
        end
        subgraph "Interviews Module" 
            Interviews["Interviews"]:::module
        end
        subgraph "Notifications Module" 
            Notifications["Notifications"]:::module
        end
        subgraph "Quizzes Module" 
            Quizzes["Quizzes"]:::module
        end
    end

    subgraph "Data & Persistence"
        direction TB
        Postgres["PostgreSQL 15"]:::db
    end

    subgraph "Messaging & Real-Time"
        direction TB
        RabbitMQ["RabbitMQ"]:::broker
        SignalR["SignalR Hub"]:::realtime
    end

    subgraph "Background Processing"
        direction TB
        Hangfire["Hangfire"]:::background
    end

    subgraph "Caching & External Services"
        direction TB
        Redis["Redis"]:::cache
        SMTP["SMTP Service"]:::external
        Zoom["Zoom SDK"]:::external
    end

    subgraph "Monitoring & Observability"
        direction TB
        Prometheus["Prometheus"]:::monitor
        Grafana["Grafana"]:::monitor
        Serilog["Aspire / Serilog"]:::monitor
    end

    subgraph "Deployment & Infrastructure"
        direction TB
        DockerCompose["Docker & docker-compose"]:::infra
        Kubernetes["Kubernetes Manifests"]:::infra
        CI["CI/CD Workflows"]:::infra
    end

    %% Connections
    UI1 -->|HTTP/HTTPS| NGINX
    UI2 -->|HTTP/HTTPS| NGINX
    UI3 -->|HTTP/HTTPS| NGINX
    UI4 -->|HTTP/HTTPS| NGINX
    Swagger -->|HTTP| NGINX

    NGINX -->|"routes"| ASPNETHost
    AspireHost -->|manages| ASPNETHost

    ASPNETHost --> CoreLib
    ASPNETHost --> InfraLib
    ASPNETHost --> SharedLib
    ASPNETHost --> AspireAppHost

    ASPNETHost -->|Module Endpoints| Candidate
    ASPNETHost --> Jobs
    ASPNETHost --> Evaluator
    ASPNETHost --> Experties
    ASPNETHost --> HRView
    ASPNETHost --> InterviewerView
    ASPNETHost --> Interviews
    ASPNETHost --> Notifications
    ASPNETHost --> Quizzes

    Candidate -->|EF Core| Postgres
    Jobs --> Postgres
    Evaluator --> Postgres
    Experties --> Postgres
    HRView --> Postgres
    InterviewerView --> Postgres
    Interviews --> Postgres
    Notifications --> Postgres
    Quizzes --> Postgres

    InfraLib --> RabbitMQ
    Candidate -->|DomainEvents AMQP| RabbitMQ
    Jobs --> RabbitMQ
    Evaluator --> RabbitMQ
    InfraLib --> SignalR
    SignalR -->|WebSocket| UI1
    SignalR --> UI2
    SignalR --> UI3
    SignalR --> UI4

    InfraLib --> Hangfire
    Hangfire -->|jobs| Candidate
    Hangfire --> Jobs

    InfraLib --> Redis
    CoreLib --> Redis

    CoreLib --> SMTP
    InfraLib --> SMTP

    Interviews --> Zoom

    ASPNETHost -->|/metrics| Prometheus
    Prometheus -->|scrape| ASPNETHost
    Prometheus --> Grafana
    ASPNETHost -->|logs| Serilog
    Serilog --> AspireHost

    DockerCompose --> ASPNETHost
    DockerCompose --> NGINX
    Kubernetes --> DockerCompose
    CI --> DockerCompose
    CI --> Kubernetes

    %% Click Events
    click AspireAppHost "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/Aspire/Aspire.AppHost"
    click DockerCompose "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/docker-compose.yml"
    click Kubernetes "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/menifest/*.yaml"
    click CI "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/.github/workflows/build-and-publish.yml"
    click CI "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/.github/workflows/deploy.yml"
    click ASPNETHost "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Server"
    click CoreLib "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Core"
    click InfraLib "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure"
    click SharedLib "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Shared"
    click Candidate "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Candidate"
    click Jobs "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Jobs"
    click Evaluator "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Evaluator"
    click Experties "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Experties"
    click HRView "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/HRView"
    click InterviewerView "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/InterviewerView"
    click Interviews "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Interviews"
    click Notifications "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Notifications"
    click Quizzes "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Module/Quizzes"
    click Postgres "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Migrations/PGSql"
    click RabbitMQ "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/Messaging"
    click SignalR "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/Api/Framework/Infrastructure/SignalR/NotificationHub.cs"
    click Hangfire "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/Jobs"
    click Redis "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/Caching"
    click SMTP "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Core/Mail"
    click SMTP "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/Api/Framework/Infrastructure/Mail/SmtpMailService.cs"
    click Zoom "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/Api/Module/Interviews/Interviews.Infrastructure/Services/ZoomService.cs"
    click Prometheus "https://github.com/learnathon-by-geeky-solutions/earendel/blob/main/backend/Aspire/Aspire.ServiceDefaults/MetricsConstants.cs"
    click Serilog "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/Logging/Serilog"
    click InfraLib "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/HealthChecks"
    click InfraLib "https://github.com/learnathon-by-geeky-solutions/earendel/tree/main/backend/Api/Framework/Infrastructure/OpenApi"

    %% Styles
    classDef ui fill:#87CEEB,stroke:#333,stroke-width:1px;
    classDef gateway fill:#D3D3D3,stroke:#333,stroke-width:1px;
    classDef api fill:#FA8072,stroke:#333,stroke-width:1px;
    classDef module fill:#9370DB,stroke:#333,stroke-width:1px;
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px;
    classDef broker fill:#A52A2A,stroke:#333,stroke-width:1px;
    classDef realtime fill:#00FA9A,stroke:#333,stroke-width:1px;
    classDef background fill:#FFD700,stroke:#333,stroke-width:1px;
    classDef cache fill:#32CD32,stroke:#333,stroke-width:1px;
    classDef external fill:#DDA0DD,stroke:#333,stroke-width:1px;
    classDef monitor fill:#FFFF66,stroke:#333,stroke-width:1px;
    classDef infra fill:#20B2AA,stroke:#333,stroke-width:1px;
```
