# samir-aljaber/greenmart architecture

> Architecture diagram of the GitHub repository samir-aljaber/greenmart, 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/samir-aljaber/greenmart
- Repository: https://github.com/samir-aljaber/greenmart

## Overview

GreenMart is an ASP.NET Core marketplace for shoppers, sellers, administrators, and delivery workers. The shopper path covers account access, product discovery, cart management, checkout, and order tracking; separate seller and delivery workflows manage fulfillment, while administrators oversee users. Product search and receipt generation are distinct service layers, with SQL-backed application state and SMTP email integration. The source index supports controller dependencies and service registration; several controllers and browser scripts are unsampled, so their detailed interactions are not asserted.

Main entry points: [`application/Data/ApplicationDbContext.cs`](https://github.com/samir-aljaber/greenmart/blob/main/application/Data/ApplicationDbContext.cs) (Data access), [`application/Controllers/OrderController.cs`](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/OrderController.cs) (Order management), [`application/Controllers/ProductController.cs`](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/ProductController.cs) (Product catalog), [`application/Services/ProductSearchService.cs`](https://github.com/samir-aljaber/greenmart/blob/main/application/Services/ProductSearchService.cs) (Product search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Marketplace workflows"]
  node_account["Account access"]
  node_catalog["Product catalog"]
  node_categories["Category browsing"]
  node_cart["Shopping cart<br/>[CartController.cs]"]
  node_cartcount["Cart count"]
  node_adminops["Admin operations<br/>[AdminController.cs]"]
  node_home["Storefront home<br/>[HomeController.cs]"]
end

subgraph group_fulfillment["Orders and delivery"]
  node_checkout["Checkout"]
  node_orders["Order management<br/>[OrderController.cs]"]
  node_delivery["Delivery operations"]
end

subgraph group_services["Application services"]
  node_search["Product search"]
  node_receipt["Receipt PDF"]
  node_email["Email delivery"]
end

subgraph group_data["Domain data"]
  node_dbcontext["Data access"]
  node_marketdata["Marketplace records<br/>[Product.cs]"]
  node_cartdata["Cart records<br/>[Cart.cs]"]
  node_orderdata["Order records<br/>[Order.cs]"]
  node_deliverydata["Delivery records"]
end

node_shopper(("Shopper"))
node_seller(("Seller"))
node_admin(("Administrator"))
node_courier(("Delivery worker"))
node_sql[("SQL Server")]
node_smtp["SMTP service"]

node_shopper -.->|"signs in"| node_account
node_shopper -.->|"browses"| node_catalog
node_shopper -.->|"manages cart"| node_cart
node_shopper -.->|"checks out"| node_checkout
node_seller -.->|"manages listings"| node_catalog
node_seller -.->|"handles orders"| node_orders
node_admin -.->|"administers"| node_adminops
node_courier -.->|"fulfills delivery"| node_delivery
node_catalog -->|"queries"| node_search
node_orders -->|"queries"| node_search
node_adminops -->|"sends email"| node_email
node_orders -->|"creates receipts"| node_receipt
node_account -->|"reads and writes"| node_dbcontext
node_catalog -->|"reads and writes"| node_dbcontext
node_cart -->|"reads and writes"| node_dbcontext
node_checkout -->|"reads and writes"| node_dbcontext
node_orders -->|"reads and writes"| node_dbcontext
node_delivery -->|"reads and writes"| node_dbcontext
node_adminops -->|"reads and writes"| node_dbcontext
node_cartcount -->|"reads"| node_dbcontext
node_search -->|"queries"| node_dbcontext
node_dbcontext -->|"maps entities"| node_marketdata
node_dbcontext -->|"maps entities"| node_cartdata
node_dbcontext -->|"maps entities"| node_orderdata
node_dbcontext -->|"maps entities"| node_deliverydata
node_dbcontext -->|"uses provider"| node_sql
node_email -.->|"sends mail"| node_smtp
node_search -->|"searches listings"| node_marketdata

click node_account "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/AccountController.cs"
click node_catalog "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/ProductController.cs"
click node_categories "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CategoryController.cs"
click node_cart "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CartController.cs"
click node_cartcount "https://github.com/samir-aljaber/greenmart/blob/main/application/ViewComponents/CartCountViewComponent.cs"
click node_checkout "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CheckoutController.cs"
click node_orders "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/OrderController.cs"
click node_delivery "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/DeliveryController.cs"
click node_adminops "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/AdminController.cs"
click node_home "https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/HomeController.cs"
click node_search "https://github.com/samir-aljaber/greenmart/blob/main/application/Services/ProductSearchService.cs"
click node_receipt "https://github.com/samir-aljaber/greenmart/blob/main/application/Services/OrderReceiptPdfService.cs"
click node_email "https://github.com/samir-aljaber/greenmart/blob/main/application/Services/SmtpEmailService.cs"
click node_dbcontext "https://github.com/samir-aljaber/greenmart/blob/main/application/Data/ApplicationDbContext.cs"
click node_marketdata "https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Product.cs"
click node_cartdata "https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Cart.cs"
click node_orderdata "https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Order.cs"
click node_deliverydata "https://github.com/samir-aljaber/greenmart/blob/main/application/Models/DeliveryAssignment.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_account,node_catalog,node_categories,node_cart,node_cartcount,node_adminops,node_home toneBlue
class node_checkout,node_orders,node_delivery,node_sql toneAmber
class node_search,node_receipt,node_email toneMint
class node_dbcontext,node_marketdata,node_cartdata,node_orderdata,node_deliverydata,node_courier toneRose
class node_shopper,node_seller,node_admin,node_smtp toneIndigo
```

## Components

### Marketplace workflows

- [Account access](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/AccountController.cs): `application/Controllers/AccountController.cs`
- [Product catalog](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/ProductController.cs): `application/Controllers/ProductController.cs`
- [Category browsing](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CategoryController.cs): `application/Controllers/CategoryController.cs`
- [Shopping cart](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CartController.cs): `application/Controllers/CartController.cs`
- [Cart count](https://github.com/samir-aljaber/greenmart/blob/main/application/ViewComponents/CartCountViewComponent.cs): `application/ViewComponents/CartCountViewComponent.cs`
- [Admin operations](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/AdminController.cs): `application/Controllers/AdminController.cs`
- [Storefront home](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/HomeController.cs): `application/Controllers/HomeController.cs`

### Orders and delivery

- [Checkout](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/CheckoutController.cs): `application/Controllers/CheckoutController.cs`
- [Order management](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/OrderController.cs): `application/Controllers/OrderController.cs`
- [Delivery operations](https://github.com/samir-aljaber/greenmart/blob/main/application/Controllers/DeliveryController.cs): `application/Controllers/DeliveryController.cs`

### Application services

- [Product search](https://github.com/samir-aljaber/greenmart/blob/main/application/Services/ProductSearchService.cs): `application/Services/ProductSearchService.cs`
- [Receipt PDF](https://github.com/samir-aljaber/greenmart/blob/main/application/Services/OrderReceiptPdfService.cs): `application/Services/OrderReceiptPdfService.cs`
- [Email delivery](https://github.com/samir-aljaber/greenmart/blob/main/application/Services/SmtpEmailService.cs): `application/Services/SmtpEmailService.cs`

### Domain data

- [Data access](https://github.com/samir-aljaber/greenmart/blob/main/application/Data/ApplicationDbContext.cs): `application/Data/ApplicationDbContext.cs`
- [Marketplace records](https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Product.cs): `application/Models/Product.cs`
- [Cart records](https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Cart.cs): `application/Models/Cart.cs`
- [Order records](https://github.com/samir-aljaber/greenmart/blob/main/application/Models/Order.cs): `application/Models/Order.cs`
- [Delivery records](https://github.com/samir-aljaber/greenmart/blob/main/application/Models/DeliveryAssignment.cs): `application/Models/DeliveryAssignment.cs`

### Other components

- **Shopper**
- **Seller**
- **Administrator**
- **Delivery worker**
- **SQL Server**
- **SMTP service**

## Connections

- Shopper → Account access: signs in
- Shopper → Product catalog: browses
- Shopper → Shopping cart: manages cart
- Shopper → Checkout: checks out
- Seller → Product catalog: manages listings
- Seller → Order management: handles orders
- Administrator → Admin operations: administers
- Delivery worker → Delivery operations: fulfills delivery
- Product catalog → Product search: queries (evidence: `application/Controllers/ProductController.cs`)
- Order management → Product search: queries (evidence: `application/Controllers/OrderController.cs`)
- Admin operations → Email delivery: sends email (evidence: `application/Controllers/AdminController.cs`)
- Order management → Receipt PDF: creates receipts (evidence: `application/Controllers/OrderController.cs`)
- Account access → Data access: reads and writes (evidence: `application/Controllers/AccountController.cs`)
- Product catalog → Data access: reads and writes (evidence: `application/Controllers/ProductController.cs`)
- Shopping cart → Data access: reads and writes (evidence: `application/Controllers/CartController.cs`)
- Checkout → Data access: reads and writes (evidence: `application/Controllers/CheckoutController.cs`)
- Order management → Data access: reads and writes (evidence: `application/Controllers/OrderController.cs`)
- Delivery operations → Data access: reads and writes (evidence: `application/Controllers/DeliveryController.cs`)
- Admin operations → Data access: reads and writes (evidence: `application/Controllers/AdminController.cs`)
- Cart count → Data access: reads (evidence: `application/ViewComponents/CartCountViewComponent.cs`)
- Product search → Data access: queries (evidence: `application/Services/ProductSearchService.cs`)
- Data access → Marketplace records: maps entities (evidence: `application/Data/ApplicationDbContext.cs`)
- Data access → Cart records: maps entities (evidence: `application/Data/ApplicationDbContext.cs`)
- Data access → Order records: maps entities (evidence: `application/Data/ApplicationDbContext.cs`)
- Data access → Delivery records: maps entities (evidence: `application/Data/ApplicationDbContext.cs`)
- Data access → SQL Server: uses provider
- Email delivery → SMTP service: sends mail
- Product search → Marketplace records: searches listings (evidence: `application/Services/ProductSearchService.cs`)
