# shahdfares/elamalfurniture architecture

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

- Interactive diagram: https://gitdiagram.com/shahdfares/elamalfurniture
- Repository: https://github.com/shahdfares/elamalfurniture

## Overview

ElAmal is a product-catalog API. A client requests categories or filtered/product-detail data; controllers delegate to application services, which query repositories and return mapped DTOs. Product listing applies specifications and pagination, while persistence is backed by an EF Core context. The graph also retains category handling, catalog relationships, and startup-registered database initialization. Evidence is strongest for the excerpted controllers, services, mapping, context, and registration; unexcerpted runtime wiring is omitted where the source index does not establish a relationship.

Main entry points: [`ElAmal.Application/Services/products/ProductServices.cs`](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Application/Services/products/ProductServices.cs) (Product queries), [`ElAmal.Core/Helper/MappingProfile.cs`](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Helper/MappingProfile.cs) (DTO mapping), [`ElAmal.Infrastructure/Data/ElAmalDbContext.cs`](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/ElAmalDbContext.cs) (EF Core context), [`ElAmal/Extensions/ApplicationServicesExtension.cs`](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Extensions/ApplicationServicesExtension.cs) (Service registration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_product_api["Product endpoints"]
  node_category_api["Category endpoints"]
  node_api_response["API responses<br/>[ApiResponse.cs]"]
  node_exception_middleware["Exception handling"]
end

subgraph group_application["Application Services"]
  node_product_service["Product queries<br/>[ProductServices.cs]"]
  node_category_service["Category queries"]
  node_mapping["DTO mapping<br/>[MappingProfile.cs]"]
  node_product_contract["Product service contract"]
  node_category_contract["Category service contract"]
  node_service_registration["Service registration"]
end

subgraph group_domain["Catalog Domain"]
  node_product_specs["Product specifications"]
  node_spec_params["Filter parameters"]
  node_pagination["Paginated results<br/>[Pagenation.cs]"]
  node_product_entity["Product entity<br/>[Product.cs]"]
  node_category_entity["Category entity<br/>[ProductCategory.cs]"]
  node_image_entity["Product images<br/>[ProductImages.cs]"]
  node_technical_entity["Technical specifications"]
  node_product_dto["Product response DTO"]
  node_category_dto["Category response DTO"]
end

subgraph group_persistence["Persistence"]
  node_unit_of_work["Unit of work<br/>[UnitOfWork.cs]"]
  node_repository["Generic repository"]
  node_db_context["EF Core context<br/>[ElAmalDbContext.cs]"]
  node_database[("Catalog database")]
  node_initializer["Context initializer"]
end

node_client(("API client"))

node_client -->|"requests"| node_product_api
node_client -->|"requests"| node_category_api
node_product_api -->|"delegates"| node_product_service
node_category_api -->|"delegates"| node_category_service
node_product_api -->|"returns errors"| node_api_response
node_category_api -->|"returns errors"| node_api_response
node_product_service -->|"builds queries"| node_product_specs
node_product_service -->|"uses filters"| node_spec_params
node_product_service -->|"queries repositories"| node_unit_of_work
node_product_service -->|"maps results"| node_mapping
node_product_service -->|"returns page"| node_pagination
node_category_service -->|"queries repository"| node_unit_of_work
node_category_service -->|"maps results"| node_mapping
node_mapping -->|"maps from"| node_product_entity
node_mapping -->|"maps from"| node_category_entity
node_mapping -->|"maps from"| node_image_entity
node_mapping -->|"maps from"| node_technical_entity
node_mapping -->|"maps to"| node_product_dto
node_mapping -->|"maps to"| node_category_dto
node_product_api -->|"depends on"| node_product_contract
node_category_api -->|"depends on"| node_category_contract
node_product_service -->|"implements"| node_product_contract
node_category_service -->|"implements"| node_category_contract
node_unit_of_work -.->|"provides repositories"| node_repository
node_repository -->|"queries"| node_db_context
node_db_context -.->|"reads and writes"| node_database
node_db_context -->|"models"| node_product_entity
node_db_context -->|"models"| node_category_entity
node_db_context -->|"models"| node_image_entity
node_db_context -->|"models"| node_technical_entity
node_service_registration -->|"registers"| node_db_context
node_service_registration -->|"registers"| node_unit_of_work
node_service_registration -->|"registers"| node_initializer
node_service_registration -->|"registers"| node_product_service
node_service_registration -->|"registers"| node_category_service

click node_product_api "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Controllers/ProductController.cs"
click node_category_api "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Controllers/CategoryController.cs"
click node_api_response "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/Errors/ApiResponse.cs"
click node_exception_middleware "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/Middleware/ExeptionMiddleware.cs"
click node_product_service "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Application/Services/products/ProductServices.cs"
click node_category_service "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Application/Services/Category/CategoryServices.cs"
click node_mapping "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Helper/MappingProfile.cs"
click node_product_contract "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Contract/Services/Products/IProductServices.cs"
click node_category_contract "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Contract/Services/Category/ICategoryServices.cs"
click node_product_specs "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Specifications/ProductSpecs/ProductWithCategorySpecification.cs"
click node_spec_params "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Specifications/ProductSpecs/ProductSpecParams.cs"
click node_pagination "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Helper/Pagenation.cs"
click node_product_entity "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Product.cs"
click node_category_entity "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Category/ProductCategory.cs"
click node_image_entity "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Images/ProductImages.cs"
click node_technical_entity "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/TechnicalSpecifications/ProductTechnicalSpecification.cs"
click node_product_dto "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/DTOs/Product/ProductToReturnDto.cs"
click node_category_dto "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/DTOs/Category/CategoryResponseDto.cs"
click node_unit_of_work "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/UnitOfWork.cs"
click node_repository "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/Repository/GenericRepository.cs"
click node_db_context "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/ElAmalDbContext.cs"
click node_initializer "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/ElAmalContextInitializer.cs"
click node_service_registration "https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Extensions/ApplicationServicesExtension.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_product_api,node_category_api,node_api_response,node_exception_middleware,node_client toneBlue
class node_product_service,node_category_service,node_mapping,node_product_contract,node_category_contract,node_service_registration toneAmber
class node_product_specs,node_spec_params,node_pagination,node_product_entity,node_category_entity,node_image_entity,node_technical_entity,node_product_dto,node_category_dto toneMint
class node_unit_of_work,node_repository,node_db_context,node_database,node_initializer toneRose
```

## Components

### HTTP API

- [Product endpoints](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Controllers/ProductController.cs): `ElAmal/Controllers/ProductController.cs`
- [Category endpoints](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Controllers/CategoryController.cs): `ElAmal/Controllers/CategoryController.cs`
- [API responses](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/Errors/ApiResponse.cs): `ElAmal.Shared/Errors/ApiResponse.cs`
- [Exception handling](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/Middleware/ExeptionMiddleware.cs): `ElAmal.Shared/Middleware/ExeptionMiddleware.cs`

### Application Services

- [Product queries](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Application/Services/products/ProductServices.cs): `ElAmal.Application/Services/products/ProductServices.cs`
- [Category queries](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Application/Services/Category/CategoryServices.cs): `ElAmal.Application/Services/Category/CategoryServices.cs`
- [DTO mapping](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Helper/MappingProfile.cs): `ElAmal.Core/Helper/MappingProfile.cs`
- [Product service contract](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Contract/Services/Products/IProductServices.cs): `ElAmal.Core/Contract/Services/Products/IProductServices.cs`
- [Category service contract](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Contract/Services/Category/ICategoryServices.cs): `ElAmal.Core/Contract/Services/Category/ICategoryServices.cs`
- [Service registration](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal/Extensions/ApplicationServicesExtension.cs): `ElAmal/Extensions/ApplicationServicesExtension.cs`

### Catalog Domain

- [Product specifications](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Specifications/ProductSpecs/ProductWithCategorySpecification.cs): `ElAmal.Core/Specifications/ProductSpecs/ProductWithCategorySpecification.cs`
- [Filter parameters](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Specifications/ProductSpecs/ProductSpecParams.cs): `ElAmal.Core/Specifications/ProductSpecs/ProductSpecParams.cs`
- [Paginated results](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Helper/Pagenation.cs): `ElAmal.Core/Helper/Pagenation.cs`
- [Product entity](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Product.cs): `ElAmal.Core/Entities/Products/Product.cs`
- [Category entity](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Category/ProductCategory.cs): `ElAmal.Core/Entities/Products/Category/ProductCategory.cs`
- [Product images](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/Images/ProductImages.cs): `ElAmal.Core/Entities/Products/Images/ProductImages.cs`
- [Technical specifications](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Core/Entities/Products/TechnicalSpecifications/ProductTechnicalSpecification.cs): `ElAmal.Core/Entities/Products/TechnicalSpecifications/ProductTechnicalSpecification.cs`
- [Product response DTO](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/DTOs/Product/ProductToReturnDto.cs): `ElAmal.Shared/DTOs/Product/ProductToReturnDto.cs`
- [Category response DTO](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Shared/DTOs/Category/CategoryResponseDto.cs): `ElAmal.Shared/DTOs/Category/CategoryResponseDto.cs`

### Persistence

- [Unit of work](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/UnitOfWork.cs): `ElAmal.Infrastructure/Data/UnitOfWork.cs`
- [Generic repository](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/Repository/GenericRepository.cs): `ElAmal.Infrastructure/Data/Repository/GenericRepository.cs`
- [EF Core context](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/ElAmalDbContext.cs): `ElAmal.Infrastructure/Data/ElAmalDbContext.cs`
- **Catalog database**
- [Context initializer](https://github.com/shahdfares/elamalfurniture/blob/master/ElAmal.Infrastructure/Data/ElAmalContextInitializer.cs): `ElAmal.Infrastructure/Data/ElAmalContextInitializer.cs`

### Other components

- **API client**

## Connections

- API client → Product endpoints: requests
- API client → Category endpoints: requests
- Product endpoints → Product queries: delegates (evidence: `ElAmal/Controllers/ProductController.cs`)
- Category endpoints → Category queries: delegates (evidence: `ElAmal/Controllers/CategoryController.cs`)
- Product endpoints → API responses: returns errors (evidence: `ElAmal/Controllers/ProductController.cs`)
- Category endpoints → API responses: returns errors (evidence: `ElAmal/Controllers/CategoryController.cs`)
- Product queries → Product specifications: builds queries (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Product queries → Filter parameters: uses filters (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Product queries → Unit of work: queries repositories (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Product queries → DTO mapping: maps results (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Product queries → Paginated results: returns page (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Category queries → Unit of work: queries repository (evidence: `ElAmal.Application/Services/Category/CategoryServices.cs`)
- Category queries → DTO mapping: maps results (evidence: `ElAmal.Application/Services/Category/CategoryServices.cs`)
- DTO mapping → Product entity: maps from (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- DTO mapping → Category entity: maps from (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- DTO mapping → Product images: maps from (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- DTO mapping → Technical specifications: maps from (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- DTO mapping → Product response DTO: maps to (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- DTO mapping → Category response DTO: maps to (evidence: `ElAmal.Core/Helper/MappingProfile.cs`)
- Product endpoints → Product service contract: depends on (evidence: `ElAmal/Controllers/ProductController.cs`)
- Category endpoints → Category service contract: depends on (evidence: `ElAmal/Controllers/CategoryController.cs`)
- Product queries → Product service contract: implements (evidence: `ElAmal.Application/Services/products/ProductServices.cs`)
- Category queries → Category service contract: implements (evidence: `ElAmal.Application/Services/Category/CategoryServices.cs`)
- Unit of work → Generic repository: provides repositories
- Generic repository → EF Core context: queries (evidence: `ElAmal.Infrastructure/Data/Repository/GenericRepository.cs`)
- EF Core context → Catalog database: reads and writes
- EF Core context → Product entity: models (evidence: `ElAmal.Infrastructure/Data/ElAmalDbContext.cs`)
- EF Core context → Category entity: models (evidence: `ElAmal.Infrastructure/Data/ElAmalDbContext.cs`)
- EF Core context → Product images: models (evidence: `ElAmal.Infrastructure/Data/ElAmalDbContext.cs`)
- EF Core context → Technical specifications: models (evidence: `ElAmal.Infrastructure/Data/ElAmalDbContext.cs`)
- Service registration → EF Core context: registers (evidence: `ElAmal/Extensions/ApplicationServicesExtension.cs`)
- Service registration → Unit of work: registers (evidence: `ElAmal/Extensions/ApplicationServicesExtension.cs`)
- Service registration → Context initializer: registers (evidence: `ElAmal/Extensions/ApplicationServicesExtension.cs`)
- Service registration → Product queries: registers (evidence: `ElAmal/Extensions/ApplicationServicesExtension.cs`)
- Service registration → Category queries: registers (evidence: `ElAmal/Extensions/ApplicationServicesExtension.cs`)
