# alchemistlowkey/play.microservices architecture

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

- Interactive diagram: https://gitdiagram.com/alchemistlowkey/play.microservices
- Repository: https://github.com/alchemistlowkey/play.microservices

## Overview

Play Microservices is a .NET microservices sample with a Next.js interface. Users browse and manage catalog items, then view and manage inventory; catalog changes are published as events for Inventory to consume. The graph also shows shared MongoDB repository behavior and the documented RabbitMQ/MongoDB infrastructure. Source excerpts establish controller-to-repository and event-publishing calls; the README documents the broader service and frontend relationships. Some startup wiring and frontend request details are not evidenced in the supplied excerpts, so those links are omitted.

Main entry points: [`Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs`](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs) (Catalog endpoints), [`Play.Common/src/Play.Common/IRepository.cs`](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/IRepository.cs) (Repository interface), [`Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs`](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs) (Inventory endpoints), [`Play.Catalog/src/Play.Catalog.Contracts/Contracts.cs`](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Contracts/Contracts.cs) (Catalog event contracts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_catalog_ui["Catalog UI<br/>[page.js]"]
  node_inventory_ui["Inventory UI<br/>[page.js]"]
  node_catalog_api_client["Catalog API client<br/>[catalogApi.js]"]
  node_inventory_api_client["Inventory API client<br/>[inventoryApi.js]"]
end

subgraph group_catalog["Catalog service"]
  node_catalog_controller["Catalog endpoints<br/>[ItemsController.cs]"]
  node_catalog_item["Catalog item<br/>[Item.cs]"]
  node_catalog_events["Catalog event contracts<br/>[Contracts.cs]"]
end

subgraph group_inventory["Inventory service"]
  node_inventory_controller["Inventory endpoints<br/>[ItemsController.cs]"]
  node_inventory_item["Inventory record<br/>[InventoryItem.cs]"]
  node_catalog_snapshot["Catalog snapshot<br/>[CatalogItem.cs]"]
  node_catalog_client["Catalog HTTP client<br/>[CatalogClient.cs]"]
  node_created_consumer["Created event consumer"]
  node_updated_consumer["Updated event consumer"]
  node_deleted_consumer["Deleted event consumer"]
end

subgraph group_shared["Shared persistence and messaging"]
  node_repository_contract["Repository interface<br/>[IRepository.cs]"]
  node_mongo_repository["Mongo repository<br/>[MongoRepository.cs]"]
  node_entity_contract["Entity interface<br/>[IEntity.cs]"]
  node_mongo_settings["Mongo settings<br/>[MongoDbSettings.cs]"]
  node_rabbit_settings["RabbitMQ settings"]
end

subgraph group_infra["Infrastructure"]
  node_mongodb[("MongoDB")]
  node_rabbitmq["RabbitMQ"]
end

node_user(("User"))

node_user -->|"browses"| node_catalog_ui
node_user -->|"views inventory"| node_inventory_ui
node_catalog_ui -.->|"requests catalog"| node_catalog_api_client
node_inventory_ui -.->|"requests inventory"| node_inventory_api_client
node_catalog_api_client -.->|"calls API"| node_catalog_controller
node_inventory_api_client -.->|"calls API"| node_inventory_controller
node_catalog_controller -->|"reads and writes"| node_repository_contract
node_catalog_controller -->|"creates and updates"| node_catalog_item
node_catalog_controller -->|"publishes changes"| node_catalog_events
node_inventory_controller -->|"reads and writes"| node_repository_contract
node_inventory_controller -->|"manages records"| node_inventory_item
node_inventory_controller -->|"joins catalog details"| node_catalog_snapshot
node_catalog_client -.->|"fetches catalog"| node_catalog_controller
node_created_consumer -->|"handles created"| node_catalog_events
node_updated_consumer -->|"handles updated"| node_catalog_events
node_deleted_consumer -->|"handles deleted"| node_catalog_events
node_created_consumer -->|"updates snapshot"| node_repository_contract
node_updated_consumer -->|"updates snapshot"| node_repository_contract
node_deleted_consumer -->|"removes snapshot"| node_repository_contract
node_repository_contract -->|"implemented by"| node_mongo_repository
node_mongo_repository -->|"requires"| node_entity_contract
node_catalog_controller -->|"publishes events"| node_rabbitmq
node_rabbitmq -->|"delivers events"| node_created_consumer
node_rabbitmq -->|"delivers events"| node_updated_consumer
node_rabbitmq -->|"delivers events"| node_deleted_consumer
node_mongo_repository -->|"persists entities"| node_mongodb

click node_catalog_ui "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/app/catalog/page.js"
click node_inventory_ui "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/app/inventory/page.js"
click node_catalog_api_client "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/lib/catalogApi.js"
click node_inventory_api_client "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/lib/inventoryApi.js"
click node_catalog_controller "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs"
click node_catalog_item "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Service/Entities/Item.cs"
click node_catalog_events "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Contracts/Contracts.cs"
click node_inventory_controller "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs"
click node_inventory_item "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Entities/InventoryItem.cs"
click node_catalog_snapshot "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Entities/CatalogItem.cs"
click node_catalog_client "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Clients/CatalogClient.cs"
click node_created_consumer "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemCreatedConsumer.cs"
click node_updated_consumer "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemUpdatedConsumer.cs"
click node_deleted_consumer "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemDeletedConsumer.cs"
click node_repository_contract "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/IRepository.cs"
click node_mongo_repository "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/MongoDB/MongoRepository.cs"
click node_entity_contract "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/IEntity.cs"
click node_mongo_settings "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs"
click node_rabbit_settings "https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/Settings/RabbitMQSettings.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_ui,node_inventory_ui,node_catalog_api_client,node_inventory_api_client,node_user toneBlue
class node_catalog_controller,node_catalog_item,node_catalog_events toneAmber
class node_inventory_controller,node_inventory_item,node_catalog_snapshot,node_catalog_client,node_created_consumer,node_updated_consumer,node_deleted_consumer toneMint
class node_repository_contract,node_mongo_repository,node_entity_contract,node_mongo_settings,node_rabbit_settings toneRose
class node_mongodb,node_rabbitmq toneIndigo
```

## Components

### Web frontend

- [Catalog UI](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/app/catalog/page.js): `Play.Frontend/play.frontend/app/catalog/page.js`
- [Inventory UI](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/app/inventory/page.js): `Play.Frontend/play.frontend/app/inventory/page.js`
- [Catalog API client](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/lib/catalogApi.js): `Play.Frontend/play.frontend/lib/catalogApi.js`
- [Inventory API client](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Frontend/play.frontend/lib/inventoryApi.js): `Play.Frontend/play.frontend/lib/inventoryApi.js`

### Catalog service

- [Catalog endpoints](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs): `Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs`
- [Catalog item](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Service/Entities/Item.cs): `Play.Catalog/src/Play.Catalog.Service/Entities/Item.cs`
- [Catalog event contracts](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Catalog/src/Play.Catalog.Contracts/Contracts.cs): `Play.Catalog/src/Play.Catalog.Contracts/Contracts.cs`

### Inventory service

- [Inventory endpoints](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs): `Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs`
- [Inventory record](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Entities/InventoryItem.cs): `Play.Inventory/src/Play.Inventory.Service/Entities/InventoryItem.cs`
- [Catalog snapshot](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Entities/CatalogItem.cs): `Play.Inventory/src/Play.Inventory.Service/Entities/CatalogItem.cs`
- [Catalog HTTP client](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Clients/CatalogClient.cs): `Play.Inventory/src/Play.Inventory.Service/Clients/CatalogClient.cs`
- [Created event consumer](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemCreatedConsumer.cs): `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemCreatedConsumer.cs`
- [Updated event consumer](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemUpdatedConsumer.cs): `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemUpdatedConsumer.cs`
- [Deleted event consumer](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemDeletedConsumer.cs): `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemDeletedConsumer.cs`

### Shared persistence and messaging

- [Repository interface](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/IRepository.cs): `Play.Common/src/Play.Common/IRepository.cs`
- [Mongo repository](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/MongoDB/MongoRepository.cs): `Play.Common/src/Play.Common/MongoDB/MongoRepository.cs`
- [Entity interface](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/IEntity.cs): `Play.Common/src/Play.Common/IEntity.cs`
- [Mongo settings](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/Settings/MongoDbSettings.cs): `Play.Common/src/Play.Common/Settings/MongoDbSettings.cs`
- [RabbitMQ settings](https://github.com/alchemistlowkey/play.microservices/blob/main/Play.Common/src/Play.Common/Settings/RabbitMQSettings.cs): `Play.Common/src/Play.Common/Settings/RabbitMQSettings.cs`

### Infrastructure

- **MongoDB**
- **RabbitMQ**

### Other components

- **User**

## Connections

- User → Catalog UI: browses (evidence: `README.md`)
- User → Inventory UI: views inventory (evidence: `README.md`)
- Catalog UI → Catalog API client: requests catalog
- Inventory UI → Inventory API client: requests inventory
- Catalog API client → Catalog endpoints: calls API
- Inventory API client → Inventory endpoints: calls API
- Catalog endpoints → Repository interface: reads and writes (evidence: `Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs`)
- Catalog endpoints → Catalog item: creates and updates (evidence: `Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs`)
- Catalog endpoints → Catalog event contracts: publishes changes (evidence: `Play.Catalog/src/Play.Catalog.Service/Controllers/ItemsController.cs`)
- Inventory endpoints → Repository interface: reads and writes (evidence: `Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs`)
- Inventory endpoints → Inventory record: manages records (evidence: `Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs`)
- Inventory endpoints → Catalog snapshot: joins catalog details (evidence: `Play.Inventory/src/Play.Inventory.Service/Controllers/ItemsController.cs`)
- Catalog HTTP client → Catalog endpoints: fetches catalog
- Created event consumer → Catalog event contracts: handles created (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemCreatedConsumer.cs`)
- Updated event consumer → Catalog event contracts: handles updated (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemUpdatedConsumer.cs`)
- Deleted event consumer → Catalog event contracts: handles deleted (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemDeletedConsumer.cs`)
- Created event consumer → Repository interface: updates snapshot (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemCreatedConsumer.cs`)
- Updated event consumer → Repository interface: updates snapshot (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemUpdatedConsumer.cs`)
- Deleted event consumer → Repository interface: removes snapshot (evidence: `Play.Inventory/src/Play.Inventory.Service/Consumers/CatalogItemDeletedConsumer.cs`)
- Repository interface → Mongo repository: implemented by (evidence: `Play.Common/src/Play.Common/MongoDB/Extension.cs`)
- Mongo repository → Entity interface: requires (evidence: `Play.Common/src/Play.Common/MongoDB/MongoRepository.cs`)
- Catalog endpoints → RabbitMQ: publishes events (evidence: `README.md`)
- RabbitMQ → Created event consumer: delivers events (evidence: `README.md`)
- RabbitMQ → Updated event consumer: delivers events (evidence: `README.md`)
- RabbitMQ → Deleted event consumer: delivers events (evidence: `README.md`)
- Mongo repository → MongoDB: persists entities (evidence: `README.md`)
