# ad668/fruit-shop-ecommerce-website architecture

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

- Interactive diagram: https://gitdiagram.com/ad668/fruit-shop-ecommerce-website
- Repository: https://github.com/ad668/fruit-shop-ecommerce-website

## Overview

This is an Angular storefront backed by an ASP.NET Core API, with a fruit catalog, cart and checkout, order tracking and delivery, authentication, administration, invoices, and payment hooks. The main customer flow is browse products, build a cart, submit checkout, then track delivery; the API owns checkout, persistence, and payment coordination. The graph also preserves the documented admin, invoice, and category capabilities. Edges reflect shown calls, registrations, or README statements; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/app/services/api.service.ts`](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/api.service.ts) (API client), [`backend/OnlineFruitShop.API/Controllers/OrdersController.cs`](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/OrdersController.cs) (Orders API), [`backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs`](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs) (Repository), [`frontend/src/app/pages`](https://github.com/ad668/fruit-shop-ecommerce-website/tree/main/frontend/src/app/pages) (Storefront pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_storefront_pages["Storefront pages"]
  node_admin_pages["Admin pages"]
  node_delivery_page["Delivery page"]
  node_cart["Cart state<br/>[cart.service.ts]"]
  node_auth_client["Auth client<br/>[auth.service.ts]"]
  node_api_client["API client<br/>[api.service.ts]"]
  node_guards["Route guards<br/>[admin.guard.ts]"]
end

subgraph group_api["API workflows"]
  node_catalog_api["Catalog API"]
  node_categories_api["Categories API"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_orders_api["Orders API"]
  node_invoices_api["Invoices API"]
  node_contact_api["Contact API"]
end

subgraph group_domain["Domain and persistence"]
  node_entities["Shop entities<br/>[Entities]"]
  node_repository["Repository<br/>[Repository.cs]"]
  node_db_context[("Database context")]
end

subgraph group_integrations["Identity and integrations"]
  node_auth_service["Auth service<br/>[AuthService.cs]"]
  node_payment_service["Payment service<br/>[PaymentService.cs]"]
  node_email_service["Email service<br/>[EmailService.cs]"]
  node_receipt_service["Delivery receipts"]
end

node_shopper(("Shopper"))
node_email_provider["Email provider"]
node_payment_gateway["Payment gateway"]
node_sql_server[("SQL database")]

node_shopper -->|"uses"| node_storefront_pages
node_storefront_pages -.->|"requests data"| node_api_client
node_storefront_pages -.->|"updates cart"| node_cart
node_storefront_pages -.->|"uses identity"| node_auth_client
node_admin_pages -.->|"manages catalog"| node_api_client
node_delivery_page -.->|"handles delivery"| node_api_client
node_api_client -->|"calls catalog"| node_catalog_api
node_api_client -->|"calls auth"| node_auth_api
node_api_client -->|"calls orders"| node_orders_api
node_api_client -->|"sends message"| node_contact_api
node_api_client -.->|"requests invoices"| node_invoices_api
node_api_client -.->|"requests categories"| node_categories_api
node_storefront_pages -->|"route access"| node_guards
node_auth_client -.->|"checks roles"| node_guards
node_catalog_api -->|"uses repository"| node_repository
node_categories_api -->|"uses repository"| node_repository
node_invoices_api -->|"uses repository"| node_repository
node_auth_api -->|"uses repository"| node_repository
node_auth_api -->|"authenticates"| node_auth_service
node_orders_api -->|"uses repository"| node_repository
node_orders_api -->|"creates payment"| node_payment_service
node_orders_api -->|"sends notices"| node_email_service
node_orders_api -->|"creates receipts"| node_receipt_service
node_contact_api -->|"sends message"| node_email_service
node_repository -->|"queries context"| node_db_context
node_db_context -->|"maps entities"| node_entities
node_payment_service -.->|"integrates"| node_payment_gateway
node_email_service -.->|"sends email"| node_email_provider
node_db_context -.->|"persists data"| node_sql_server
node_auth_service -.->|"provides auth operations"| node_auth_api
node_payment_service -->|"registered for orders"| node_orders_api

click node_storefront_pages "https://github.com/ad668/fruit-shop-ecommerce-website/tree/main/frontend/src/app/pages"
click node_admin_pages "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/pages/admin-add-fruit/admin-add-fruit.component.ts"
click node_delivery_page "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/pages/delivery-partner/delivery-partner.component.ts"
click node_cart "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/cart.service.ts"
click node_auth_client "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/auth.service.ts"
click node_api_client "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/api.service.ts"
click node_guards "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/guards/admin.guard.ts"
click node_catalog_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/FruitsController.cs"
click node_categories_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/CategoriesController.cs"
click node_auth_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/AuthController.cs"
click node_orders_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/OrdersController.cs"
click node_invoices_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/InvoicesController.cs"
click node_contact_api "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/ContactController.cs"
click node_entities "https://github.com/ad668/fruit-shop-ecommerce-website/tree/main/backend/OnlineFruitShop.Core/Entities"
click node_repository "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs"
click node_db_context "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Data/ApplicationDbContext.cs"
click node_auth_service "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/AuthService.cs"
click node_payment_service "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/PaymentService.cs"
click node_email_service "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/EmailService.cs"
click node_receipt_service "https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/DeliveryReceiptService.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_storefront_pages,node_admin_pages,node_delivery_page,node_cart,node_auth_client,node_api_client,node_guards toneBlue
class node_catalog_api,node_categories_api,node_auth_api,node_orders_api,node_invoices_api,node_contact_api,node_sql_server toneAmber
class node_entities,node_repository,node_db_context toneMint
class node_auth_service,node_payment_service,node_email_service,node_receipt_service toneRose
class node_shopper,node_email_provider,node_payment_gateway toneIndigo
```

## Components

### Storefront

- [Storefront pages](https://github.com/ad668/fruit-shop-ecommerce-website/tree/main/frontend/src/app/pages): `frontend/src/app/pages`
- [Admin pages](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/pages/admin-add-fruit/admin-add-fruit.component.ts): `frontend/src/app/pages/admin-add-fruit/admin-add-fruit.component.ts`
- [Delivery page](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/pages/delivery-partner/delivery-partner.component.ts): `frontend/src/app/pages/delivery-partner/delivery-partner.component.ts`
- [Cart state](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/cart.service.ts): `frontend/src/app/services/cart.service.ts`
- [Auth client](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/auth.service.ts): `frontend/src/app/services/auth.service.ts`
- [API client](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/services/api.service.ts): `frontend/src/app/services/api.service.ts`
- [Route guards](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/frontend/src/app/guards/admin.guard.ts): `frontend/src/app/guards/admin.guard.ts`

### API workflows

- [Catalog API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/FruitsController.cs): `backend/OnlineFruitShop.API/Controllers/FruitsController.cs`
- [Categories API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/CategoriesController.cs): `backend/OnlineFruitShop.API/Controllers/CategoriesController.cs`
- [Authentication API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/AuthController.cs): `backend/OnlineFruitShop.API/Controllers/AuthController.cs`
- [Orders API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/OrdersController.cs): `backend/OnlineFruitShop.API/Controllers/OrdersController.cs`
- [Invoices API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/InvoicesController.cs): `backend/OnlineFruitShop.API/Controllers/InvoicesController.cs`
- [Contact API](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.API/Controllers/ContactController.cs): `backend/OnlineFruitShop.API/Controllers/ContactController.cs`

### Domain and persistence

- [Shop entities](https://github.com/ad668/fruit-shop-ecommerce-website/tree/main/backend/OnlineFruitShop.Core/Entities): `backend/OnlineFruitShop.Core/Entities`
- [Repository](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs): `backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs`
- [Database context](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Data/ApplicationDbContext.cs): `backend/OnlineFruitShop.Infrastructure/Data/ApplicationDbContext.cs`

### Identity and integrations

- [Auth service](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/AuthService.cs): `backend/OnlineFruitShop.Infrastructure/Services/AuthService.cs`
- [Payment service](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/PaymentService.cs): `backend/OnlineFruitShop.Infrastructure/Services/PaymentService.cs`
- [Email service](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/EmailService.cs): `backend/OnlineFruitShop.Infrastructure/Services/EmailService.cs`
- [Delivery receipts](https://github.com/ad668/fruit-shop-ecommerce-website/blob/main/backend/OnlineFruitShop.Infrastructure/Services/DeliveryReceiptService.cs): `backend/OnlineFruitShop.Infrastructure/Services/DeliveryReceiptService.cs`

### Other components

- **Shopper**
- **Email provider**
- **Payment gateway**
- **SQL database**

## Connections

- Shopper → Storefront pages: uses
- Storefront pages → API client: requests data (evidence: `frontend/src/app/pages/auth/auth.component.ts`)
- Storefront pages → Cart state: updates cart (evidence: `frontend/src/app/pages/checkout/checkout.component.ts`)
- Storefront pages → Auth client: uses identity (evidence: `frontend/src/app/pages/auth/auth.component.ts`)
- Admin pages → API client: manages catalog (evidence: `frontend/src/app/pages/admin-add-fruit/admin-add-fruit.component.ts`)
- Delivery page → API client: handles delivery
- API client → Catalog API: calls catalog (evidence: `frontend/src/app/services/api.service.ts`)
- API client → Authentication API: calls auth (evidence: `frontend/src/app/services/api.service.ts`)
- API client → Orders API: calls orders (evidence: `frontend/src/app/services/api.service.ts`)
- API client → Contact API: sends message (evidence: `frontend/src/app/services/api.service.ts`)
- API client → Invoices API: requests invoices
- API client → Categories API: requests categories
- Storefront pages → Route guards: route access (evidence: `frontend/src/app/app-routing.module.ts`)
- Auth client → Route guards: checks roles
- Catalog API → Repository: uses repository (evidence: `backend/OnlineFruitShop.API/Controllers/FruitsController.cs`)
- Categories API → Repository: uses repository (evidence: `backend/OnlineFruitShop.API/Controllers/CategoriesController.cs`)
- Invoices API → Repository: uses repository (evidence: `backend/OnlineFruitShop.API/Controllers/InvoicesController.cs`)
- Authentication API → Repository: uses repository (evidence: `backend/OnlineFruitShop.API/Controllers/AuthController.cs`)
- Authentication API → Auth service: authenticates (evidence: `backend/OnlineFruitShop.API/Controllers/AuthController.cs`)
- Orders API → Repository: uses repository (evidence: `backend/OnlineFruitShop.API/Controllers/OrdersController.cs`)
- Orders API → Payment service: creates payment (evidence: `backend/OnlineFruitShop.API/Controllers/OrdersController.cs`)
- Orders API → Email service: sends notices (evidence: `backend/OnlineFruitShop.API/Controllers/OrdersController.cs`)
- Orders API → Delivery receipts: creates receipts (evidence: `backend/OnlineFruitShop.API/Controllers/OrdersController.cs`)
- Contact API → Email service: sends message (evidence: `backend/OnlineFruitShop.API/Controllers/ContactController.cs`)
- Repository → Database context: queries context (evidence: `backend/OnlineFruitShop.Infrastructure/Repositories/Repository.cs`)
- Database context → Shop entities: maps entities (evidence: `backend/OnlineFruitShop.Infrastructure/Data/ApplicationDbContext.cs`)
- Payment service → Payment gateway: integrates
- Email service → Email provider: sends email (evidence: `backend/OnlineFruitShop.Infrastructure/Services/EmailService.cs`)
- Database context → SQL database: persists data
- Auth service → Authentication API: provides auth operations
- Payment service → Orders API: registered for orders
