How thanhthuan173/ordersystem works
This repository implements an order-processing application with a client and separate Orders, Inventory, and Payments services. The main domain workflow is order creation, stock reservation, payment processing, and order status updates via events; the services also expose queries and inventory adjustment. Shared event contracts and Pulsar messaging support cross-service coordination. Several consumer, publisher, and client integration details are unsampled, so those links are shown only as unverified where useful.
Main entry points: Messaging Pulsar messaging · OrderService.cs Order workflow · InventoryService.cs Stock and reservations · PaymentService.cs Payment processing
Components 20
Client
- Order UI
client/Pages/PlaceOrder.razor.cs - Dashboard
client/Pages/Dashboard.razor.cs - Orders API client
client/Services/OrdersApiClient.cs - Inventory API client
client/Services/InventoryApiClient.cs
Order Service
- Orders endpoints
src/Orders/Controllers/OrdersController.cs - Order workflow
src/Orders/Services/OrderService.cs - Order state store
src/Orders/Data/OrdersDbContext.cs - Order event consumers
src/Orders/Messaging
Inventory Service
- Inventory endpoints
src/Inventory/Controllers/InventoryController.cs - Stock and reservations
src/Inventory/Services/InventoryService.cs - Inventory state store
src/Inventory/Data/InventoryDbContext.cs - Inventory event consumers
src/Inventory/Messaging
Payments Service
- Payment endpoints
src/Payments/Controllers/PaymentsController.cs - Payment processing
src/Payments/Services/PaymentService.cs - Payment state store
src/Payments/Data/PaymentsDbContext.cs - Payment event consumer
src/Payments/Messaging/ReservationSucceededConsumer.cs
Events and Messaging
- Domain event contracts
src/Contracts/Events - Pulsar messaging
src/Messaging
Other components
- Shopper
- Pulsar broker
Connections 25
- Shopper → Order UI: places order
- Order UI → Orders API client: submits order
- Dashboard → Orders API client: loads order data
- Dashboard → Inventory API client: loads stock data
- Orders API client → Orders endpoints: calls API
- Inventory API client → Inventory endpoints: calls API
- Orders endpoints → Order workflow: delegates
src/Orders/Controllers/OrdersController.cs - Order workflow → Order state store: reads and writes
src/Orders/Services/OrderService.cs - Order workflow → Domain event contracts: creates and handles
src/Orders/Services/OrderService.cs - Order event consumers → Order workflow: delegates events
src/Orders/Messaging/ReservationFailedConsumer.cs - Inventory endpoints → Stock and reservations: delegates
src/Inventory/Controllers/InventoryController.cs - Stock and reservations → Inventory state store: reads and writes
src/Inventory/Services/InventoryService.cs - Stock and reservations → Domain event contracts: handles and creates
src/Inventory/Services/InventoryService.cs - Inventory event consumers → Stock and reservations: delegates events
src/Inventory/Messaging/OrderPlacedConsumer.cs - Payment endpoints → Payment processing: delegates
src/Payments/Controllers/PaymentsController.cs - Payment processing → Payment state store: reads and writes
src/Payments/Services/PaymentService.cs - Payment processing → Domain event contracts: handles and creates
src/Payments/Services/PaymentService.cs - Payment event consumer → Payment processing: delegates events
- Order event consumers → Pulsar messaging: receives events
- Inventory event consumers → Pulsar messaging: receives events
- Payment event consumer → Pulsar messaging: receives events
- Pulsar messaging → Pulsar broker: exchanges messages
- Pulsar messaging → Order event consumers: dispatches events
- Pulsar messaging → Inventory event consumers: dispatches events
- Pulsar messaging → Payment event consumer: dispatches events