# hamzaijaz/groceryhelper architecture

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

- Interactive diagram: https://gitdiagram.com/hamzaijaz/groceryhelper
- Repository: https://github.com/hamzaijaz/groceryhelper

## Overview

GroceryHelper is an ASP.NET Core API for a grocery list. A frontend sends CRUD requests to the groceries controller; the controller delegates use cases to the application service, which validates/maps request data and calls the repository abstraction. The in-memory implementation filters and sorts reads and loses its data on restart. The graph also shows domain data, startup registration, and documented Swagger support. Relationships are based on the README or shown source; configuration and middleware details are summarized at the host node.

Main entry points: [`src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs`](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs) (In-memory repository), [`src/GroceryHelper.Application/GroceryService.cs`](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryService.cs) (Grocery use cases), [`src/GroceryHelper.Application/GroceryRequest.cs`](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryRequest.cs) (Request validation and mapping), [`src/GroceryHelper.Application/IGroceryRepository.cs`](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/IGroceryRepository.cs) (Repository contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_controller["Groceries controller"]
  node_host["API host and middleware<br/>[Program.cs]"]
  node_swagger["Swagger UI<br/>[Program.cs]"]
end

subgraph group_application["Application"]
  node_service["Grocery use cases<br/>[GroceryService.cs]"]
  node_request["Request validation and mapping<br/>[GroceryRequest.cs]"]
  node_repository_interface["Repository contract"]
  node_app_registration["Application registration"]
end

subgraph group_domain["Grocery Domain"]
  node_grocery["Grocery record<br/>[Grocery.cs]"]
  node_category["Grocery categories<br/>[GroceryCategory.cs]"]
end

subgraph group_infrastructure["Storage"]
  node_memory_repository["In-memory repository"]
  node_infra_registration["Infrastructure registration"]
end

node_frontend(("Frontend client"))

node_frontend -->|"sends CRUD requests"| node_controller
node_controller -->|"delegates use cases"| node_service
node_controller -->|"accepts payload"| node_request
node_service -->|"maps payload"| node_request
node_service -->|"calls storage"| node_repository_interface
node_request -->|"creates record"| node_grocery
node_request -->|"uses category"| node_category
node_grocery -->|"stores category"| node_category
node_repository_interface -->|"operates on"| node_grocery
node_repository_interface -->|"filters by"| node_category
node_memory_repository -->|"implements"| node_repository_interface
node_memory_repository -->|"stores and sorts"| node_grocery
node_memory_repository -->|"filters by"| node_category
node_host -->|"registers application"| node_app_registration
node_host -->|"registers storage"| node_infra_registration
node_app_registration -->|"registers service"| node_service
node_infra_registration -->|"registers implementation"| node_memory_repository
node_host -->|"enables in development"| node_swagger

click node_controller "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Controllers/GroceriesController.cs"
click node_host "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Program.cs"
click node_swagger "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Program.cs"
click node_service "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryService.cs"
click node_request "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryRequest.cs"
click node_repository_interface "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/IGroceryRepository.cs"
click node_grocery "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Domain/Grocery.cs"
click node_category "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Domain/GroceryCategory.cs"
click node_memory_repository "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs"
click node_app_registration "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/DependencyInjection.cs"
click node_infra_registration "https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Infrastructure/DependencyInjection.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_controller,node_host,node_swagger,node_frontend toneBlue
class node_service,node_request,node_repository_interface,node_app_registration toneAmber
class node_grocery,node_category toneMint
class node_memory_repository,node_infra_registration toneRose
```

## Components

### HTTP API

- [Groceries controller](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Controllers/GroceriesController.cs): `src/GroceryHelper.WebAPI/Controllers/GroceriesController.cs`
- [API host and middleware](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Program.cs): `src/GroceryHelper.WebAPI/Program.cs`
- [Swagger UI](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.WebAPI/Program.cs): `src/GroceryHelper.WebAPI/Program.cs`

### Application

- [Grocery use cases](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryService.cs): `src/GroceryHelper.Application/GroceryService.cs`
- [Request validation and mapping](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/GroceryRequest.cs): `src/GroceryHelper.Application/GroceryRequest.cs`
- [Repository contract](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/IGroceryRepository.cs): `src/GroceryHelper.Application/IGroceryRepository.cs`
- [Application registration](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Application/DependencyInjection.cs): `src/GroceryHelper.Application/DependencyInjection.cs`

### Grocery Domain

- [Grocery record](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Domain/Grocery.cs): `src/GroceryHelper.Domain/Grocery.cs`
- [Grocery categories](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Domain/GroceryCategory.cs): `src/GroceryHelper.Domain/GroceryCategory.cs`

### Storage

- [In-memory repository](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs): `src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs`
- [Infrastructure registration](https://github.com/hamzaijaz/groceryhelper/blob/main/src/GroceryHelper.Infrastructure/DependencyInjection.cs): `src/GroceryHelper.Infrastructure/DependencyInjection.cs`

### Other components

- **Frontend client**

## Connections

- Frontend client → Groceries controller: sends CRUD requests (evidence: `README.md`)
- Groceries controller → Grocery use cases: delegates use cases (evidence: `src/GroceryHelper.WebAPI/Controllers/GroceriesController.cs`)
- Groceries controller → Request validation and mapping: accepts payload (evidence: `src/GroceryHelper.WebAPI/Controllers/GroceriesController.cs`)
- Grocery use cases → Request validation and mapping: maps payload (evidence: `src/GroceryHelper.Application/GroceryService.cs`)
- Grocery use cases → Repository contract: calls storage (evidence: `src/GroceryHelper.Application/GroceryService.cs`)
- Request validation and mapping → Grocery record: creates record (evidence: `src/GroceryHelper.Application/GroceryRequest.cs`)
- Request validation and mapping → Grocery categories: uses category (evidence: `src/GroceryHelper.Application/GroceryRequest.cs`)
- Grocery record → Grocery categories: stores category (evidence: `src/GroceryHelper.Domain/Grocery.cs`)
- Repository contract → Grocery record: operates on (evidence: `src/GroceryHelper.Application/IGroceryRepository.cs`)
- Repository contract → Grocery categories: filters by (evidence: `src/GroceryHelper.Application/IGroceryRepository.cs`)
- In-memory repository → Repository contract: implements (evidence: `src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs`)
- In-memory repository → Grocery record: stores and sorts (evidence: `src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs`)
- In-memory repository → Grocery categories: filters by (evidence: `src/GroceryHelper.Infrastructure/Repositories/InMemoryGroceryRepository.cs`)
- API host and middleware → Application registration: registers application (evidence: `src/GroceryHelper.WebAPI/Program.cs`)
- API host and middleware → Infrastructure registration: registers storage (evidence: `src/GroceryHelper.WebAPI/Program.cs`)
- Application registration → Grocery use cases: registers service (evidence: `src/GroceryHelper.Application/DependencyInjection.cs`)
- Infrastructure registration → In-memory repository: registers implementation (evidence: `src/GroceryHelper.Infrastructure/DependencyInjection.cs`)
- API host and middleware → Swagger UI: enables in development (evidence: `src/GroceryHelper.WebAPI/Program.cs`)
