# nagavjm/aegispay architecture

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

- Interactive diagram: https://gitdiagram.com/nagavjm/aegispay
- Repository: https://github.com/nagavjm/aegispay

## Overview

AegisPay is a payment and order management platform: users enter through an Angular client and, as intended by the documented architecture, reach APIs for order, payment, inventory, and notification capabilities. The services use separate domain/application/infrastructure layers; the order service also includes saga and outbox/inbox messaging, while payment has a gateway abstraction and inventory has stock reservations. The graph includes major README capabilities, but several cross-service and UI-to-API links are unverified because their wiring was not shown; those are dashed or omitted.

Main entry points: [`src/ApiGateway/AegisPay.API.Gateway/Program.cs`](https://github.com/nagavjm/aegispay/blob/main/src/ApiGateway/AegisPay.API.Gateway/Program.cs) (API gateway), [`src/Frontend/aegispay-web/src/app/app.component.ts`](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/app.component.ts) (Angular application), [`src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs`](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs) (Stock lookup), [`src/Services/Order/AegisPay.Order.API/Program.cs`](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.API/Program.cs) (Order API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer client"]
  node_web["Angular application<br/>[app.component.ts]"]
  node_auth["Demo authentication<br/>[auth.service.ts]"]
  node_http["Auth/correlation interceptor"]
  node_api_client["API client"]
  node_orders_ui["Order screens"]
  node_payments_ui["Payment screens"]
  node_admin_ui["Admin screens<br/>[admin.component.ts]"]
end

subgraph group_edge["API and shared platform"]
  node_gateway["API gateway<br/>[Program.cs]"]
  node_shared["Building blocks<br/>[OutboxInbox.cs]"]
  node_contracts["Integration events"]
  node_observability["Exception handling"]
  node_security["Current user identity"]
end

subgraph group_orders["Order service"]
  node_order_api["Order API<br/>[Program.cs]"]
  node_order_query["Order lookup"]
  node_order_domain["Order model<br/>[Order.cs]"]
  node_order_saga["Order saga handlers"]
  node_order_messaging["Outbox and bus"]
end

subgraph group_payments["Payment service"]
  node_payment_domain["Payment transactions"]
  node_payment_query["Payment lookup"]
  node_payment_gateway["Payment provider adapter"]
end

subgraph group_fulfillment["Inventory and notifications"]
  node_inventory_query["Stock lookup"]
  node_stock_domain["Stock and reservations<br/>[ProductStock.cs]"]
  node_stock_response["Stock response"]
  node_inventory_repo["Inventory persistence"]
  node_inventory_db[("Inventory database context")]
  node_notification["Notification service"]
end

node_user(("Platform user"))
node_provider(("Payment provider"))
node_service_bus["Azure Service Bus"]

node_user -->|"uses"| node_web
node_web -->|"uses"| node_auth
node_http -->|"reads session"| node_auth
node_web -.->|"API requests"| node_gateway
node_gateway -.->|"routes requests"| node_order_api
node_gateway -.->|"routes requests"| node_payment_query
node_gateway -.->|"routes requests"| node_inventory_query
node_order_api -.->|"hosts handlers"| node_order_query
node_order_query -->|"reads through repository"| node_order_domain
node_order_saga -.->|"coordinates events"| node_service_bus
node_order_messaging -.->|"publishes events"| node_service_bus
node_payment_query -->|"reads through repository"| node_payment_domain
node_payment_gateway -.->|"charges/refunds"| node_provider
node_inventory_query -->|"queries stock"| node_inventory_repo
node_inventory_query -->|"maps result"| node_stock_response
node_inventory_repo -->|"reads/writes"| node_inventory_db
node_notification -.->|"consumes events"| node_service_bus
node_service_bus -.->|"carries integration events"| node_contracts

click node_web "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/app.component.ts"
click node_auth "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/auth/auth.service.ts"
click node_http "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/interceptors/auth-correlation.interceptor.ts"
click node_api_client "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/services/aegispay-api.service.ts"
click node_orders_ui "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/orders/orders.component.ts"
click node_payments_ui "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/payments/payments.component.ts"
click node_admin_ui "https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/admin/admin.component.ts"
click node_gateway "https://github.com/nagavjm/aegispay/blob/main/src/ApiGateway/AegisPay.API.Gateway/Program.cs"
click node_shared "https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Abstractions/OutboxInbox.cs"
click node_contracts "https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Contracts/IntegrationEvents.cs"
click node_observability "https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Observability/GlobalExceptionHandler.cs"
click node_security "https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Security/CurrentUserService.cs"
click node_order_api "https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.API/Program.cs"
click node_order_query "https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Application/Orders/GetOrderById/GetOrderByIdQuery.cs"
click node_order_domain "https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Domain/Order.cs"
click node_order_saga "https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Application/Orders/Saga/OrderSagaCommandHandlers.cs"
click node_order_messaging "https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Infrastructure/Messaging/OutboxPublisherWorker.cs"
click node_payment_domain "https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Domain/PaymentTransaction.cs"
click node_payment_query "https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Application/Payments/GetPaymentById/GetPaymentByIdQuery.cs"
click node_payment_gateway "https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Infrastructure/Gateways/SimulatedPaymentGatewayClient.cs"
click node_inventory_query "https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs"
click node_stock_domain "https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Domain/ProductStock.cs"
click node_stock_response "https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Application/Products/ProductStockResponse.cs"
click node_inventory_repo "https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryRepository.cs"
click node_inventory_db "https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryDbContext.cs"
click node_notification "https://github.com/nagavjm/aegispay/blob/main/src/Services/Notification/AegisPay.Notification.Infrastructure/Workers/NotificationDispatcherWorker.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_web,node_auth,node_http,node_api_client,node_orders_ui,node_payments_ui,node_admin_ui,node_user toneBlue
class node_gateway,node_shared,node_contracts,node_observability,node_security toneAmber
class node_order_api,node_order_query,node_order_domain,node_order_saga,node_order_messaging toneMint
class node_payment_domain,node_payment_query,node_payment_gateway toneRose
class node_inventory_query,node_stock_domain,node_stock_response,node_inventory_repo,node_inventory_db,node_notification,node_provider,node_service_bus toneIndigo
```

## Components

### Customer client

- [Angular application](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/app.component.ts): `src/Frontend/aegispay-web/src/app/app.component.ts`
- [Demo authentication](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/auth/auth.service.ts): `src/Frontend/aegispay-web/src/app/core/auth/auth.service.ts`
- [Auth/correlation interceptor](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/interceptors/auth-correlation.interceptor.ts): `src/Frontend/aegispay-web/src/app/core/interceptors/auth-correlation.interceptor.ts`
- [API client](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/core/services/aegispay-api.service.ts): `src/Frontend/aegispay-web/src/app/core/services/aegispay-api.service.ts`
- [Order screens](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/orders/orders.component.ts): `src/Frontend/aegispay-web/src/app/features/orders/orders.component.ts`
- [Payment screens](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/payments/payments.component.ts): `src/Frontend/aegispay-web/src/app/features/payments/payments.component.ts`
- [Admin screens](https://github.com/nagavjm/aegispay/blob/main/src/Frontend/aegispay-web/src/app/features/admin/admin.component.ts): `src/Frontend/aegispay-web/src/app/features/admin/admin.component.ts`

### API and shared platform

- [API gateway](https://github.com/nagavjm/aegispay/blob/main/src/ApiGateway/AegisPay.API.Gateway/Program.cs): `src/ApiGateway/AegisPay.API.Gateway/Program.cs`
- [Building blocks](https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Abstractions/OutboxInbox.cs): `src/BuildingBlocks/Abstractions/OutboxInbox.cs`
- [Integration events](https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Contracts/IntegrationEvents.cs): `src/BuildingBlocks/Contracts/IntegrationEvents.cs`
- [Exception handling](https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Observability/GlobalExceptionHandler.cs): `src/BuildingBlocks/Observability/GlobalExceptionHandler.cs`
- [Current user identity](https://github.com/nagavjm/aegispay/blob/main/src/BuildingBlocks/Security/CurrentUserService.cs): `src/BuildingBlocks/Security/CurrentUserService.cs`

### Order service

- [Order API](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.API/Program.cs): `src/Services/Order/AegisPay.Order.API/Program.cs`
- [Order lookup](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Application/Orders/GetOrderById/GetOrderByIdQuery.cs): `src/Services/Order/AegisPay.Order.Application/Orders/GetOrderById/GetOrderByIdQuery.cs`
- [Order model](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Domain/Order.cs): `src/Services/Order/AegisPay.Order.Domain/Order.cs`
- [Order saga handlers](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Application/Orders/Saga/OrderSagaCommandHandlers.cs): `src/Services/Order/AegisPay.Order.Application/Orders/Saga/OrderSagaCommandHandlers.cs`
- [Outbox and bus](https://github.com/nagavjm/aegispay/blob/main/src/Services/Order/AegisPay.Order.Infrastructure/Messaging/OutboxPublisherWorker.cs): `src/Services/Order/AegisPay.Order.Infrastructure/Messaging/OutboxPublisherWorker.cs`

### Payment service

- [Payment transactions](https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Domain/PaymentTransaction.cs): `src/Services/Payment/AegisPay.Payment.Domain/PaymentTransaction.cs`
- [Payment lookup](https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Application/Payments/GetPaymentById/GetPaymentByIdQuery.cs): `src/Services/Payment/AegisPay.Payment.Application/Payments/GetPaymentById/GetPaymentByIdQuery.cs`
- [Payment provider adapter](https://github.com/nagavjm/aegispay/blob/main/src/Services/Payment/AegisPay.Payment.Infrastructure/Gateways/SimulatedPaymentGatewayClient.cs): `src/Services/Payment/AegisPay.Payment.Infrastructure/Gateways/SimulatedPaymentGatewayClient.cs`

### Inventory and notifications

- [Stock lookup](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs): `src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs`
- [Stock and reservations](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Domain/ProductStock.cs): `src/Services/Inventory/AegisPay.Inventory.Domain/ProductStock.cs`
- [Stock response](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Application/Products/ProductStockResponse.cs): `src/Services/Inventory/AegisPay.Inventory.Application/Products/ProductStockResponse.cs`
- [Inventory persistence](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryRepository.cs): `src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryRepository.cs`
- [Inventory database context](https://github.com/nagavjm/aegispay/blob/main/src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryDbContext.cs): `src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryDbContext.cs`
- [Notification service](https://github.com/nagavjm/aegispay/blob/main/src/Services/Notification/AegisPay.Notification.Infrastructure/Workers/NotificationDispatcherWorker.cs): `src/Services/Notification/AegisPay.Notification.Infrastructure/Workers/NotificationDispatcherWorker.cs`

### Other components

- **Platform user**
- **Payment provider**
- **Azure Service Bus**

## Connections

- Platform user → Angular application: uses
- Angular application → Demo authentication: uses (evidence: `src/Frontend/aegispay-web/src/app/app.component.ts`)
- Auth/correlation interceptor → Demo authentication: reads session (evidence: `src/Frontend/aegispay-web/src/app/core/interceptors/auth-correlation.interceptor.ts`)
- Angular application → API gateway: API requests
- API gateway → Order API: routes requests
- API gateway → Payment lookup: routes requests
- API gateway → Stock lookup: routes requests
- Order API → Order lookup: hosts handlers
- Order lookup → Order model: reads through repository (evidence: `src/Services/Order/AegisPay.Order.Application/Orders/GetOrderById/GetOrderByIdQuery.cs`)
- Order saga handlers → Azure Service Bus: coordinates events
- Outbox and bus → Azure Service Bus: publishes events
- Payment lookup → Payment transactions: reads through repository (evidence: `src/Services/Payment/AegisPay.Payment.Application/Payments/GetPaymentById/GetPaymentByIdQuery.cs`)
- Payment provider adapter → Payment provider: charges/refunds
- Stock lookup → Inventory persistence: queries stock (evidence: `src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs`)
- Stock lookup → Stock response: maps result (evidence: `src/Services/Inventory/AegisPay.Inventory.Application/Products/GetProductStock/GetProductStockQuery.cs`)
- Inventory persistence → Inventory database context: reads/writes (evidence: `src/Services/Inventory/AegisPay.Inventory.Infrastructure/Persistence/InventoryRepository.cs`)
- Notification service → Azure Service Bus: consumes events
- Azure Service Bus → Integration events: carries integration events (evidence: `README.md`)
