# matheus2306/orbis-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/matheus2306/orbis-commerce
- Repository: https://github.com/matheus2306/orbis-commerce

## Overview

Orbis Commerce is an educational .NET backend split into Catalog, Inventory, and Order APIs. Clients use each API independently: Catalog creates and reads products, Inventory manages stock and reservations, and Order creates orders that request stock reservation asynchronously. Creating a catalog product also publishes an event that initializes zero-balance inventory. Orders publish reservation requests, but the README says no consumer or confirmation/rejection flow exists, so orders remain pending. The excerpts establish key service calls and persistence; README-documented links cover broker wiring and capabilities whose implementation was not sampled.

Main entry points: [`src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs`](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs) (Product service), [`src/Services/Order/Orbis.Order.Api/Application/OrderService.cs`](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Application/OrderService.cs) (Order service), [`src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs`](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs) (Reservation service), [`src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs`](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs) (Product endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog"]
  node_catalog_api["Product endpoints"]
  node_catalog_service["Product service<br/>[ProductService.cs]"]
  node_product_model["Product model<br/>[Product.cs]"]
  node_catalog_repository["Product repository"]
  node_catalog_db[("Catalog database")]
  node_catalog_cache["Product read cache"]
end

subgraph group_inventory["Inventory"]
  node_inventory_api["Stock endpoints<br/>[StockEndpoints.cs]"]
  node_inventory_service["Reservation service"]
  node_inventory_consumer["Product event consumer"]
  node_stock_item["Stock item<br/>[StockItem.cs]"]
  node_stock_reservation["Stock reservation"]
  node_inventory_db[("Inventory database")]
end

subgraph group_orders["Orders"]
  node_order_api["Order endpoints<br/>[OrderEndpoints.cs]"]
  node_order_service["Order service<br/>[OrderService.cs]"]
  node_order_model["Order model<br/>[Order.cs]"]
  node_order_db[("Order database<br/>[OrderDbContext.cs]")]
end

subgraph group_messaging["Messaging"]
  node_product_event["ProductCreated event<br/>[ProductCreated.cs]"]
  node_broker["RabbitMQ"]
  node_reservation_event["Reservation request"]
end

node_client(("HTTP client"))
node_redis[("Redis")]

node_client -->|"HTTP requests"| node_catalog_api
node_client -->|"HTTP requests"| node_inventory_api
node_client -->|"HTTP requests"| node_order_api
node_catalog_api -->|"delegates"| node_catalog_service
node_catalog_api -->|"reads through"| node_catalog_cache
node_catalog_service -->|"queries and saves"| node_catalog_repository
node_catalog_service -->|"creates"| node_product_model
node_catalog_repository -->|"persists and reads"| node_catalog_db
node_catalog_cache -->|"caches reads"| node_redis
node_catalog_service -->|"publishes"| node_product_event
node_catalog_service -->|"outbox dispatches"| node_broker
node_broker -->|"delivers event"| node_inventory_consumer
node_inventory_consumer -->|"creates stock"| node_stock_item
node_inventory_api -->|"delegates reservations"| node_inventory_service
node_inventory_service -->|"updates and reads"| node_inventory_db
node_inventory_service -->|"records reservations"| node_stock_reservation
node_order_api -->|"delegates"| node_order_service
node_order_service -->|"creates"| node_order_model
node_order_service -->|"saves and queries"| node_order_db
node_order_service -->|"publishes"| node_reservation_event
node_order_service -->|"outbox dispatches"| node_broker
node_broker -.->|"reservation consumer absent"| node_inventory_service

click node_catalog_api "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs"
click node_catalog_service "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs"
click node_product_model "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Domain/Product.cs"
click node_catalog_repository "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Repositories/ProductRepository.cs"
click node_catalog_db "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Data/CatalogDbContext.cs"
click node_catalog_cache "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Application/CachedProductReader.cs"
click node_product_event "https://github.com/matheus2306/orbis-commerce/blob/main/src/BuildingBlocks/Orbis.Contracts/Events/ProductCreated.cs"
click node_inventory_api "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Endpoints/StockEndpoints.cs"
click node_inventory_service "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs"
click node_inventory_consumer "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Consumers/ProductCreatedCostumer.cs"
click node_stock_item "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Domain/StockItem.cs"
click node_stock_reservation "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Domain/StockReservation.cs"
click node_inventory_db "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Data/InverntoryDbContext.cs"
click node_order_api "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Endpoints/OrderEndpoints.cs"
click node_order_service "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Application/OrderService.cs"
click node_order_model "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Domain/Order.cs"
click node_order_db "https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Data/OrderDbContext.cs"
click node_reservation_event "https://github.com/matheus2306/orbis-commerce/blob/main/src/BuildingBlocks/Orbis.Contracts/Events/StockReservationRequested.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_catalog_api,node_catalog_service,node_product_model,node_catalog_repository,node_catalog_db,node_catalog_cache,node_client toneBlue
class node_inventory_api,node_inventory_service,node_inventory_consumer,node_stock_item,node_stock_reservation,node_inventory_db,node_redis toneAmber
class node_order_api,node_order_service,node_order_model,node_order_db toneMint
class node_product_event,node_broker,node_reservation_event toneRose
```

## Components

### Catalog

- [Product endpoints](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs): `src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs`
- [Product service](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs): `src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs`
- [Product model](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Domain/Product.cs): `src/Services/Catalog/Orbis.Catalog.Api/Domain/Product.cs`
- [Product repository](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Repositories/ProductRepository.cs): `src/Services/Catalog/Orbis.Catalog.Api/Repositories/ProductRepository.cs`
- [Catalog database](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Data/CatalogDbContext.cs): `src/Services/Catalog/Orbis.Catalog.Api/Data/CatalogDbContext.cs`
- [Product read cache](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Catalog/Orbis.Catalog.Api/Application/CachedProductReader.cs): `src/Services/Catalog/Orbis.Catalog.Api/Application/CachedProductReader.cs`

### Inventory

- [Stock endpoints](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Endpoints/StockEndpoints.cs): `src/Services/Inventory/Orbis.Inventory.Api/Endpoints/StockEndpoints.cs`
- [Reservation service](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs): `src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs`
- [Product event consumer](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Consumers/ProductCreatedCostumer.cs): `src/Services/Inventory/Orbis.Inventory.Api/Consumers/ProductCreatedCostumer.cs`
- [Stock item](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Domain/StockItem.cs): `src/Services/Inventory/Orbis.Inventory.Api/Domain/StockItem.cs`
- [Stock reservation](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Domain/StockReservation.cs): `src/Services/Inventory/Orbis.Inventory.Api/Domain/StockReservation.cs`
- [Inventory database](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Inventory/Orbis.Inventory.Api/Data/InverntoryDbContext.cs): `src/Services/Inventory/Orbis.Inventory.Api/Data/InverntoryDbContext.cs`

### Orders

- [Order endpoints](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Endpoints/OrderEndpoints.cs): `src/Services/Order/Orbis.Order.Api/Endpoints/OrderEndpoints.cs`
- [Order service](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Application/OrderService.cs): `src/Services/Order/Orbis.Order.Api/Application/OrderService.cs`
- [Order model](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Domain/Order.cs): `src/Services/Order/Orbis.Order.Api/Domain/Order.cs`
- [Order database](https://github.com/matheus2306/orbis-commerce/blob/main/src/Services/Order/Orbis.Order.Api/Data/OrderDbContext.cs): `src/Services/Order/Orbis.Order.Api/Data/OrderDbContext.cs`

### Messaging

- [ProductCreated event](https://github.com/matheus2306/orbis-commerce/blob/main/src/BuildingBlocks/Orbis.Contracts/Events/ProductCreated.cs): `src/BuildingBlocks/Orbis.Contracts/Events/ProductCreated.cs`
- **RabbitMQ**
- [Reservation request](https://github.com/matheus2306/orbis-commerce/blob/main/src/BuildingBlocks/Orbis.Contracts/Events/StockReservationRequested.cs): `src/BuildingBlocks/Orbis.Contracts/Events/StockReservationRequested.cs`

### Other components

- **HTTP client**
- **Redis**

## Connections

- HTTP client → Product endpoints: HTTP requests (evidence: `README.md`)
- HTTP client → Stock endpoints: HTTP requests (evidence: `README.md`)
- HTTP client → Order endpoints: HTTP requests (evidence: `README.md`)
- Product endpoints → Product service: delegates (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs`)
- Product endpoints → Product read cache: reads through (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Endpoints/ProductEndpoints.cs`)
- Product service → Product repository: queries and saves (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs`)
- Product service → Product model: creates (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs`)
- Product repository → Catalog database: persists and reads (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Repositories/ProductRepository.cs`)
- Product read cache → Redis: caches reads (evidence: `README.md`)
- Product service → ProductCreated event: publishes (evidence: `src/Services/Catalog/Orbis.Catalog.Api/Application/ProductService.cs`)
- Product service → RabbitMQ: outbox dispatches (evidence: `README.md`)
- RabbitMQ → Product event consumer: delivers event (evidence: `README.md`)
- Product event consumer → Stock item: creates stock (evidence: `README.md`)
- Stock endpoints → Reservation service: delegates reservations (evidence: `src/Services/Inventory/Orbis.Inventory.Api/Endpoints/StockEndpoints.cs`)
- Reservation service → Inventory database: updates and reads (evidence: `src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs`)
- Reservation service → Stock reservation: records reservations (evidence: `src/Services/Inventory/Orbis.Inventory.Api/Application/StockReservationService.cs`)
- Order endpoints → Order service: delegates (evidence: `src/Services/Order/Orbis.Order.Api/Endpoints/OrderEndpoints.cs`)
- Order service → Order model: creates (evidence: `src/Services/Order/Orbis.Order.Api/Application/OrderService.cs`)
- Order service → Order database: saves and queries (evidence: `src/Services/Order/Orbis.Order.Api/Application/OrderService.cs`)
- Order service → Reservation request: publishes (evidence: `src/Services/Order/Orbis.Order.Api/Application/OrderService.cs`)
- Order service → RabbitMQ: outbox dispatches (evidence: `README.md`)
- RabbitMQ → Reservation service: reservation consumer absent (evidence: `README.md`)
