# khoi-dao/my-first-proud-mocking-project architecture

> Architecture diagram of the GitHub repository khoi-dao/my-first-proud-mocking-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khoi-dao/my-first-proud-mocking-project
- Repository: https://github.com/khoi-dao/my-first-proud-mocking-project

## Overview

This repository implements SmartParking payment capabilities: invoice management and login through an HTTP API, transaction processing, and event-based transaction handling with SignalR notification components. The principal payment path is a client request to the invoice API, through business services and repositories, to SQL-backed invoice and transaction records. A separate user service handles authentication, while a MAUI/Blazor client includes invoice API and auth-state services. The README names RabbitMQ and Loki/Grafana; sampled API startup shows RabbitMQ publishing setup and Loki logging, but not the publish call or consumer-to-hub behavior, so those links are omitted.

Main entry points: [`SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs`](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs) (Payment DbContext), [`SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs`](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs) (Invoice API), [`SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs`](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs) (Invoice repository), [`SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs`](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs) (Generic repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client app"]
  node_clientapp["MAUI web client<br/>[Program.cs]"]
  node_invoiceclient["Invoice API client"]
  node_authstate["Auth state"]
end

subgraph group_api["HTTP services"]
  node_gateway["API gateway<br/>[Program.cs]"]
  node_invoiceapi["Invoice API"]
  node_loginapi["Login API<br/>[LoginController.cs]"]
  node_userapi["User auth service<br/>[AuthController.cs]"]
  node_transactionhost["Transaction service host<br/>[Program.cs]"]
  node_notificationhost["Notification service<br/>[Program.cs]"]
end

subgraph group_logic["Payment logic"]
  node_invoicesvc["Invoice service"]
  node_transactions["Transaction service"]
  node_usersvc["User account service"]
end

subgraph group_data["Persistence"]
  node_invoice_repo["Invoice repository"]
  node_transaction_repo["Transaction repository"]
  node_user_repo["Account repository"]
  node_generic_repo["Generic repository"]
  node_dbcontext["Payment DbContext"]
  node_sql[("SQL Server")]
  node_invoice_model["Invoice entity<br/>[InvoicesKhoiDn.cs]"]
  node_transaction_model["Transaction entity"]
  node_account_model["User account entity"]
end

subgraph group_messaging["Events and observability"]
  node_rabbit["RabbitMQ"]
  node_consumer["Transaction consumer"]
  node_invoice_event["Invoice-created event"]
  node_completed_event["Transaction-completed event"]
  node_signalrconsumer["Completion consumer"]
  node_hub["Notification hub<br/>[NotificationHub.cs]"]
  node_loki[("Loki logging")]
end

node_user(("Payment user"))

node_user -->|"uses"| node_clientapp
node_clientapp -->|"uses"| node_invoiceclient
node_clientapp -->|"registers"| node_authstate
node_invoiceclient -.->|"HTTP requests"| node_gateway
node_gateway -.->|"routes"| node_invoiceapi
node_invoiceapi -->|"delegates to"| node_invoicesvc
node_invoicesvc -->|"reads and writes"| node_invoice_repo
node_transactions -->|"checks and updates"| node_invoice_repo
node_transactions -->|"records payment"| node_transaction_repo
node_transactionhost -->|"registers"| node_consumer
node_consumer -.->|"invokes"| node_transactions
node_loginapi -.->|"delegates to"| node_usersvc
node_userapi -->|"delegates to"| node_usersvc
node_usersvc -->|"authenticates via"| node_user_repo
node_invoice_repo -->|"inherits"| node_generic_repo
node_user_repo -->|"inherits"| node_generic_repo
node_transaction_repo -->|"inherits"| node_generic_repo
node_generic_repo -->|"queries and saves"| node_dbcontext
node_invoice_repo -->|"queries invoices"| node_dbcontext
node_user_repo -->|"queries accounts"| node_dbcontext
node_dbcontext -.->|"persists"| node_sql
node_dbcontext -->|"maps"| node_invoice_model
node_dbcontext -->|"maps"| node_transaction_model
node_dbcontext -->|"maps"| node_account_model
node_invoiceapi -.->|"publishes via setup"| node_rabbit
node_transactionhost -->|"consumes queue"| node_rabbit
node_notificationhost -->|"registers"| node_signalrconsumer
node_signalrconsumer -.->|"handles"| node_completed_event
node_signalrconsumer -.->|"notifies"| node_hub
node_invoice_event -.->|"event type"| node_rabbit
node_completed_event -.->|"event type"| node_rabbit
node_invoiceapi -->|"writes logs"| node_loki
node_transactionhost -->|"writes logs"| node_loki

click node_clientapp "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Web/Program.cs"
click node_invoiceclient "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/InvoiceApiService.cs"
click node_authstate "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/CustomAuthStateProvider.cs"
click node_gateway "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.OcelotAPIGateway.KhoiDN/Program.cs"
click node_invoiceapi "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs"
click node_loginapi "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/LoginController.cs"
click node_userapi "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.User.Microservice.KhoiDN/Controllers/AuthController.cs"
click node_transactionhost "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Transactions.Microservice.KhoiDN/Program.cs"
click node_notificationhost "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Program.cs"
click node_invoicesvc "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/InvoicesKhoiDnService.cs"
click node_transactions "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/TransactionsKhoiDnService.cs"
click node_usersvc "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/SystemUserAccountService.cs"
click node_invoice_repo "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs"
click node_transaction_repo "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/TransactionsKhoiDnRepository.cs"
click node_user_repo "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/SystemUserAccountRepository.cs"
click node_generic_repo "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs"
click node_dbcontext "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs"
click node_invoice_model "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/InvoicesKhoiDn.cs"
click node_transaction_model "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/TransactionsKhoiDn.cs"
click node_account_model "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/SystemUserAccount.cs"
click node_consumer "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Transactions.Microservice.KhoiDN/Consumers/TransactionsKhoiDnConsumer.cs"
click node_invoice_event "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/InvoiceCreatedEvent.cs"
click node_completed_event "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/TransactionCompletedEvent.cs"
click node_signalrconsumer "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Consumers/TransactionCompletedConsumer.cs"
click node_hub "https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Hubs/NotificationHub.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_clientapp,node_invoiceclient,node_authstate,node_user toneBlue
class node_gateway,node_invoiceapi,node_loginapi,node_userapi,node_transactionhost,node_notificationhost toneAmber
class node_invoicesvc,node_transactions,node_usersvc toneMint
class node_invoice_repo,node_transaction_repo,node_user_repo,node_generic_repo,node_dbcontext,node_sql,node_invoice_model,node_transaction_model,node_account_model toneRose
class node_rabbit,node_consumer,node_invoice_event,node_completed_event,node_signalrconsumer,node_hub,node_loki toneIndigo
```

## Components

### Client app

- [MAUI web client](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Web/Program.cs): `SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Web/Program.cs`
- [Invoice API client](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/InvoiceApiService.cs): `SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/InvoiceApiService.cs`
- [Auth state](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/CustomAuthStateProvider.cs): `SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Shared/Services/CustomAuthStateProvider.cs`

### HTTP services

- [API gateway](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.OcelotAPIGateway.KhoiDN/Program.cs): `SmartParking.OcelotAPIGateway.KhoiDN/Program.cs`
- [Invoice API](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs): `SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs`
- [Login API](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/LoginController.cs): `SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/LoginController.cs`
- [User auth service](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.User.Microservice.KhoiDN/Controllers/AuthController.cs): `SmartParking.User.Microservice.KhoiDN/Controllers/AuthController.cs`
- [Transaction service host](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Transactions.Microservice.KhoiDN/Program.cs): `SmartParking.Transactions.Microservice.KhoiDN/Program.cs`
- [Notification service](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Program.cs): `SmartParking.Notification.SignalRService.KhoiDN/Program.cs`

### Payment logic

- [Invoice service](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/InvoicesKhoiDnService.cs): `SU26_PRN232_Payment.Services.KhoiDN/InvoicesKhoiDnService.cs`
- [Transaction service](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/TransactionsKhoiDnService.cs): `SU26_PRN232_Payment.Services.KhoiDN/TransactionsKhoiDnService.cs`
- [User account service](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Services.KhoiDN/SystemUserAccountService.cs): `SU26_PRN232_Payment.Services.KhoiDN/SystemUserAccountService.cs`

### Persistence

- [Invoice repository](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs): `SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs`
- [Transaction repository](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/TransactionsKhoiDnRepository.cs): `SU26_PRN232_Payment.Repositories.KhoiDN/TransactionsKhoiDnRepository.cs`
- [Account repository](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/SystemUserAccountRepository.cs): `SU26_PRN232_Payment.Repositories.KhoiDN/SystemUserAccountRepository.cs`
- [Generic repository](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs): `SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs`
- [Payment DbContext](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs): `SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs`
- **SQL Server**
- [Invoice entity](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/InvoicesKhoiDn.cs): `SU26_PRN232_Payment.Entities.KhoiDN/Models/InvoicesKhoiDn.cs`
- [Transaction entity](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/TransactionsKhoiDn.cs): `SU26_PRN232_Payment.Entities.KhoiDN/Models/TransactionsKhoiDn.cs`
- [User account entity](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SU26_PRN232_Payment.Entities.KhoiDN/Models/SystemUserAccount.cs): `SU26_PRN232_Payment.Entities.KhoiDN/Models/SystemUserAccount.cs`

### Events and observability

- **RabbitMQ**
- [Transaction consumer](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Transactions.Microservice.KhoiDN/Consumers/TransactionsKhoiDnConsumer.cs): `SmartParking.Transactions.Microservice.KhoiDN/Consumers/TransactionsKhoiDnConsumer.cs`
- [Invoice-created event](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/InvoiceCreatedEvent.cs): `SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/InvoiceCreatedEvent.cs`
- [Transaction-completed event](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/TransactionCompletedEvent.cs): `SmartParking.BusinessObject.Shared.Models.KhoiDN/Events/TransactionCompletedEvent.cs`
- [Completion consumer](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Consumers/TransactionCompletedConsumer.cs): `SmartParking.Notification.SignalRService.KhoiDN/Consumers/TransactionCompletedConsumer.cs`
- [Notification hub](https://github.com/khoi-dao/my-first-proud-mocking-project/blob/master/SmartParking.Notification.SignalRService.KhoiDN/Hubs/NotificationHub.cs): `SmartParking.Notification.SignalRService.KhoiDN/Hubs/NotificationHub.cs`
- **Loki logging**

### Other components

- **Payment user**

## Connections

- Payment user → MAUI web client: uses
- MAUI web client → Invoice API client: uses (evidence: `SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Web/Program.cs`)
- MAUI web client → Auth state: registers (evidence: `SmartParking.MAUIHybridWebApp.KhoiDN/SmartParking.MAUIHybridWebApp.KhoiDN.Web/Program.cs`)
- Invoice API client → API gateway: HTTP requests
- API gateway → Invoice API: routes
- Invoice API → Invoice service: delegates to (evidence: `SmartParking_PaymentService.APIWebApp.KhoiDN/Controllers/InvoicesKhoiDnController.cs`)
- Invoice service → Invoice repository: reads and writes (evidence: `SU26_PRN232_Payment.Services.KhoiDN/InvoicesKhoiDnService.cs`)
- Transaction service → Invoice repository: checks and updates (evidence: `SU26_PRN232_Payment.Services.KhoiDN/TransactionsKhoiDnService.cs`)
- Transaction service → Transaction repository: records payment (evidence: `SU26_PRN232_Payment.Services.KhoiDN/TransactionsKhoiDnService.cs`)
- Transaction service host → Transaction consumer: registers (evidence: `SmartParking.Transactions.Microservice.KhoiDN/Program.cs`)
- Transaction consumer → Transaction service: invokes
- Login API → User account service: delegates to
- User auth service → User account service: delegates to (evidence: `SmartParking.User.Microservice.KhoiDN/Controllers/AuthController.cs`)
- User account service → Account repository: authenticates via (evidence: `SU26_PRN232_Payment.Services.KhoiDN/SystemUserAccountService.cs`)
- Invoice repository → Generic repository: inherits (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs`)
- Account repository → Generic repository: inherits (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/SystemUserAccountRepository.cs`)
- Transaction repository → Generic repository: inherits (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/TransactionsKhoiDnRepository.cs`)
- Generic repository → Payment DbContext: queries and saves (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/Base/GenericRepository.cs`)
- Invoice repository → Payment DbContext: queries invoices (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/InvoicesKhoiDnRepository.cs`)
- Account repository → Payment DbContext: queries accounts (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/SystemUserAccountRepository.cs`)
- Payment DbContext → SQL Server: persists
- Payment DbContext → Invoice entity: maps (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs`)
- Payment DbContext → Transaction entity: maps (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs`)
- Payment DbContext → User account entity: maps (evidence: `SU26_PRN232_Payment.Repositories.KhoiDN/DBContext/SmartParking_PaymentServiceContext.cs`)
- Invoice API → RabbitMQ: publishes via setup
- Transaction service host → RabbitMQ: consumes queue (evidence: `SmartParking.Transactions.Microservice.KhoiDN/Program.cs`)
- Notification service → Completion consumer: registers (evidence: `SmartParking.Notification.SignalRService.KhoiDN/Program.cs`)
- Completion consumer → Transaction-completed event: handles (evidence: `SmartParking.Notification.SignalRService.KhoiDN/Consumers/TransactionCompletedConsumer.cs`)
- Completion consumer → Notification hub: notifies (evidence: `SmartParking.Notification.SignalRService.KhoiDN/Consumers/TransactionCompletedConsumer.cs`)
- Invoice-created event → RabbitMQ: event type
- Transaction-completed event → RabbitMQ: event type
- Invoice API → Loki logging: writes logs
- Transaction service host → Loki logging: writes logs (evidence: `SmartParking.Transactions.Microservice.KhoiDN/Program.cs`)
