# questo/ratatosk architecture

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

- Interactive diagram: https://gitdiagram.com/questo/ratatosk
- Repository: https://github.com/questo/ratatosk

## Overview

Ratatosk is an event-driven DDD application for authentication, product catalog, inventory, and ordering. Users enter through the minimal API; application services handle commands and queries, domain aggregates represent business state, and infrastructure supplies event storage, snapshots, read models, and event dispatch. The README documents CQRS, event sourcing, snapshotting, and pluggable storage. Some subsystem wiring is unsampled, so the graph omits uncertain calls rather than inferring them from names or folder structure.

Main entry points: [`src/API/Program.cs`](https://github.com/questo/ratatosk/blob/main/src/API/Program.cs) (Minimal API), [`src/Application/Inventoring`](https://github.com/questo/ratatosk/tree/main/src/Application/Inventoring) (Inventory application), [`src/Infrastructure/Persistence/Repositories/AggregateRepository.cs`](https://github.com/questo/ratatosk/blob/main/src/Infrastructure/Persistence/Repositories/AggregateRepository.cs) (Aggregate repository), [`src/Infrastructure/Persistence/ReadModels`](https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/ReadModels) (CQRS read models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API"]
  node_api["Minimal API<br/>[Program.cs]"]
  node_auth_api["Authentication endpoints<br/>[AuthEndpoints.cs]"]
  node_catalog_api["Catalog endpoints"]
  node_inventory_api["Inventory endpoints"]
  node_orders_api["Order endpoints<br/>[OrderEndpoints.cs]"]
end

subgraph group_application["Application"]
  node_auth_app["Authentication application"]
  node_catalog_app["Catalog application"]
  node_inventory_app["Inventory application"]
  node_ordering_app["Ordering application"]
end

subgraph group_domain["Domain"]
  node_catalog_domain["Catalog domain"]
  node_identity_domain["Identity domain"]
  node_inventory_domain["Inventory domain"]
  node_ordering_domain["Ordering domain"]
end

subgraph group_infrastructure["Infrastructure and Core"]
  node_core["DDD building blocks"]
  node_aggregate_repo["Aggregate repository"]
  node_event_store[("Event stores")]
  node_snapshot_store[("Snapshot stores")]
  node_read_models[("CQRS read models")]
  node_projections["Projection registration"]
  node_event_bus["Event bus<br/>[EventBus.cs]"]
  node_storage_options["Storage backends"]
end

node_users(("API clients"))

node_users -->|"send requests"| node_api
node_api -.->|"routes auth"| node_auth_api
node_api -.->|"routes catalog"| node_catalog_api
node_api -.->|"routes inventory"| node_inventory_api
node_api -.->|"routes orders"| node_orders_api
node_auth_api -.->|"handles auth"| node_auth_app
node_catalog_api -.->|"handles catalog"| node_catalog_app
node_inventory_api -.->|"handles inventory"| node_inventory_app
node_orders_api -.->|"handles orders"| node_ordering_app
node_catalog_app -.->|"commands aggregates"| node_catalog_domain
node_inventory_app -->|"commands aggregates"| node_inventory_domain
node_ordering_app -->|"handles orders"| node_ordering_domain
node_catalog_app -->|"queries read models"| node_read_models
node_inventory_app -->|"queries stock"| node_read_models
node_ordering_app -->|"queries orders"| node_read_models
node_inventory_app -->|"loads aggregates"| node_aggregate_repo
node_aggregate_repo -->|"loads and saves events"| node_event_store
node_aggregate_repo -->|"loads snapshots"| node_snapshot_store
node_projections -->|"registers handlers"| node_event_bus
node_event_bus -.->|"updates projections"| node_read_models
node_storage_options -->|"configures backends"| node_event_store
node_core -->|"defines repository contract"| node_aggregate_repo

click node_api "https://github.com/questo/ratatosk/blob/main/src/API/Program.cs"
click node_auth_api "https://github.com/questo/ratatosk/blob/main/src/API/Auth/AuthEndpoints.cs"
click node_catalog_api "https://github.com/questo/ratatosk/blob/main/src/API/Products/ProductsEndpoints.cs"
click node_inventory_api "https://github.com/questo/ratatosk/blob/main/src/API/Inventory/InventoryEndpoints.cs"
click node_orders_api "https://github.com/questo/ratatosk/blob/main/src/API/Orders/OrderEndpoints.cs"
click node_auth_app "https://github.com/questo/ratatosk/tree/main/src/Application/Authentication"
click node_catalog_app "https://github.com/questo/ratatosk/tree/main/src/Application/Catalog"
click node_inventory_app "https://github.com/questo/ratatosk/tree/main/src/Application/Inventoring"
click node_ordering_app "https://github.com/questo/ratatosk/tree/main/src/Application/Ordering"
click node_catalog_domain "https://github.com/questo/ratatosk/tree/main/src/Domain/Catalog"
click node_identity_domain "https://github.com/questo/ratatosk/tree/main/src/Domain/Identity"
click node_inventory_domain "https://github.com/questo/ratatosk/tree/main/src/Domain/Inventoring"
click node_ordering_domain "https://github.com/questo/ratatosk/tree/main/src/Domain/Ordering"
click node_core "https://github.com/questo/ratatosk/tree/main/src/Core"
click node_aggregate_repo "https://github.com/questo/ratatosk/blob/main/src/Infrastructure/Persistence/Repositories/AggregateRepository.cs"
click node_event_store "https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/EventSourcing"
click node_snapshot_store "https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/EventSourcing"
click node_read_models "https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/ReadModels"
click node_projections "https://github.com/questo/ratatosk/blob/main/src/Infrastructure/ProjectionRegistrationService.cs"
click node_event_bus "https://github.com/questo/ratatosk/blob/main/src/Infrastructure/EventBus.cs"
click node_storage_options "https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Configuration"

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_api,node_auth_api,node_catalog_api,node_inventory_api,node_orders_api,node_users toneBlue
class node_auth_app,node_catalog_app,node_inventory_app,node_ordering_app toneAmber
class node_catalog_domain,node_identity_domain,node_inventory_domain,node_ordering_domain toneMint
class node_core,node_aggregate_repo,node_event_store,node_snapshot_store,node_read_models,node_projections,node_event_bus,node_storage_options toneRose
```

## Components

### API

- [Minimal API](https://github.com/questo/ratatosk/blob/main/src/API/Program.cs): `src/API/Program.cs`
- [Authentication endpoints](https://github.com/questo/ratatosk/blob/main/src/API/Auth/AuthEndpoints.cs): `src/API/Auth/AuthEndpoints.cs`
- [Catalog endpoints](https://github.com/questo/ratatosk/blob/main/src/API/Products/ProductsEndpoints.cs): `src/API/Products/ProductsEndpoints.cs`
- [Inventory endpoints](https://github.com/questo/ratatosk/blob/main/src/API/Inventory/InventoryEndpoints.cs): `src/API/Inventory/InventoryEndpoints.cs`
- [Order endpoints](https://github.com/questo/ratatosk/blob/main/src/API/Orders/OrderEndpoints.cs): `src/API/Orders/OrderEndpoints.cs`

### Application

- [Authentication application](https://github.com/questo/ratatosk/tree/main/src/Application/Authentication): `src/Application/Authentication`
- [Catalog application](https://github.com/questo/ratatosk/tree/main/src/Application/Catalog): `src/Application/Catalog`
- [Inventory application](https://github.com/questo/ratatosk/tree/main/src/Application/Inventoring): `src/Application/Inventoring`
- [Ordering application](https://github.com/questo/ratatosk/tree/main/src/Application/Ordering): `src/Application/Ordering`

### Domain

- [Catalog domain](https://github.com/questo/ratatosk/tree/main/src/Domain/Catalog): `src/Domain/Catalog`
- [Identity domain](https://github.com/questo/ratatosk/tree/main/src/Domain/Identity): `src/Domain/Identity`
- [Inventory domain](https://github.com/questo/ratatosk/tree/main/src/Domain/Inventoring): `src/Domain/Inventoring`
- [Ordering domain](https://github.com/questo/ratatosk/tree/main/src/Domain/Ordering): `src/Domain/Ordering`

### Infrastructure and Core

- [DDD building blocks](https://github.com/questo/ratatosk/tree/main/src/Core): `src/Core`
- [Aggregate repository](https://github.com/questo/ratatosk/blob/main/src/Infrastructure/Persistence/Repositories/AggregateRepository.cs): `src/Infrastructure/Persistence/Repositories/AggregateRepository.cs`
- [Event stores](https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/EventSourcing): `src/Infrastructure/Persistence/EventSourcing`
- [Snapshot stores](https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/EventSourcing): `src/Infrastructure/Persistence/EventSourcing`
- [CQRS read models](https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Persistence/ReadModels): `src/Infrastructure/Persistence/ReadModels`
- [Projection registration](https://github.com/questo/ratatosk/blob/main/src/Infrastructure/ProjectionRegistrationService.cs): `src/Infrastructure/ProjectionRegistrationService.cs`
- [Event bus](https://github.com/questo/ratatosk/blob/main/src/Infrastructure/EventBus.cs): `src/Infrastructure/EventBus.cs`
- [Storage backends](https://github.com/questo/ratatosk/tree/main/src/Infrastructure/Configuration): `src/Infrastructure/Configuration`

### Other components

- **API clients**

## Connections

- API clients → Minimal API: send requests (evidence: `README.md`)
- Minimal API → Authentication endpoints: routes auth
- Minimal API → Catalog endpoints: routes catalog
- Minimal API → Inventory endpoints: routes inventory
- Minimal API → Order endpoints: routes orders
- Authentication endpoints → Authentication application: handles auth (evidence: `src/API/Auth/AuthEndpoints.cs`)
- Catalog endpoints → Catalog application: handles catalog (evidence: `src/API/Products/ProductsEndpoints.cs`)
- Inventory endpoints → Inventory application: handles inventory
- Order endpoints → Ordering application: handles orders
- Catalog application → Catalog domain: commands aggregates (evidence: `src/Application/Catalog/Queries/GetProductByIdQuery.cs`)
- Inventory application → Inventory domain: commands aggregates (evidence: `src/Infrastructure/Services/InventoryDomainService.cs`)
- Ordering application → Ordering domain: handles orders (evidence: `src/Application/Ordering/OrderConfirmationHandler.cs`)
- Catalog application → CQRS read models: queries read models (evidence: `src/Application/Catalog/Queries/SearchProductsQuery.cs`)
- Inventory application → CQRS read models: queries stock (evidence: `src/Application/Inventoring/Queries/GetStockByProductIdQuery.cs`)
- Ordering application → CQRS read models: queries orders (evidence: `src/Application/Ordering/Queries/GetOrderByIdQuery.cs`)
- Inventory application → Aggregate repository: loads aggregates
- Aggregate repository → Event stores: loads and saves events (evidence: `src/Infrastructure/Persistence/Repositories/AggregateRepository.cs`)
- Aggregate repository → Snapshot stores: loads snapshots (evidence: `src/Infrastructure/Persistence/Repositories/AggregateRepository.cs`)
- Projection registration → Event bus: registers handlers (evidence: `src/Infrastructure/ProjectionRegistrationService.cs`)
- Event bus → CQRS read models: updates projections
- Storage backends → Event stores: configures backends (evidence: `README.md`)
- DDD building blocks → Aggregate repository: defines repository contract (evidence: `src/Infrastructure/Persistence/Repositories/AggregateRepository.cs`)
