# abdulrahman-elnabawi/ordrer-api architecture

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

- Interactive diagram: https://gitdiagram.com/abdulrahman-elnabawi/ordrer-api
- Repository: https://github.com/abdulrahman-elnabawi/ordrer-api

## Overview

This repository is the service-layer and domain core for an order-management REST API. Its principal documented workflow is creating and retrieving orders; the sampled implementation builds an order from a basket, persists it, and removes the basket. Product browsing, basket management, payment-intent handling, and JWT-based user authentication are additional capabilities. The tree contains no controllers or hosting entry point, so the graph starts at service operations rather than claiming a specific HTTP route. Some subsystem connections are supported only by the SOURCE INDEX.

Main entry points: [`Services/Services/OrderService/OrderService.cs`](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/OrderService/OrderService.cs) (Order service), [`Services/Services/BasketService/BasketService.cs`](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/BasketService/BasketService.cs) (Basket service), [`Services/Services/ProductService/ProductService.cs`](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/ProductService/ProductService.cs) (Product service), [`Services/Services/PaymentService/PaymentService.cs`](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/PaymentService/PaymentService.cs) (Payment service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_catalog["Catalog and domain"]
  node_product_service["Product service<br/>[ProductService.cs]"]
  node_catalog_model["Catalog entities<br/>[Product.cs]"]
  node_pagination["Pagination<br/>[Pagination.cs]"]
end

subgraph group_commerce["Basket and ordering"]
  node_basket_service["Basket service<br/>[BasketService.cs]"]
  node_basket_model["Basket data<br/>[CustomerBasket.cs]"]
  node_basket_repo["Basket repository"]
  node_order_service["Order service<br/>[OrderService.cs]"]
  node_order_model["Order entities<br/>[Order.cs]"]
  node_order_dto["Order result DTO<br/>[OrderResultDto.cs]"]
  node_payment_service["Payment service<br/>[PaymentService.cs]"]
end

subgraph group_persistence["Persistence"]
  node_unit_of_work["Unit of work<br/>[UnitOfWork.cs]"]
  node_generic_repo["Generic repository"]
  node_product_repo["Product repository"]
  node_specifications["Query specifications<br/>[ISpecifications.cs]"]
  node_store_context[("Store database context<br/>[StoreDbContext.cs]")]
end

subgraph group_identity["Identity and services"]
  node_user_service["User service<br/>[UserService.cs]"]
  node_token_service["Token service<br/>[TokenService.cs]"]
  node_user_model["Application user<br/>[AppUser.cs]"]
  node_identity_context[("Identity context")]
  node_cache_service["Cache service<br/>[CacheService.cs]"]
end

node_client(("API client"))
node_stripe["Stripe"]
node_redis[("Redis")]

node_client -.->|"requests catalog"| node_product_service
node_client -.->|"manages basket"| node_basket_service
node_client -.->|"requests orders"| node_order_service
node_client -.->|"authenticates"| node_user_service
node_product_service -->|"queries through"| node_unit_of_work
node_product_service -->|"selects with"| node_specifications
node_product_service -->|"paginates"| node_pagination
node_basket_service -->|"reads and writes"| node_basket_repo
node_basket_service -->|"maps basket"| node_basket_model
node_basket_repo -->|"stores basket"| node_redis
node_basket_repo -->|"serializes"| node_basket_model
node_order_service -->|"loads and deletes"| node_basket_service
node_order_service -->|"persists orders"| node_unit_of_work
node_order_service -->|"updates intent"| node_payment_service
node_order_service -->|"creates order"| node_order_model
node_order_service -->|"maps result"| node_order_dto
node_payment_service -->|"loads and updates"| node_basket_service
node_payment_service -->|"loads and updates"| node_unit_of_work
node_payment_service -->|"creates or updates intent"| node_stripe
node_unit_of_work -->|"provides repositories"| node_generic_repo
node_generic_repo -->|"queries database"| node_store_context
node_generic_repo -->|"evaluates queries"| node_specifications
node_product_repo -->|"queries catalog"| node_store_context
node_user_service -->|"issues tokens"| node_token_service
node_user_service -->|"manages account"| node_user_model
node_token_service -->|"builds claims"| node_user_model

click node_product_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/ProductService/ProductService.cs"
click node_catalog_model "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/Entities/Product.cs"
click node_pagination "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Helper/Pagination.cs"
click node_basket_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/BasketService/BasketService.cs"
click node_basket_model "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/BasketRepository/BasketEntities/CustomerBasket.cs"
click node_basket_repo "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/BasketRepository/BasketRepository.cs"
click node_order_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/OrderService/OrderService.cs"
click node_order_model "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/Entities/OrderEntities/Order.cs"
click node_order_dto "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/OrderService/Dto/OrderResultDto.cs"
click node_payment_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/PaymentService/PaymentService.cs"
click node_unit_of_work "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/UnitOfWork.cs"
click node_generic_repo "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/GenericRepository.cs"
click node_product_repo "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/ProductRepository.cs"
click node_specifications "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Specifications/ISpecifications.cs"
click node_store_context "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/DbContexts/StoreDbContext.cs"
click node_user_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/UserService/UserService.cs"
click node_token_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/TokenService/TokenService.cs"
click node_user_model "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/IdentityEntities/AppUser.cs"
click node_identity_context "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/IdentityDbContext/AppIdentityDbContext.cs"
click node_cache_service "https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/CacheService/CacheService.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_service,node_catalog_model,node_pagination,node_client toneBlue
class node_basket_service,node_basket_model,node_basket_repo,node_order_service,node_order_model,node_order_dto,node_payment_service,node_redis toneAmber
class node_unit_of_work,node_generic_repo,node_product_repo,node_specifications,node_store_context toneMint
class node_user_service,node_token_service,node_user_model,node_identity_context,node_cache_service toneRose
class node_stripe toneIndigo
```

## Components

### Catalog and domain

- [Product service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/ProductService/ProductService.cs): `Services/Services/ProductService/ProductService.cs`
- [Catalog entities](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/Entities/Product.cs): `Core/Entities/Product.cs`
- [Pagination](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Helper/Pagination.cs): `Services/Helper/Pagination.cs`

### Basket and ordering

- [Basket service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/BasketService/BasketService.cs): `Services/Services/BasketService/BasketService.cs`
- [Basket data](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/BasketRepository/BasketEntities/CustomerBasket.cs): `Infrastructure/BasketRepository/BasketEntities/CustomerBasket.cs`
- [Basket repository](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/BasketRepository/BasketRepository.cs): `Infrastructure/BasketRepository/BasketRepository.cs`
- [Order service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/OrderService/OrderService.cs): `Services/Services/OrderService/OrderService.cs`
- [Order entities](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/Entities/OrderEntities/Order.cs): `Core/Entities/OrderEntities/Order.cs`
- [Order result DTO](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/OrderService/Dto/OrderResultDto.cs): `Services/Services/OrderService/Dto/OrderResultDto.cs`
- [Payment service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/PaymentService/PaymentService.cs): `Services/Services/PaymentService/PaymentService.cs`

### Persistence

- [Unit of work](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/UnitOfWork.cs): `Infrastructure/Repositores/UnitOfWork.cs`
- [Generic repository](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/GenericRepository.cs): `Infrastructure/Repositores/GenericRepository.cs`
- [Product repository](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Repositores/ProductRepository.cs): `Infrastructure/Repositores/ProductRepository.cs`
- [Query specifications](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Infrastructure/Specifications/ISpecifications.cs): `Infrastructure/Specifications/ISpecifications.cs`
- [Store database context](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/DbContexts/StoreDbContext.cs): `Core/DbContexts/StoreDbContext.cs`

### Identity and services

- [User service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/UserService/UserService.cs): `Services/UserService/UserService.cs`
- [Token service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/TokenService/TokenService.cs): `Services/Services/TokenService/TokenService.cs`
- [Application user](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/IdentityEntities/AppUser.cs): `Core/IdentityEntities/AppUser.cs`
- [Identity context](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Core/IdentityDbContext/AppIdentityDbContext.cs): `Core/IdentityDbContext/AppIdentityDbContext.cs`
- [Cache service](https://github.com/abdulrahman-elnabawi/ordrer-api/blob/master/Services/Services/CacheService/CacheService.cs): `Services/Services/CacheService/CacheService.cs`

### Other components

- **API client**
- **Stripe**
- **Redis**

## Connections

- API client → Product service: requests catalog
- API client → Basket service: manages basket
- API client → Order service: requests orders
- API client → User service: authenticates
- Product service → Unit of work: queries through (evidence: `Services/Services/ProductService/ProductService.cs`)
- Product service → Query specifications: selects with (evidence: `Services/Services/ProductService/ProductService.cs`)
- Product service → Pagination: paginates (evidence: `Services/Services/ProductService/ProductService.cs`)
- Basket service → Basket repository: reads and writes (evidence: `Services/Services/BasketService/BasketService.cs`)
- Basket service → Basket data: maps basket (evidence: `Services/Services/BasketService/BasketService.cs`)
- Basket repository → Redis: stores basket (evidence: `Infrastructure/BasketRepository/BasketRepository.cs`)
- Basket repository → Basket data: serializes (evidence: `Infrastructure/BasketRepository/BasketRepository.cs`)
- Order service → Basket service: loads and deletes (evidence: `Services/Services/OrderService/OrderService.cs`)
- Order service → Unit of work: persists orders (evidence: `Services/Services/OrderService/OrderService.cs`)
- Order service → Payment service: updates intent (evidence: `Services/Services/OrderService/OrderService.cs`)
- Order service → Order entities: creates order (evidence: `Services/Services/OrderService/OrderService.cs`)
- Order service → Order result DTO: maps result (evidence: `Services/Services/OrderService/OrderService.cs`)
- Payment service → Basket service: loads and updates (evidence: `Services/Services/PaymentService/PaymentService.cs`)
- Payment service → Unit of work: loads and updates (evidence: `Services/Services/PaymentService/PaymentService.cs`)
- Payment service → Stripe: creates or updates intent (evidence: `Services/Services/PaymentService/PaymentService.cs`)
- Unit of work → Generic repository: provides repositories
- Generic repository → Store database context: queries database (evidence: `Infrastructure/Repositores/GenericRepository.cs`)
- Generic repository → Query specifications: evaluates queries (evidence: `Infrastructure/Repositores/GenericRepository.cs`)
- Product repository → Store database context: queries catalog (evidence: `Infrastructure/Repositores/ProductRepository.cs`)
- User service → Token service: issues tokens (evidence: `Services/UserService/UserService.cs`)
- User service → Application user: manages account (evidence: `Services/UserService/UserService.cs`)
- Token service → Application user: builds claims (evidence: `Services/Services/TokenService/TokenService.cs`)
