# adelmuhammad-23/e-learning-platform architecture

> Architecture diagram of the GitHub repository adelmuhammad-23/e-learning-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adelmuhammad-23/e-learning-platform
- Repository: https://github.com/adelmuhammad-23/e-learning-platform

## Overview

##### Project Type & Purpose
- This is a full-stack web application (“Online Learning Platform”) built with:
– Backend: ASP.NET Core Web API (Clean Architecture)
– Frontend: Angular (separate repo)
– Database: SQL Server
– External services: PayPal, SMTP/email, Cloudinary (for file uploads)
- Purpose: Provide user authentication (students/instructors/admins), course management, quizzes, payments, reviews, notifications.

##### File Structure (Clean Architecture Layers)
- Presentation/API Layer:
– e-learning.API (ASP.NET Core controllers, Program.cs, appsettings, wwwroot uploads)
- Core/Application Layer:
– e-learning.Core (Use-cases, CQRS commands & queries, validation behaviors, mapping profiles, middleware)
- Service Layer:
– e-learning.Services (service interfaces + implementations for business processes like payments, email, course logic)
- Data/Domain Layer:
– e-learning.Data (Entities, DTOs, Enums, Helpers)
- Infrastructure Layer:
– e-learning.infrastructure (EF Core DbContext, Repositories, Migrations, Seeder, ServiceRegistration)
- Testing Layer:
– e-learning.Services.Tests (unit tests covering service logic)

##### README Insights
- Confirms Clean Architecture structure: “API, Core, Data, Infrastructure, Service, Testing.”
- Lists key features (authentication, payments, file uploads, notifications).
- Mentions Docker Compose and deployment targets (Azure, AWS, IIS, Docker).

##### Main Components & Their Interactions
a. Frontend (Angular):
– HTTP(S) calls → Backend API
b. Backend API (ASP.NET Core Web API):
– Controllers (AuthController, CoursesController, etc.)
– Uses MediatR/CQRS to dispatch Commands & Queries into Core
c. Core/Application:
– ValidationBehavior (pipeline), Handlers for Commands/Queries, Mapping profiles
– Emits domain models, returns standardized Responses
d. Service Layer:
– Implements IEmailServices, IPayPalService, ICourseServices, etc.
– Contains business workflows (e.g., purchase flow: charge via PayPal → send confirmation email)
e. Infrastructure:
– EF Core DbContext → SQL Server
– Repositories (implement data access interfaces)
– Migrations manage schema
– Seeder pre-populates roles/users
f. Database:
– SQL Server instance (tables: Users, Courses, Enrollments, Quizzes, Reviews, Payments, Notifications, OTPRequests)
g. External Services:
– PayPal Gateway
– SMTP/Email provider
– Cloudinary (or local Blob storage via wwwroot/uploads)
h. Container Orchestration:
– docker-compose.yml defines API container + SQL Server + other supporting services

##### Architectural Patterns & Principles
- Clean Architecture (layers depend inward)
- CQRS + Mediator Pattern (Commands vs. Queries)
- Repository Pattern & Unit of Work via EF Core
- Dependency Injection across layers (ServiceRegistration in Infrastructure & CoreDependencies in Core)
- Middleware (ErrorHandlerMiddleware) for cross-cutting concerns
- Role-Based Access Control via ASP.NET Core Identity

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend Layer"
        Browser["Angular SPA (Browser)"]:::frontend
    end

    subgraph "Backend"
        subgraph "API Layer"
            Controllers["Controllers"]:::api
            Program["Program & Config"]:::api
            Uploads["Static Uploads"]:::api
        end

        subgraph "Core Layer"
            Behaviors["ValidationBehavior"]:::core
            Features["Commands & Queries"]:::core
            Mapping["Mapping Profiles"]:::core
            Middleware["ErrorHandlerMiddleware"]:::core
            CoreDI["Core Dependencies"]:::core
        end

        subgraph "Service Layer"
            Interfaces["Service Interfaces"]:::svc
            Implementations["Service Implementations"]:::svc
            PayPal["PayPalService"]:::svc
            EmailSvc["EmailServices"]:::svc
            SvcDI["Services DI"]:::svc
        end

        subgraph "Infrastructure Layer"
            DbContext["ApplicationDbContext"]:::infra
            RepoInt["Repository Interfaces"]:::infra
            RepoImpl["Repository Implementations"]:::infra
            Migrations["EF Migrations"]:::infra
            Seeder["Data Seeder"]:::infra
            InfraDI["Infrastructure DI"]:::infra
        end
    end

    DB["SQL Server"]:::db
    PayPalExt["PayPal Gateway"]:::ext
    EmailExt["SMTP/Email Provider"]:::ext
    Cloudinary["File Storage"]:::ext
    DockerComp["Docker Compose"]:::docker

    Browser -->|"HTTP/REST + JWT"| Controllers
    Controllers -->|"Dispatch Command/Query"| Features
    Features -->|"Validate Request"| Behaviors
    Features -->|"Map Models"| Mapping
    Features -->|"Handle Errors"| Middleware
    Features -->|"Invoke Services"| Interfaces
    Interfaces -->Implementations
    Implementations -->|"Use Repositories"| RepoImpl
    RepoImpl --> DbContext
    DbContext --> DB
    Implementations -->|"ProcessPayment"| PayPalExt
    Implementations -->|"SendEmail"| EmailExt
    Implementations -->|"UploadFiles"| Cloudinary

    DockerComp --> Controllers
    DockerComp --> DB

    click Controllers "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.API/Controllers/"
    click Program "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.API/Program.cs"
    click Uploads "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.API/wwwroot/uploads/"
    click Behaviors "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Core/Behaviors/ValidationBehavior.cs"
    click Features "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.Core/Features/"
    click Mapping "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.Core/Mapping/"
    click Middleware "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Core/Middlewares/ErrorHandlerMiddleware.cs"
    click CoreDI "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Core/ModuleCoreDependencies.cs"
    click Interfaces "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.Services/Abstructs/"
    click Implementations "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.Services/Implementations/"
    click PayPal "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Services/Implementations/PayPalService.cs"
    click EmailSvc "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Services/Implementations/EmailServices.cs"
    click SvcDI "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.Services/ModuleServicesDependencies.cs"
    click DbContext "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.infrastructure/Context/ApplicationDbContext.cs"
    click RepoInt "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.infrastructure/Repositories/"
    click RepoImpl "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.infrastructure/Implementation/"
    click Migrations "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.infrastructure/Migrations/"
    click Seeder "https://github.com/adelmuhammad-23/e-learning-platform/tree/master/e-learning.infrastructure/Seeder/"
    click InfraDI "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/e-learning.infrastructure/ServiceRegistration.cs"
    click DockerComp "https://github.com/adelmuhammad-23/e-learning-platform/blob/master/docker-compose.yml"

    classDef frontend fill:#D6EDF7,stroke:#0C7BDC
    classDef api fill:#D6E9FE,stroke:#1194F6
    classDef core fill:#E8F5E9,stroke:#34A853
    classDef svc fill:#FFF8E1,stroke:#F4B400
    classDef infra fill:#F3E5F5,stroke:#AA00FF
    classDef db fill:#C8E6C9,stroke:#2E7D32,shape:cylinder
    classDef ext fill:#ECEFF1,stroke:#607D8B
    classDef docker fill:#F0F0F0,stroke:#333333,stroke-dasharray: 5 5
```
