# miyxotkem/se361_smartedumicroservices architecture

> Architecture diagram of the GitHub repository miyxotkem/se361_smartedumicroservices, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/miyxotkem/se361_smartedumicroservices
- Repository: https://github.com/miyxotkem/se361_smartedumicroservices

## Overview

SmartEdu is a .NET 9 e-learning platform: learners and staff use a WPF client to reach independently deployed services through a YARP gateway. The main commerce workflow starts with course registration, proceeds through payment and the Course service’s enrollment saga, and reports enrollment status in real time. Separate branches support identity, course learning and assignments, exams, comments, notifications, and administration. Shared CQRS behaviors and messaging support service implementation. The README documents integrations and capabilities; sampled source confirms selected wiring, but not every endpoint or event route.

Main entry points: [`ApiGateways/YarpApiGateway/Program.cs`](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/ApiGateways/YarpApiGateway/Program.cs) (YARP gateway), [`Services/Course/Course.API`](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Course/Course.API) (Course service), [`Services/Exam`](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Exam) (Exam service), [`Services/Payment/Payment.API/Controllers/PaymentController.cs`](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Payment/Payment.API/Controllers/PaymentController.cs) (Payment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_wpf["WPF application"]
  node_api["API service client<br/>[ApiService.cs]"]
end

subgraph group_edge["Gateway"]
  node_gateway["YARP gateway<br/>[Program.cs]"]
end

subgraph group_learning["Learning services"]
  node_identity["Identity service<br/>[Identity.API]"]
  node_course["Course service<br/>[Course.API]"]
  node_exam["Exam service"]
  node_comments["Comment service<br/>[Comment.API]"]
  node_notifications["Notification service<br/>[Notification.API]"]
  node_admin["Admin service<br/>[Admin.API]"]
  node_examrepo["Exam repository<br/>[ExamRepository.cs]"]
  node_coursegrpc["Course gRPC"]
  node_identitygrpc["Identity gRPC<br/>[UserGrpcService.cs]"]
end

subgraph group_commerce["Enrollment commerce"]
  node_payment["Payment service"]
  node_saga["Enrollment saga"]
  node_hub["Enrollment hub<br/>[EnrollmentHub.cs]"]
  node_paymentadapters["Payment adapters<br/>[Services]"]
end

subgraph group_platform["Shared platform"]
  node_events["Messaging contracts"]
  node_broker["RabbitMQ"]
  node_behaviors["CQRS behaviors"]
  node_firestore[("Firestore stores")]
  node_paymentdb[("Payment database")]
  node_redis[("Redis state/cache")]
  node_observability["Observability"]
end

node_user(("Learner or staff"))
node_providers["Payment providers"]

node_user -->|"uses"| node_wpf
node_wpf -->|"calls"| node_api
node_api -->|"sends requests"| node_gateway
node_gateway -->|"routes to"| node_identity
node_gateway -->|"routes to"| node_course
node_gateway -->|"routes to"| node_exam
node_gateway -->|"routes to"| node_payment
node_gateway -->|"routes to"| node_comments
node_gateway -->|"routes to"| node_notifications
node_gateway -->|"routes to"| node_admin
node_course -->|"orchestrates"| node_saga
node_saga -->|"coordinates events"| node_broker
node_payment -->|"saves transactions"| node_paymentdb
node_payment -->|"publishes payment events"| node_events
node_payment -->|"uses gateways"| node_paymentadapters
node_paymentadapters -.->|"connects to"| node_providers
node_saga -->|"stores saga state"| node_redis
node_course -->|"serves live status"| node_hub
node_wpf -->|"receives updates"| node_hub
node_notifications -->|"consumes events"| node_broker
node_course -->|"uses messaging"| node_broker
node_exam -->|"uses repository"| node_examrepo
node_exam -->|"calls gRPC"| node_coursegrpc
node_exam -->|"calls gRPC"| node_identitygrpc
node_course -.->|"uses store"| node_firestore
node_examrepo -.->|"uses store"| node_firestore
node_identity -->|"uses pipelines"| node_behaviors
node_exam -->|"uses pipelines"| node_behaviors
node_events -->|"configures transport"| node_broker
node_course -->|"configures telemetry"| node_observability

click node_wpf "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Views"
click node_api "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/ApiService.cs"
click node_gateway "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/ApiGateways/YarpApiGateway/Program.cs"
click node_identity "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Identity/Identity.API"
click node_course "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Course/Course.API"
click node_exam "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Exam"
click node_comments "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Comment/Comment.API"
click node_notifications "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Notification/Notification.API"
click node_admin "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Admin/Admin.API"
click node_payment "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Payment/Payment.API/Controllers/PaymentController.cs"
click node_saga "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Features/Registrations/Sagas/EnrollmentStateMachine.cs"
click node_hub "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Hubs/EnrollmentHub.cs"
click node_paymentadapters "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Payment/Payment.API/Services"
click node_examrepo "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Exam/Exam.Infrastructure/Data/ExamRepository.cs"
click node_coursegrpc "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Services/CourseGrpcService.cs"
click node_identitygrpc "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Identity/Identity.API/Services/UserGrpcService.cs"
click node_events "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/BuildingBlocks/BuildingBlocks.Messaging"
click node_behaviors "https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/BuildingBlocks/BuildingBlocks/Behaviors"
click node_paymentdb "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Payment/Payment.API/Data/PaymentDbContext.cs"
click node_observability "https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/BuildingBlocks/BuildingBlocks/Diagnostics/OpenTelemetryExtensions.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_wpf,node_api toneBlue
class node_gateway toneAmber
class node_identity,node_course,node_exam,node_comments,node_notifications,node_admin,node_examrepo,node_coursegrpc,node_identitygrpc toneMint
class node_payment,node_saga,node_hub,node_paymentadapters toneRose
class node_events,node_broker,node_behaviors,node_firestore,node_paymentdb,node_redis,node_observability,node_user,node_providers toneIndigo
```

## Components

### Desktop client

- [WPF application](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Views): `Views`
- [API service client](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/ApiService.cs): `Services/ApiService.cs`

### Gateway

- [YARP gateway](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/ApiGateways/YarpApiGateway/Program.cs): `ApiGateways/YarpApiGateway/Program.cs`

### Learning services

- [Identity service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Identity/Identity.API): `Services/Identity/Identity.API`
- [Course service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Course/Course.API): `Services/Course/Course.API`
- [Exam service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Exam): `Services/Exam`
- [Comment service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Comment/Comment.API): `Services/Comment/Comment.API`
- [Notification service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Notification/Notification.API): `Services/Notification/Notification.API`
- [Admin service](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Admin/Admin.API): `Services/Admin/Admin.API`
- [Exam repository](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Exam/Exam.Infrastructure/Data/ExamRepository.cs): `Services/Exam/Exam.Infrastructure/Data/ExamRepository.cs`
- [Course gRPC](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Services/CourseGrpcService.cs): `Services/Course/Course.API/Services/CourseGrpcService.cs`
- [Identity gRPC](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Identity/Identity.API/Services/UserGrpcService.cs): `Services/Identity/Identity.API/Services/UserGrpcService.cs`

### Enrollment commerce

- [Payment service](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Payment/Payment.API/Controllers/PaymentController.cs): `Services/Payment/Payment.API/Controllers/PaymentController.cs`
- [Enrollment saga](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Features/Registrations/Sagas/EnrollmentStateMachine.cs): `Services/Course/Course.API/Features/Registrations/Sagas/EnrollmentStateMachine.cs`
- [Enrollment hub](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Course/Course.API/Hubs/EnrollmentHub.cs): `Services/Course/Course.API/Hubs/EnrollmentHub.cs`
- [Payment adapters](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/Services/Payment/Payment.API/Services): `Services/Payment/Payment.API/Services`

### Shared platform

- [Messaging contracts](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/BuildingBlocks/BuildingBlocks.Messaging): `BuildingBlocks/BuildingBlocks.Messaging`
- **RabbitMQ**
- [CQRS behaviors](https://github.com/miyxotkem/se361_smartedumicroservices/tree/main/BuildingBlocks/BuildingBlocks/Behaviors): `BuildingBlocks/BuildingBlocks/Behaviors`
- **Firestore stores**
- [Payment database](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/Services/Payment/Payment.API/Data/PaymentDbContext.cs): `Services/Payment/Payment.API/Data/PaymentDbContext.cs`
- **Redis state/cache**
- [Observability](https://github.com/miyxotkem/se361_smartedumicroservices/blob/main/BuildingBlocks/BuildingBlocks/Diagnostics/OpenTelemetryExtensions.cs): `BuildingBlocks/BuildingBlocks/Diagnostics/OpenTelemetryExtensions.cs`

### Other components

- **Learner or staff**
- **Payment providers**

## Connections

- Learner or staff → WPF application: uses
- WPF application → API service client: calls
- API service client → YARP gateway: sends requests
- YARP gateway → Identity service: routes to
- YARP gateway → Course service: routes to
- YARP gateway → Exam service: routes to
- YARP gateway → Payment service: routes to
- YARP gateway → Comment service: routes to
- YARP gateway → Notification service: routes to
- YARP gateway → Admin service: routes to
- Course service → Enrollment saga: orchestrates (evidence: `Services/Course/Course.API/Program.cs`)
- Enrollment saga → RabbitMQ: coordinates events
- Payment service → Payment database: saves transactions (evidence: `Services/Payment/Payment.API/Controllers/PaymentController.cs`)
- Payment service → Messaging contracts: publishes payment events (evidence: `Services/Payment/Payment.API/Controllers/PaymentController.cs`)
- Payment service → Payment adapters: uses gateways (evidence: `Services/Payment/Payment.API/Controllers/PaymentController.cs`)
- Payment adapters → Payment providers: connects to
- Enrollment saga → Redis state/cache: stores saga state
- Course service → Enrollment hub: serves live status (evidence: `Services/Course/Course.API/Program.cs`)
- WPF application → Enrollment hub: receives updates
- Notification service → RabbitMQ: consumes events
- Course service → RabbitMQ: uses messaging (evidence: `Services/Course/Course.API/Program.cs`)
- Exam service → Exam repository: uses repository (evidence: `Services/Exam/Exam.API/Program.cs`)
- Exam service → Course gRPC: calls gRPC (evidence: `Services/Exam/Exam.API/Program.cs`)
- Exam service → Identity gRPC: calls gRPC (evidence: `Services/Exam/Exam.API/Program.cs`)
- Course service → Firestore stores: uses store
- Exam repository → Firestore stores: uses store
- Identity service → CQRS behaviors: uses pipelines (evidence: `Services/Identity/Identity.API/Program.cs`)
- Exam service → CQRS behaviors: uses pipelines (evidence: `Services/Exam/Exam.API/Program.cs`)
- Messaging contracts → RabbitMQ: configures transport (evidence: `BuildingBlocks/BuildingBlocks.Messaging/MassTransit/Extensions.cs`)
- Course service → Observability: configures telemetry (evidence: `Services/Course/Course.API/Program.cs`)
