# mohamedabakhir/elcartable-platforme architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedabakhir/elcartable-platforme
- Repository: https://github.com/mohamedabakhir/elcartable-platforme

## Overview

elCartable is a Moroccan school-supplies ordering platform with a React storefront and NestJS API. Buyers browse schools and official lists, build a cart, place cash-on-delivery orders, then track them; staff manage orders and catalog data, while admins also review dashboard and analytics. The map separates buyer-facing stages, staff operations, backend domain services, and shared infrastructure. The README documents the API/database and file-storage setup; some service-to-store and page-to-API call details were not sampled, so those connections are omitted rather than inferred.

Main entry points: [`apps/frontend/src/App.tsx`](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/App.tsx) (Web application), [`apps/frontend/src/lib/api.ts`](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/lib/api.ts) (HTTP API client), [`apps/backend/src/orders/orders.controller.ts`](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/orders/orders.controller.ts) (Order lifecycle), [`apps/backend/src/storage/storage.service.ts`](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/storage/storage.service.ts) (File storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_buyer["Buyer storefront"]
  node_web["Web application<br/>[App.tsx]"]
  node_schools["School discovery<br/>[SchoolListPage.tsx]"]
  node_catalog["Product catalogue<br/>[CatalogPage.tsx]"]
  node_cart["Cart state<br/>[cart.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_tracking["Order tracking<br/>[TrackPage.tsx]"]
end

subgraph group_staff["Staff operations"]
  node_adminweb["Protected admin UI<br/>[ProtectedRoute.tsx]"]
  node_orderconsole["Order management<br/>[OrdersPage.tsx]"]
  node_catalogadmin["Catalog administration"]
  node_dashboard["Operations dashboard<br/>[DashboardPage.tsx]"]
end

subgraph group_domain["Backend domains"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_schoolservice["Schools and grades"]
  node_listservice["Official school lists"]
  node_productservice["Products and stock"]
  node_orders["Order lifecycle"]
end

subgraph group_insights["Analytics and insights"]
  node_analytics["Visitor analytics"]
  node_dashservice["Dashboard metrics"]
  node_audit["Audit logs"]
end

subgraph group_infra["Shared infrastructure"]
  node_api["HTTP API client<br/>[api.ts]"]
  node_storage["File storage<br/>[storage.service.ts]"]
  node_database[("Neon PostgreSQL")]
end

node_buyer(("Buyer"))
node_staffuser(("Staff user"))
node_r2[("Cloudflare R2")]

node_buyer -->|"uses"| node_web
node_web -->|"routes to"| node_schools
node_web -->|"routes to"| node_catalog
node_web -->|"routes to"| node_cart
node_web -->|"routes to"| node_checkout
node_web -->|"routes to"| node_tracking
node_staffuser -->|"uses"| node_adminweb
node_web -->|"protects routes"| node_adminweb
node_web -->|"routes to"| node_orderconsole
node_web -->|"routes to"| node_catalogadmin
node_web -->|"routes to"| node_dashboard
node_checkout -.->|"submits via"| node_api
node_tracking -.->|"queries via"| node_api
node_orderconsole -.->|"operates via"| node_api
node_catalogadmin -.->|"manages via"| node_api
node_dashboard -.->|"loads via"| node_api
node_api -.->|"calls API"| node_orders
node_api -.->|"calls API"| node_schoolservice
node_api -.->|"calls API"| node_listservice
node_api -.->|"calls API"| node_productservice
node_api -.->|"calls API"| node_auth
node_orders -.->|"persists orders"| node_database
node_schoolservice -.->|"stores school data"| node_database
node_listservice -.->|"stores lists"| node_database
node_productservice -.->|"stores products"| node_database
node_analytics -.->|"stores events"| node_database
node_dashservice -.->|"reads metrics"| node_database
node_audit -.->|"stores audit data"| node_database
node_storage -->|"stores files"| node_r2
node_storage -->|"persists file URLs"| node_database
node_orders -.->|"generates order files"| node_storage

click node_web "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/App.tsx"
click node_schools "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/SchoolListPage.tsx"
click node_catalog "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/CatalogPage.tsx"
click node_cart "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/store/cart.tsx"
click node_checkout "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/CheckoutPage.tsx"
click node_tracking "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/TrackPage.tsx"
click node_adminweb "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/components/ProtectedRoute.tsx"
click node_orderconsole "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/OrdersPage.tsx"
click node_catalogadmin "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/AdminProductsPage.tsx"
click node_dashboard "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/DashboardPage.tsx"
click node_auth "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/auth/auth.service.ts"
click node_schoolservice "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/schools/schools.controller.ts"
click node_listservice "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/school-lists/school-lists.controller.ts"
click node_productservice "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/products/products.controller.ts"
click node_orders "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/orders/orders.controller.ts"
click node_analytics "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/analytics/analytics.controller.ts"
click node_dashservice "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/dashboard/dashboard.controller.ts"
click node_audit "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/audit/audit.controller.ts"
click node_api "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/lib/api.ts"
click node_storage "https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/storage/storage.service.ts"

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_web,node_schools,node_catalog,node_cart,node_checkout,node_tracking,node_staffuser toneBlue
class node_adminweb,node_orderconsole,node_catalogadmin,node_dashboard,node_r2 toneAmber
class node_auth,node_schoolservice,node_listservice,node_productservice,node_orders toneMint
class node_analytics,node_dashservice,node_audit toneRose
class node_api,node_storage,node_database,node_buyer toneIndigo
```

## Components

### Buyer storefront

- [Web application](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/App.tsx): `apps/frontend/src/App.tsx`
- [School discovery](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/SchoolListPage.tsx): `apps/frontend/src/pages/SchoolListPage.tsx`
- [Product catalogue](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/CatalogPage.tsx): `apps/frontend/src/pages/CatalogPage.tsx`
- [Cart state](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/store/cart.tsx): `apps/frontend/src/store/cart.tsx`
- [Checkout](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/CheckoutPage.tsx): `apps/frontend/src/pages/CheckoutPage.tsx`
- [Order tracking](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/TrackPage.tsx): `apps/frontend/src/pages/TrackPage.tsx`

### Staff operations

- [Protected admin UI](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/components/ProtectedRoute.tsx): `apps/frontend/src/components/ProtectedRoute.tsx`
- [Order management](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/OrdersPage.tsx): `apps/frontend/src/pages/admin/OrdersPage.tsx`
- [Catalog administration](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/AdminProductsPage.tsx): `apps/frontend/src/pages/admin/AdminProductsPage.tsx`
- [Operations dashboard](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/pages/admin/DashboardPage.tsx): `apps/frontend/src/pages/admin/DashboardPage.tsx`

### Backend domains

- [Authentication](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/auth/auth.service.ts): `apps/backend/src/auth/auth.service.ts`
- [Schools and grades](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/schools/schools.controller.ts): `apps/backend/src/schools/schools.controller.ts`
- [Official school lists](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/school-lists/school-lists.controller.ts): `apps/backend/src/school-lists/school-lists.controller.ts`
- [Products and stock](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/products/products.controller.ts): `apps/backend/src/products/products.controller.ts`
- [Order lifecycle](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/orders/orders.controller.ts): `apps/backend/src/orders/orders.controller.ts`

### Analytics and insights

- [Visitor analytics](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/analytics/analytics.controller.ts): `apps/backend/src/analytics/analytics.controller.ts`
- [Dashboard metrics](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/dashboard/dashboard.controller.ts): `apps/backend/src/dashboard/dashboard.controller.ts`
- [Audit logs](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/audit/audit.controller.ts): `apps/backend/src/audit/audit.controller.ts`

### Shared infrastructure

- [HTTP API client](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/frontend/src/lib/api.ts): `apps/frontend/src/lib/api.ts`
- [File storage](https://github.com/mohamedabakhir/elcartable-platforme/blob/main/apps/backend/src/storage/storage.service.ts): `apps/backend/src/storage/storage.service.ts`
- **Neon PostgreSQL**

### Other components

- **Buyer**
- **Staff user**
- **Cloudflare R2**

## Connections

- Buyer → Web application: uses (evidence: `apps/frontend/src/App.tsx`)
- Web application → School discovery: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Product catalogue: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Cart state: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Checkout: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Order tracking: routes to (evidence: `apps/frontend/src/App.tsx`)
- Staff user → Protected admin UI: uses
- Web application → Protected admin UI: protects routes (evidence: `apps/frontend/src/App.tsx`)
- Web application → Order management: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Catalog administration: routes to (evidence: `apps/frontend/src/App.tsx`)
- Web application → Operations dashboard: routes to (evidence: `apps/frontend/src/App.tsx`)
- Checkout → HTTP API client: submits via
- Order tracking → HTTP API client: queries via (evidence: `apps/frontend/src/pages/TrackPage.tsx`)
- Order management → HTTP API client: operates via
- Catalog administration → HTTP API client: manages via
- Operations dashboard → HTTP API client: loads via
- HTTP API client → Order lifecycle: calls API
- HTTP API client → Schools and grades: calls API
- HTTP API client → Official school lists: calls API
- HTTP API client → Products and stock: calls API
- HTTP API client → Authentication: calls API
- Order lifecycle → Neon PostgreSQL: persists orders
- Schools and grades → Neon PostgreSQL: stores school data
- Official school lists → Neon PostgreSQL: stores lists
- Products and stock → Neon PostgreSQL: stores products
- Visitor analytics → Neon PostgreSQL: stores events
- Dashboard metrics → Neon PostgreSQL: reads metrics
- Audit logs → Neon PostgreSQL: stores audit data
- File storage → Cloudflare R2: stores files (evidence: `README.md`)
- File storage → Neon PostgreSQL: persists file URLs (evidence: `README.md`)
- Order lifecycle → File storage: generates order files
