# nader-grt/ecommercedelevryplus architecture

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

- Interactive diagram: https://gitdiagram.com/nader-grt/ecommercedelevryplus
- Repository: https://github.com/nader-grt/ecommercedelevryplus

## Overview

EcommerceDeliveryPlus is a multi-tenant commerce and delivery platform. An administrator signs in to the React Admin dashboard, which calls the REST API; the API authenticates and authorizes requests, applies business operations, and persists operational data. The principal order journey spans stock checks and reservations, invoicing, payment, sale confirmation, and inventory movement. The graph preserves the documented product, warehouse, customer, and delivery capabilities. Several backend links reflect README architecture rather than inspected implementations; those links are labeled accordingly.

Main entry points: [`api/src/controllers/Orders`](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/Orders) (Order lifecycle), [`admin/src/App.tsx`](https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/App.tsx) (React Admin), [`api/src/app.ts`](https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/app.ts) (REST API), [`api/src/useCases`](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/useCases) (Business use cases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin dashboard"]
  node_dashboard["React Admin<br/>[App.tsx]"]
  node_auth_ui["Admin authentication<br/>[authProvider.tsx]"]
  node_http_client["HTTP client"]
  node_data_provider["Admin data provider<br/>[dataProvider.tsx]"]
end

subgraph group_access["API access"]
  node_api["REST API<br/>[app.ts]"]
  node_auth_middleware["JWT authentication<br/>[verifyToken.ts]"]
  node_authorization["Roles and policies"]
  node_controllers["Request controllers"]
end

subgraph group_operations["Commerce operations"]
  node_use_cases["Business use cases"]
  node_domain["Domain rules"]
  node_catalog["Products and variants"]
  node_inventory["Warehouse inventory"]
  node_pricing["Pricing and promotions"]
  node_orders["Order lifecycle"]
  node_invoicing["Invoices"]
  node_delivery["Delivery operations"]
  node_company_users["Company and users"]
end

subgraph group_persistence["Persistence"]
  node_repositories["Repositories"]
  node_database[("MariaDB")]
end

node_administrator(("Administrator"))

node_administrator -->|"uses"| node_dashboard
node_dashboard -->|"authenticates with"| node_auth_ui
node_dashboard -->|"loads resources through"| node_data_provider
node_auth_ui -->|"refreshes via"| node_http_client
node_data_provider -->|"sends requests through"| node_http_client
node_dashboard -->|"calls REST API"| node_api
node_api -->|"authenticates requests"| node_auth_middleware
node_auth_middleware -.->|"authorizes by role"| node_authorization
node_api -.->|"routes requests to"| node_controllers
node_controllers -->|"executes"| node_use_cases
node_use_cases -.->|"applies rules"| node_domain
node_use_cases -.->|"persists through"| node_repositories
node_repositories -->|"reads and writes"| node_database
node_administrator -.->|"manages catalog"| node_catalog
node_administrator -.->|"manages stock"| node_inventory
node_administrator -.->|"manages tenants and users"| node_company_users
node_orders -.->|"checks and reserves stock"| node_inventory
node_orders -.->|"generates invoice"| node_invoicing
node_orders -.->|"confirms sale"| node_inventory
node_orders -.->|"advances delivery"| node_delivery
node_orders -.->|"uses pricing services"| node_pricing

click node_dashboard "https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/App.tsx"
click node_auth_ui "https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/core/providers/authProvider.tsx"
click node_http_client "https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/auth/httpclientService/httpclientService.ts"
click node_data_provider "https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/core/providers/dataProvider.tsx"
click node_api "https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/app.ts"
click node_auth_middleware "https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/middleware/verifyToken.ts"
click node_authorization "https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/Policy/PermissionPolicy.ts"
click node_controllers "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers"
click node_use_cases "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/useCases"
click node_domain "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/models/domain"
click node_catalog "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/products"
click node_inventory "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/Inventorie"
click node_pricing "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/services/PricingService"
click node_orders "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/Orders"
click node_invoicing "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/services/InvoiceService"
click node_delivery "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/OrderWithDeliveries"
click node_company_users "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/company"
click node_repositories "https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/repo"

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_dashboard,node_auth_ui,node_http_client,node_data_provider toneBlue
class node_api,node_auth_middleware,node_authorization,node_controllers toneAmber
class node_use_cases,node_domain,node_catalog,node_inventory,node_pricing,node_orders,node_invoicing,node_delivery,node_company_users toneMint
class node_repositories,node_database toneRose
class node_administrator toneIndigo
```

## Components

### Admin dashboard

- [React Admin](https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/App.tsx): `admin/src/App.tsx`
- [Admin authentication](https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/core/providers/authProvider.tsx): `admin/src/core/providers/authProvider.tsx`
- [HTTP client](https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/auth/httpclientService/httpclientService.ts): `admin/src/auth/httpclientService/httpclientService.ts`
- [Admin data provider](https://github.com/nader-grt/ecommercedelevryplus/blob/main/admin/src/core/providers/dataProvider.tsx): `admin/src/core/providers/dataProvider.tsx`

### API access

- [REST API](https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/app.ts): `api/src/app.ts`
- [JWT authentication](https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/middleware/verifyToken.ts): `api/src/middleware/verifyToken.ts`
- [Roles and policies](https://github.com/nader-grt/ecommercedelevryplus/blob/main/api/src/Policy/PermissionPolicy.ts): `api/src/Policy/PermissionPolicy.ts`
- [Request controllers](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers): `api/src/controllers`

### Commerce operations

- [Business use cases](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/useCases): `api/src/useCases`
- [Domain rules](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/models/domain): `api/src/models/domain`
- [Products and variants](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/products): `api/src/controllers/products`
- [Warehouse inventory](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/Inventorie): `api/src/controllers/Inventorie`
- [Pricing and promotions](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/services/PricingService): `api/src/services/PricingService`
- [Order lifecycle](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/Orders): `api/src/controllers/Orders`
- [Invoices](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/services/InvoiceService): `api/src/services/InvoiceService`
- [Delivery operations](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/OrderWithDeliveries): `api/src/controllers/OrderWithDeliveries`
- [Company and users](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/controllers/company): `api/src/controllers/company`

### Persistence

- [Repositories](https://github.com/nader-grt/ecommercedelevryplus/tree/main/api/src/repo): `api/src/repo`
- **MariaDB**

### Other components

- **Administrator**

## Connections

- Administrator → React Admin: uses (evidence: `README.md`)
- React Admin → Admin authentication: authenticates with (evidence: `admin/src/App.tsx`)
- React Admin → Admin data provider: loads resources through (evidence: `admin/src/App.tsx`)
- Admin authentication → HTTP client: refreshes via (evidence: `admin/src/auth/httpclientService/httpclientService.ts`)
- Admin data provider → HTTP client: sends requests through (evidence: `admin/src/core/providers/dataProvider.tsx`)
- React Admin → REST API: calls REST API (evidence: `README.md`)
- REST API → JWT authentication: authenticates requests (evidence: `README.md`)
- JWT authentication → Roles and policies: authorizes by role (evidence: `README.md`)
- REST API → Request controllers: routes requests to (evidence: `README.md`)
- Request controllers → Business use cases: executes (evidence: `api/src/controllers/Inventorie/ReserveStockController.ts`)
- Business use cases → Domain rules: applies rules (evidence: `README.md`)
- Business use cases → Repositories: persists through (evidence: `README.md`)
- Repositories → MariaDB: reads and writes (evidence: `README.md`)
- Administrator → Products and variants: manages catalog (evidence: `README.md`)
- Administrator → Warehouse inventory: manages stock (evidence: `README.md`)
- Administrator → Company and users: manages tenants and users (evidence: `README.md`)
- Order lifecycle → Warehouse inventory: checks and reserves stock (evidence: `README.md`)
- Order lifecycle → Invoices: generates invoice (evidence: `README.md`)
- Order lifecycle → Warehouse inventory: confirms sale (evidence: `README.md`)
- Order lifecycle → Delivery operations: advances delivery (evidence: `README.md`)
- Order lifecycle → Pricing and promotions: uses pricing services
