# moamenelsayedabdelmoamen-hue/el-batal-express-dashboard architecture

> Architecture diagram of the GitHub repository moamenelsayedabdelmoamen-hue/el-batal-express-dashboard, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard
- Repository: https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard

## Overview

This is an administrative operations dashboard for a delivery/merchant platform, backed by Firebase and callable Cloud Functions. Admins authenticate, enter protected operations screens, and manage merchants, captains, orders, subscriptions, shifts, payments, and live dispatch-related information. The graph groups the major operational domains while retaining the frontend service layer and backend callable services. Source excerpts confirm routing, Firebase setup, and selected data access; many page implementations and backend registrations were not sampled, so uncertain links are omitted or marked unverified.

Main entry points: [`src/App.tsx`](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/App.tsx) (Application routes), [`functions/src/index.ts`](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/index.ts) (Callable function entry), [`src/services/orderService.ts`](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/services/orderService.ts) (Order data service), [`src/contexts/AuthContext.tsx`](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/contexts/AuthContext.tsx) (Admin authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Dashboard app"]
  node_app["Application routes<br/>[App.tsx]"]
  node_auth["Admin authentication<br/>[AuthContext.tsx]"]
  node_guard["Protected routes<br/>[ProtectedRoute.tsx]"]
  node_notifications["Admin notifications"]
end

subgraph group_operations["Delivery operations"]
  node_dashboard["Operations dashboard<br/>[Dashboard.tsx]"]
  node_merchant["Merchant management<br/>[Restaurants.tsx]"]
  node_captains["Captain management<br/>[Captains.tsx]"]
  node_registrations["Captain approvals"]
  node_orders["Order management<br/>[Orders.tsx]"]
  node_dispatch["Live map and dispatch<br/>[LiveMap.tsx]"]
  node_shifts["Captain schedules<br/>[CaptainShifts.tsx]"]
  node_order_service["Order data service<br/>[orderService.ts]"]
end

subgraph group_billing["Subscriptions and billing"]
  node_subscriptions["Subscription management<br/>[Subscriptions.tsx]"]
  node_requests["Subscription requests"]
  node_payments["Payments and plans<br/>[Payments.tsx]"]
  node_subscription_service["Subscription data service"]
end

subgraph group_platform["Firebase platform"]
  node_firebase["Firebase client setup<br/>[config.ts]"]
  node_firestore[("Firestore records")]
end

subgraph group_backend["Callable backend"]
  node_functions_entry["Callable function entry<br/>[index.ts]"]
  node_order_backend["Order workflows<br/>[ordersService.ts]"]
  node_subscription_backend["Manual subscription workflows"]
  node_captain_backend["Captain approval workflows"]
  node_shift_backend["Shift rules<br/>[shifts.ts]"]
end

node_admin(("Administrator"))

node_admin -->|"uses"| node_app
node_app -->|"routes through"| node_guard
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_merchant
node_app -->|"routes to"| node_captains
node_app -->|"routes to"| node_registrations
node_app -->|"routes to"| node_orders
node_app -->|"routes to"| node_dispatch
node_app -->|"routes to"| node_shifts
node_app -->|"routes to"| node_subscriptions
node_app -->|"routes to"| node_requests
node_app -->|"routes to"| node_payments
node_auth -->|"uses services"| node_firebase
node_firebase -->|"initializes"| node_firestore
node_order_service -->|"reads and writes"| node_firestore
node_order_service -.->|"calls callable"| node_functions_entry
node_subscription_service -->|"uses records"| node_firestore
node_notifications -->|"subscribes to updates"| node_firestore
node_functions_entry -.->|"dispatches to"| node_order_backend
node_functions_entry -.->|"dispatches to"| node_subscription_backend
node_functions_entry -.->|"dispatches to"| node_captain_backend
node_functions_entry -.->|"dispatches to"| node_shift_backend

click node_app "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/App.tsx"
click node_auth "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/contexts/AuthContext.tsx"
click node_guard "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/routes/ProtectedRoute.tsx"
click node_dashboard "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Dashboard.tsx"
click node_merchant "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Restaurants.tsx"
click node_captains "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Captains.tsx"
click node_registrations "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/CaptainRegistrations.tsx"
click node_orders "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Orders.tsx"
click node_dispatch "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/LiveMap.tsx"
click node_shifts "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/CaptainShifts.tsx"
click node_order_service "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/services/orderService.ts"
click node_subscriptions "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Subscriptions.tsx"
click node_requests "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/SubscriptionRequests.tsx"
click node_payments "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Payments.tsx"
click node_subscription_service "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/services/subscriptionService.ts"
click node_notifications "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/contexts/NotificationContext.tsx"
click node_firebase "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/firebase/config.ts"
click node_functions_entry "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/index.ts"
click node_order_backend "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/ordersService.ts"
click node_subscription_backend "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/manualSubscriptionsService.ts"
click node_captain_backend "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/captainApprovalService.ts"
click node_shift_backend "https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/shifts.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_app,node_auth,node_guard,node_notifications toneBlue
class node_dashboard,node_merchant,node_captains,node_registrations,node_orders,node_dispatch,node_shifts,node_order_service toneAmber
class node_subscriptions,node_requests,node_payments,node_subscription_service toneMint
class node_firebase,node_firestore toneRose
class node_functions_entry,node_order_backend,node_subscription_backend,node_captain_backend,node_shift_backend,node_admin toneIndigo
```

## Components

### Dashboard app

- [Application routes](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/App.tsx): `src/App.tsx`
- [Admin authentication](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Protected routes](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/routes/ProtectedRoute.tsx): `src/routes/ProtectedRoute.tsx`
- [Admin notifications](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/contexts/NotificationContext.tsx): `src/contexts/NotificationContext.tsx`

### Delivery operations

- [Operations dashboard](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Merchant management](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Restaurants.tsx): `src/pages/Restaurants.tsx`
- [Captain management](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Captains.tsx): `src/pages/Captains.tsx`
- [Captain approvals](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/CaptainRegistrations.tsx): `src/pages/CaptainRegistrations.tsx`
- [Order management](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Orders.tsx): `src/pages/Orders.tsx`
- [Live map and dispatch](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/LiveMap.tsx): `src/pages/LiveMap.tsx`
- [Captain schedules](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/CaptainShifts.tsx): `src/pages/CaptainShifts.tsx`
- [Order data service](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/services/orderService.ts): `src/services/orderService.ts`

### Subscriptions and billing

- [Subscription management](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Subscriptions.tsx): `src/pages/Subscriptions.tsx`
- [Subscription requests](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/SubscriptionRequests.tsx): `src/pages/SubscriptionRequests.tsx`
- [Payments and plans](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/pages/Payments.tsx): `src/pages/Payments.tsx`
- [Subscription data service](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/services/subscriptionService.ts): `src/services/subscriptionService.ts`

### Firebase platform

- [Firebase client setup](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/src/firebase/config.ts): `src/firebase/config.ts`
- **Firestore records**

### Callable backend

- [Callable function entry](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/index.ts): `functions/src/index.ts`
- [Order workflows](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/ordersService.ts): `functions/src/ordersService.ts`
- [Manual subscription workflows](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/manualSubscriptionsService.ts): `functions/src/manualSubscriptionsService.ts`
- [Captain approval workflows](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/captainApprovalService.ts): `functions/src/captainApprovalService.ts`
- [Shift rules](https://github.com/moamenelsayedabdelmoamen-hue/el-batal-express-dashboard/blob/main/functions/src/shifts.ts): `functions/src/shifts.ts`

### Other components

- **Administrator**

## Connections

- Administrator → Application routes: uses (evidence: `src/App.tsx`)
- Application routes → Protected routes: routes through (evidence: `src/App.tsx`)
- Application routes → Admin authentication: provides auth (evidence: `src/App.tsx`)
- Application routes → Operations dashboard: routes to (evidence: `src/App.tsx`)
- Application routes → Merchant management: routes to (evidence: `src/App.tsx`)
- Application routes → Captain management: routes to (evidence: `src/App.tsx`)
- Application routes → Captain approvals: routes to (evidence: `src/App.tsx`)
- Application routes → Order management: routes to (evidence: `src/App.tsx`)
- Application routes → Live map and dispatch: routes to (evidence: `src/App.tsx`)
- Application routes → Captain schedules: routes to (evidence: `src/App.tsx`)
- Application routes → Subscription management: routes to (evidence: `src/App.tsx`)
- Application routes → Subscription requests: routes to (evidence: `src/App.tsx`)
- Application routes → Payments and plans: routes to (evidence: `src/App.tsx`)
- Admin authentication → Firebase client setup: uses services (evidence: `src/contexts/AuthContext.tsx`)
- Firebase client setup → Firestore records: initializes (evidence: `src/firebase/config.ts`)
- Order data service → Firestore records: reads and writes (evidence: `src/services/orderService.ts`)
- Order data service → Callable function entry: calls callable
- Subscription data service → Firestore records: uses records (evidence: `src/services/subscriptionService.ts`)
- Admin notifications → Firestore records: subscribes to updates (evidence: `src/contexts/NotificationContext.tsx`)
- Callable function entry → Order workflows: dispatches to (evidence: `functions/src/index.ts`)
- Callable function entry → Manual subscription workflows: dispatches to (evidence: `functions/src/index.ts`)
- Callable function entry → Captain approval workflows: dispatches to (evidence: `functions/src/index.ts`)
- Callable function entry → Shift rules: dispatches to (evidence: `functions/src/index.ts`)
