# oiasm-system/cnpm507 architecture

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

- Interactive diagram: https://gitdiagram.com/oiasm-system/cnpm507
- Repository: https://github.com/oiasm-system/cnpm507

## Overview

OISM is a multichannel inventory and sales management system. Its principal workflow accepts tenant-scoped order requests, validates products and stock, reserves inventory, and records order and ledger changes; orders can later be confirmed or cancelled. The repository also contains inventory management and history APIs, an admin frontend, and backend utilities for data generation and concurrency runs. AI-assisted replenishment is a documented capability, but no implementation path for it appears in the supplied tree. Some infrastructure and frontend wiring is unsampled, so uncertain links are omitted or marked dashed.

Main entry points: [`backend/src/OISM.Application/Services/OrderService.cs`](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/OrderService.cs) (Order workflow), [`backend/src/OISM.Infrastructure/Repositories`](https://github.com/oiasm-system/cnpm507/tree/main/backend/src/OISM.Infrastructure/Repositories) (Repository adapters), [`backend/oism-backend-tools/data-generator/src/index.ts`](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/data-generator/src/index.ts) (Data generator), [`backend/oism-backend-tools/concurrency-runner/src/index.ts`](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/concurrency-runner/src/index.ts) (Concurrency runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and application"]
  node_orders_api["Orders API"]
  node_inventory_api["Inventory API"]
  node_ledger_api["Ledger API"]
  node_order_service["Order workflow<br/>[OrderService.cs]"]
  node_inventory_service["Inventory workflow"]
  node_ledger_service["Ledger history"]
  node_order_contracts["Order contracts"]
  node_inventory_contracts["Inventory contracts"]
  node_ai_reordering["AI replenishment"]
end

subgraph group_domain["Inventory and orders"]
  node_order_domain["Order model<br/>[Order.cs]"]
  node_order_items["Order items<br/>[OrderItem.cs]"]
  node_inventory_domain["Stock rules<br/>[Inventory.cs]"]
  node_ledger_domain["Movement records<br/>[InventoryLedger.cs]"]
  node_movement_types["Movement types"]
end

subgraph group_infra["Persistence"]
  node_repositories["Repository adapters<br/>[Repositories]"]
  node_database[("Application database<br/>[OismDbContext.cs]")]
end

subgraph group_frontend["Admin frontend"]
  node_admin["Admin dashboard<br/>[App.tsx]"]
  node_api_client["API client<br/>[order-api.ts]"]
end

subgraph group_tools["Backend utilities"]
  node_tool_cli["Shared CLI<br/>[cli.ts]"]
  node_tool_config["Tool configuration<br/>[config.ts]"]
  node_http_client["Tool HTTP client<br/>[http-client.ts]"]
  node_data_generator["Data generator<br/>[index.ts]"]
  node_concurrency_runner["Concurrency runner<br/>[index.ts]"]
end

node_user(("User or operator"))

node_user -->|"submits orders"| node_orders_api
node_orders_api -->|"calls"| node_order_service
node_inventory_api -->|"calls"| node_inventory_service
node_ledger_api -->|"calls"| node_ledger_service
node_order_service -->|"reads and writes"| node_repositories
node_order_service -->|"reserves stock"| node_inventory_domain
node_order_service -->|"creates and changes"| node_order_domain
node_order_service -->|"creates items"| node_order_items
node_order_service -->|"records movements"| node_ledger_domain
node_inventory_domain -.->|"records adjustments"| node_ledger_domain
node_inventory_service -.->|"uses repositories"| node_repositories
node_ledger_service -.->|"uses repositories"| node_repositories
node_repositories -.->|"persists data"| node_database
node_admin -.->|"uses"| node_api_client
node_api_client -.->|"sends requests"| node_orders_api
node_user -.->|"operates"| node_admin
node_data_generator -->|"uses"| node_tool_cli
node_data_generator -->|"uses"| node_tool_config
node_data_generator -->|"sends requests"| node_http_client
node_concurrency_runner -->|"uses"| node_tool_cli
node_concurrency_runner -->|"uses"| node_tool_config
node_concurrency_runner -->|"sends requests"| node_http_client

click node_orders_api "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/OrdersController.cs"
click node_inventory_api "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/InventoryController.cs"
click node_ledger_api "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/InventoryLedgerController.cs"
click node_order_service "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/OrderService.cs"
click node_inventory_service "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/InventoryService.cs"
click node_ledger_service "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/InventoryLedgerService.cs"
click node_order_contracts "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/DTOs/Orders/CreateOrderRequest.cs"
click node_inventory_contracts "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/DTOs/Inventory/AdjustInventoryRequest.cs"
click node_order_domain "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/Order.cs"
click node_order_items "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/OrderItem.cs"
click node_inventory_domain "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/Inventory.cs"
click node_ledger_domain "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/InventoryLedger.cs"
click node_movement_types "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Enums/InventoryMovementType.cs"
click node_repositories "https://github.com/oiasm-system/cnpm507/tree/main/backend/src/OISM.Infrastructure/Repositories"
click node_database "https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Infrastructure/Persistence/OismDbContext.cs"
click node_admin "https://github.com/oiasm-system/cnpm507/blob/main/frontend/apps/admin-dashboard/src/app/App.tsx"
click node_api_client "https://github.com/oiasm-system/cnpm507/blob/main/frontend/packages/api-client/src/order-api.ts"
click node_tool_cli "https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/cli.ts"
click node_tool_config "https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/config.ts"
click node_http_client "https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/http-client.ts"
click node_data_generator "https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/data-generator/src/index.ts"
click node_concurrency_runner "https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/concurrency-runner/src/index.ts"

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_orders_api,node_inventory_api,node_ledger_api,node_order_service,node_inventory_service,node_ledger_service,node_order_contracts,node_inventory_contracts,node_ai_reordering,node_user toneBlue
class node_order_domain,node_order_items,node_inventory_domain,node_ledger_domain,node_movement_types toneAmber
class node_repositories,node_database toneMint
class node_admin,node_api_client toneRose
class node_tool_cli,node_tool_config,node_http_client,node_data_generator,node_concurrency_runner toneIndigo
```

## Components

### API and application

- [Orders API](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/OrdersController.cs): `backend/src/OISM.WebAPI/Controllers/OrdersController.cs`
- [Inventory API](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/InventoryController.cs): `backend/src/OISM.WebAPI/Controllers/InventoryController.cs`
- [Ledger API](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.WebAPI/Controllers/InventoryLedgerController.cs): `backend/src/OISM.WebAPI/Controllers/InventoryLedgerController.cs`
- [Order workflow](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/OrderService.cs): `backend/src/OISM.Application/Services/OrderService.cs`
- [Inventory workflow](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/InventoryService.cs): `backend/src/OISM.Application/Services/InventoryService.cs`
- [Ledger history](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/Services/InventoryLedgerService.cs): `backend/src/OISM.Application/Services/InventoryLedgerService.cs`
- [Order contracts](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/DTOs/Orders/CreateOrderRequest.cs): `backend/src/OISM.Application/DTOs/Orders/CreateOrderRequest.cs`
- [Inventory contracts](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Application/DTOs/Inventory/AdjustInventoryRequest.cs): `backend/src/OISM.Application/DTOs/Inventory/AdjustInventoryRequest.cs`
- **AI replenishment**

### Inventory and orders

- [Order model](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/Order.cs): `backend/src/OISM.Domain/Entities/Order.cs`
- [Order items](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/OrderItem.cs): `backend/src/OISM.Domain/Entities/OrderItem.cs`
- [Stock rules](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/Inventory.cs): `backend/src/OISM.Domain/Entities/Inventory.cs`
- [Movement records](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Entities/InventoryLedger.cs): `backend/src/OISM.Domain/Entities/InventoryLedger.cs`
- [Movement types](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Domain/Enums/InventoryMovementType.cs): `backend/src/OISM.Domain/Enums/InventoryMovementType.cs`

### Persistence

- [Repository adapters](https://github.com/oiasm-system/cnpm507/tree/main/backend/src/OISM.Infrastructure/Repositories): `backend/src/OISM.Infrastructure/Repositories`
- [Application database](https://github.com/oiasm-system/cnpm507/blob/main/backend/src/OISM.Infrastructure/Persistence/OismDbContext.cs): `backend/src/OISM.Infrastructure/Persistence/OismDbContext.cs`

### Admin frontend

- [Admin dashboard](https://github.com/oiasm-system/cnpm507/blob/main/frontend/apps/admin-dashboard/src/app/App.tsx): `frontend/apps/admin-dashboard/src/app/App.tsx`
- [API client](https://github.com/oiasm-system/cnpm507/blob/main/frontend/packages/api-client/src/order-api.ts): `frontend/packages/api-client/src/order-api.ts`

### Backend utilities

- [Shared CLI](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/cli.ts): `backend/oism-backend-tools/shared/cli.ts`
- [Tool configuration](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/config.ts): `backend/oism-backend-tools/shared/config.ts`
- [Tool HTTP client](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/shared/http-client.ts): `backend/oism-backend-tools/shared/http-client.ts`
- [Data generator](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/data-generator/src/index.ts): `backend/oism-backend-tools/data-generator/src/index.ts`
- [Concurrency runner](https://github.com/oiasm-system/cnpm507/blob/main/backend/oism-backend-tools/concurrency-runner/src/index.ts): `backend/oism-backend-tools/concurrency-runner/src/index.ts`

### Other components

- **User or operator**

## Connections

- User or operator → Orders API: submits orders (evidence: `backend/src/OISM.WebAPI/Controllers/OrdersController.cs`)
- Orders API → Order workflow: calls (evidence: `backend/src/OISM.WebAPI/Controllers/OrdersController.cs`)
- Inventory API → Inventory workflow: calls (evidence: `backend/src/OISM.WebAPI/Controllers/InventoryController.cs`)
- Ledger API → Ledger history: calls (evidence: `backend/src/OISM.WebAPI/Controllers/InventoryLedgerController.cs`)
- Order workflow → Repository adapters: reads and writes (evidence: `backend/src/OISM.Application/Services/OrderService.cs`)
- Order workflow → Stock rules: reserves stock (evidence: `backend/src/OISM.Application/Services/OrderService.cs`)
- Order workflow → Order model: creates and changes (evidence: `backend/src/OISM.Application/Services/OrderService.cs`)
- Order workflow → Order items: creates items (evidence: `backend/src/OISM.Application/Services/OrderService.cs`)
- Order workflow → Movement records: records movements (evidence: `backend/src/OISM.Application/Services/OrderService.cs`)
- Stock rules → Movement records: records adjustments
- Inventory workflow → Repository adapters: uses repositories
- Ledger history → Repository adapters: uses repositories
- Repository adapters → Application database: persists data
- Admin dashboard → API client: uses
- API client → Orders API: sends requests (evidence: `README.md`)
- User or operator → Admin dashboard: operates (evidence: `README.md`)
- Data generator → Shared CLI: uses (evidence: `backend/oism-backend-tools/data-generator/src/index.ts`)
- Data generator → Tool configuration: uses (evidence: `backend/oism-backend-tools/data-generator/src/index.ts`)
- Data generator → Tool HTTP client: sends requests (evidence: `backend/oism-backend-tools/data-generator/src/index.ts`)
- Concurrency runner → Shared CLI: uses (evidence: `backend/oism-backend-tools/concurrency-runner/src/index.ts`)
- Concurrency runner → Tool configuration: uses (evidence: `backend/oism-backend-tools/concurrency-runner/src/index.ts`)
- Concurrency runner → Tool HTTP client: sends requests (evidence: `backend/oism-backend-tools/concurrency-runner/src/index.ts`)
