# saeid-ghaderi/ganz architecture

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

- Interactive diagram: https://gitdiagram.com/saeid-ghaderi/ganz
- Repository: https://github.com/saeid-ghaderi/ganz

## Overview

Ganz is an ASP.NET Core product/catalog application organized around Clean Architecture and DDD. The main workflow is a client request to the products API, through application product logic and a repository, to persisted product data, with a paged response returned. Separate branches cover authentication, feature catalogs, Elastic product search, CQRS queries, and gRPC SMS. The README describes the intended layer boundaries; sampled source confirms key product, authentication, persistence, and hosting relationships, but not all integrations or unsampled feature implementations.

Main entry points: [`Ganz.Infrastructure/Data/ApplicationDBContext.cs`](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Data/ApplicationDBContext.cs) (Application database), [`Ganz.API/Controllers/ProductsController.cs`](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/ProductsController.cs) (Products API), [`Ganz.Infrastructure/Persistence/ProductRepository.cs`](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/ProductRepository.cs) (Product repository), [`Ganz.Application/Services/Catalogs/Features/FeatureService.cs`](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/Catalogs/Features/FeatureService.cs) (Feature service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and hosting"]
  node_host["ASP.NET host<br/>[Program.cs]"]
  node_product_api["Products API"]
  node_auth_api["Authentication API"]
  node_feature_api["Feature API"]
  node_elastic_api["Elastic API"]
  node_grpc_api["Notification API"]
end

subgraph group_application["Application workflows"]
  node_product_service["Product service<br/>[ProductService.cs]"]
  node_product_contract["Product service contract<br/>[IProductService.cs]"]
  node_product_dto["Product DTOs"]
  node_cqrs_query["Product query<br/>[GetProductQuery.cs]"]
  node_auth_service["Authentication service"]
  node_feature_service["Feature service<br/>[FeatureService.cs]"]
  node_elastic_service["Elastic service"]
  node_sms_service["SMS gRPC service<br/>[SMSService.cs]"]
end

subgraph group_domain["Domain model"]
  node_product_domain["Product model<br/>[Product.cs]"]
  node_feature_domain["Feature model<br/>[Feature.cs]"]
  node_order_domain["Order model<br/>[Order.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_product_repo["Product repository"]
  node_feature_repo["Feature repository"]
  node_auth_repo["User repository<br/>[UserRepository.cs]"]
  node_db[("Application database")]
  node_elastic_repo["Elastic repository"]
end

node_client(("API client"))

node_client -->|"requests"| node_product_api
node_product_api -->|"calls"| node_product_contract
node_product_service -->|"uses"| node_product_repo
node_product_repo -->|"reads and writes"| node_db
node_product_api -->|"accepts and returns"| node_product_dto
node_host -->|"configures"| node_db
node_host -->|"maps gRPC"| node_sms_service
node_auth_api -->|"uses contract"| node_auth_service
node_auth_service -->|"queries users"| node_auth_repo
node_feature_api -->|"uses"| node_feature_service
node_feature_service -->|"uses"| node_feature_repo
node_elastic_api -->|"uses"| node_elastic_service
node_elastic_service -->|"uses"| node_elastic_repo
node_cqrs_query -->|"queries"| node_product_repo
node_product_repo -->|"loads and stores"| node_product_domain
node_feature_repo -->|"uses context"| node_db
node_auth_repo -.->|"uses context"| node_db
node_feature_service -->|"uses model"| node_feature_domain
node_product_api -.->|"may dispatch"| node_cqrs_query
node_elastic_repo -.->|"indexes product data"| node_db
node_grpc_api -.->|"may notify"| node_sms_service

click node_host "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Program.cs"
click node_product_api "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/ProductsController.cs"
click node_auth_api "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/AuthenticationController.cs"
click node_feature_api "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/Catalogs/Features/FeatureController.cs"
click node_elastic_api "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/Elastic/ProductElasticController.cs"
click node_grpc_api "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/gRPCClient/NotificationController.cs"
click node_product_service "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/ProductService.cs"
click node_product_contract "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Interfaces/IProductService.cs"
click node_product_dto "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Dtos/ProductRequestDTO.cs"
click node_cqrs_query "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/CQRS/ProductCommandQuery/Query/GetProductQuery.cs"
click node_auth_service "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/AuthenticationService.cs"
click node_feature_service "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/Catalogs/Features/FeatureService.cs"
click node_elastic_service "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/Elastic/ProductElasticService.cs"
click node_sms_service "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/SMS-gRPC/SMSService.cs"
click node_product_domain "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Enttiies/Product.cs"
click node_feature_domain "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Catalogs/Features/Feature.cs"
click node_order_domain "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Orders/Order.cs"
click node_product_repo "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/ProductRepository.cs"
click node_feature_repo "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/Catalogs/Features/FeatureRepository.cs"
click node_auth_repo "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/UserRepository.cs"
click node_db "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Data/ApplicationDBContext.cs"
click node_elastic_repo "https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/Elastic/ElasticSearchRepository.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_host,node_product_api,node_auth_api,node_feature_api,node_elastic_api,node_grpc_api,node_client toneBlue
class node_product_service,node_product_contract,node_product_dto,node_cqrs_query,node_auth_service,node_feature_service,node_elastic_service,node_sms_service toneAmber
class node_product_domain,node_feature_domain,node_order_domain toneMint
class node_product_repo,node_feature_repo,node_auth_repo,node_db,node_elastic_repo toneRose
```

## Components

### API and hosting

- [ASP.NET host](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Program.cs): `Ganz.API/Program.cs`
- [Products API](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/ProductsController.cs): `Ganz.API/Controllers/ProductsController.cs`
- [Authentication API](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/AuthenticationController.cs): `Ganz.API/Controllers/AuthenticationController.cs`
- [Feature API](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/Catalogs/Features/FeatureController.cs): `Ganz.API/Controllers/Catalogs/Features/FeatureController.cs`
- [Elastic API](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/Elastic/ProductElasticController.cs): `Ganz.API/Controllers/Elastic/ProductElasticController.cs`
- [Notification API](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.API/Controllers/gRPCClient/NotificationController.cs): `Ganz.API/Controllers/gRPCClient/NotificationController.cs`

### Application workflows

- [Product service](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/ProductService.cs): `Ganz.Application/Services/ProductService.cs`
- [Product service contract](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Interfaces/IProductService.cs): `Ganz.Application/Interfaces/IProductService.cs`
- [Product DTOs](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Dtos/ProductRequestDTO.cs): `Ganz.Application/Dtos/ProductRequestDTO.cs`
- [Product query](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/CQRS/ProductCommandQuery/Query/GetProductQuery.cs): `Ganz.Application/CQRS/ProductCommandQuery/Query/GetProductQuery.cs`
- [Authentication service](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/AuthenticationService.cs): `Ganz.Application/Services/AuthenticationService.cs`
- [Feature service](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/Catalogs/Features/FeatureService.cs): `Ganz.Application/Services/Catalogs/Features/FeatureService.cs`
- [Elastic service](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/Elastic/ProductElasticService.cs): `Ganz.Application/Services/Elastic/ProductElasticService.cs`
- [SMS gRPC service](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Application/Services/SMS-gRPC/SMSService.cs): `Ganz.Application/Services/SMS-gRPC/SMSService.cs`

### Domain model

- [Product model](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Enttiies/Product.cs): `Ganz.Domain/Enttiies/Product.cs`
- [Feature model](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Catalogs/Features/Feature.cs): `Ganz.Domain/Catalogs/Features/Feature.cs`
- [Order model](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Domain/Orders/Order.cs): `Ganz.Domain/Orders/Order.cs`

### Infrastructure

- [Product repository](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/ProductRepository.cs): `Ganz.Infrastructure/Persistence/ProductRepository.cs`
- [Feature repository](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/Catalogs/Features/FeatureRepository.cs): `Ganz.Infrastructure/Persistence/Catalogs/Features/FeatureRepository.cs`
- [User repository](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/UserRepository.cs): `Ganz.Infrastructure/Persistence/UserRepository.cs`
- [Application database](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Data/ApplicationDBContext.cs): `Ganz.Infrastructure/Data/ApplicationDBContext.cs`
- [Elastic repository](https://github.com/saeid-ghaderi/ganz/blob/main/Ganz.Infrastructure/Persistence/Elastic/ElasticSearchRepository.cs): `Ganz.Infrastructure/Persistence/Elastic/ElasticSearchRepository.cs`

### Other components

- **API client**

## Connections

- API client → Products API: requests (evidence: `Ganz.API/Controllers/ProductsController.cs`)
- Products API → Product service contract: calls (evidence: `Ganz.API/Controllers/ProductsController.cs`)
- Product service → Product repository: uses (evidence: `Ganz.Application/Services/ProductService.cs`)
- Product repository → Application database: reads and writes (evidence: `Ganz.Infrastructure/Persistence/ProductRepository.cs`)
- Products API → Product DTOs: accepts and returns (evidence: `Ganz.API/Controllers/ProductsController.cs`)
- ASP.NET host → Application database: configures (evidence: `Ganz.API/Program.cs`)
- ASP.NET host → SMS gRPC service: maps gRPC (evidence: `Ganz.API/Program.cs`)
- Authentication API → Authentication service: uses contract (evidence: `Ganz.API/Controllers/AuthenticationController.cs`)
- Authentication service → User repository: queries users (evidence: `Ganz.Application/Services/AuthenticationService.cs`)
- Feature API → Feature service: uses (evidence: `Ganz.API/Controllers/Catalogs/Features/FeatureController.cs`)
- Feature service → Feature repository: uses (evidence: `Ganz.Application/Services/Catalogs/Features/FeatureService.cs`)
- Elastic API → Elastic service: uses (evidence: `Ganz.API/Controllers/Elastic/ProductElasticController.cs`)
- Elastic service → Elastic repository: uses (evidence: `Ganz.Application/Services/Elastic/ProductElasticService.cs`)
- Product query → Product repository: queries (evidence: `Ganz.Application/CQRS/ProductCommandQuery/Query/GetProductQuery.cs`)
- Product repository → Product model: loads and stores (evidence: `Ganz.Infrastructure/Persistence/ProductRepository.cs`)
- Feature repository → Application database: uses context (evidence: `Ganz.Infrastructure/Persistence/Catalogs/Features/FeatureRepository.cs`)
- User repository → Application database: uses context
- Feature service → Feature model: uses model (evidence: `Ganz.Application/Services/Catalogs/Features/FeatureService.cs`)
- Products API → Product query: may dispatch
- Elastic repository → Application database: indexes product data
- Notification API → SMS gRPC service: may notify
