# community-vercel/ustaadpro-admin architecture

> Architecture diagram of the GitHub repository community-vercel/ustaadpro-admin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/community-vercel/ustaadpro-admin
- Repository: https://github.com/community-vercel/ustaadpro-admin

## Overview

This is a Next.js admin console for UstaadPro: administrators sign in, then manage operational data and app configuration through domain pages, with requests delegated to shared API/resource clients. Sampled pages confirm dashboard reporting, service and shop catalogs, orders, complaints, providers, bot controls, and app settings; other listed admin sections are included as documented by the route tree, but their internal wiring was not sampled.

Main entry points: [`src/lib/api.ts`](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/api.ts) (Backend API client), [`src/app/api/admin-login/route.ts`](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/api/admin-login/route.ts) (Admin login API), [`src/app/OverviewClient.tsx`](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/OverviewClient.tsx) (Dashboard), [`src/app/login/page.tsx`](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/login/page.tsx) (Login page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Admin access"]
  node_login["Login page<br/>[page.tsx]"]
  node_login_route["Admin login API<br/>[route.ts]"]
  node_session["Session signing<br/>[adminSession.ts]"]
  node_auth_gate["Admin auth gate"]
end

subgraph group_operations["Operations"]
  node_overview["Dashboard<br/>[OverviewClient.tsx]"]
  node_orders["Service orders<br/>[page.tsx]"]
  node_receipts["Payment receipts<br/>[page.tsx]"]
  node_subscriptions["Subscriptions<br/>[page.tsx]"]
  node_complaints["Complaints<br/>[page.tsx]"]
  node_users["User accounts<br/>[page.tsx]"]
  node_shop_orders["Shop orders<br/>[page.tsx]"]
end

subgraph group_catalog["Catalog management"]
  node_services["Service catalog<br/>[page.tsx]"]
  node_products["Shop products<br/>[page.tsx]"]
  node_providers["Provider resources<br/>[page.tsx]"]
end

subgraph group_platform["Platform controls"]
  node_broadcast["Broadcasts<br/>[page.tsx]"]
  node_bot["WhatsApp bot"]
  node_app_control["App configuration<br/>[page.tsx]"]
end

subgraph group_shared["Shared runtime"]
  node_api_client["Backend API client<br/>[api.ts]"]
  node_firebase["Firebase resources"]
end

node_admin(("Administrator"))
node_backend{{"UstaadPro API"}}
node_firebase_service{{"Firebase"}}

node_admin -->|"opens"| node_login
node_login -->|"submits credentials"| node_login_route
node_login_route -->|"authenticates"| node_backend
node_login_route -->|"creates session"| node_session
node_auth_gate -->|"validates cookie"| node_session
node_admin -->|"views metrics"| node_overview
node_overview -->|"loads summary"| node_api_client
node_overview -->|"requests cleanup"| node_api_client
node_admin -->|"manages orders"| node_orders
node_orders -->|"loads order pages"| node_api_client
node_admin -->|"reviews complaints"| node_complaints
node_complaints -->|"loads complaints"| node_api_client
node_admin -->|"edits catalog"| node_services
node_services -->|"saves services"| node_api_client
node_admin -->|"manages inventory"| node_products
node_products -->|"loads and saves"| node_api_client
node_admin -->|"reviews providers"| node_providers
node_providers -->|"loads resources"| node_firebase
node_admin -->|"controls bot"| node_bot
node_bot -->|"controls and configures"| node_api_client
node_admin -->|"configures app"| node_app_control
node_app_control -->|"loads and saves settings"| node_api_client
node_api_client -->|"sends requests"| node_backend
node_admin -->|"reviews receipts"| node_receipts
node_admin -->|"manages plans"| node_subscriptions
node_admin -->|"manages users"| node_users
node_admin -->|"reviews shop orders"| node_shop_orders
node_admin -->|"sends broadcasts"| node_broadcast

click node_login "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/login/page.tsx"
click node_login_route "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/api/admin-login/route.ts"
click node_session "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/adminSession.ts"
click node_auth_gate "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/components/RequireAdminAuth.tsx"
click node_overview "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/OverviewClient.tsx"
click node_orders "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/orders/page.tsx"
click node_receipts "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/payment-receipts/page.tsx"
click node_subscriptions "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/subscriptions/page.tsx"
click node_complaints "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/complaints/page.tsx"
click node_users "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/users/page.tsx"
click node_shop_orders "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/shop-orders/page.tsx"
click node_services "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/services/page.tsx"
click node_products "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/shop-products/page.tsx"
click node_providers "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/resources/page.tsx"
click node_broadcast "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/broadcast/page.tsx"
click node_bot "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/whatsapp-bot/WhatsAppBotClient.tsx"
click node_app_control "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/app-control/page.tsx"
click node_api_client "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/api.ts"
click node_firebase "https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/firebaseResources.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_login,node_login_route,node_session,node_auth_gate toneBlue
class node_overview,node_orders,node_receipts,node_subscriptions,node_complaints,node_users,node_shop_orders toneAmber
class node_services,node_products,node_providers,node_backend toneMint
class node_broadcast,node_bot,node_app_control toneRose
class node_api_client,node_firebase,node_admin,node_firebase_service toneIndigo
```

## Components

### Admin access

- [Login page](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/login/page.tsx): `src/app/login/page.tsx`
- [Admin login API](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/api/admin-login/route.ts): `src/app/api/admin-login/route.ts`
- [Session signing](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/adminSession.ts): `src/lib/adminSession.ts`
- [Admin auth gate](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/components/RequireAdminAuth.tsx): `src/components/RequireAdminAuth.tsx`

### Operations

- [Dashboard](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/OverviewClient.tsx): `src/app/OverviewClient.tsx`
- [Service orders](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/orders/page.tsx): `src/app/orders/page.tsx`
- [Payment receipts](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/payment-receipts/page.tsx): `src/app/payment-receipts/page.tsx`
- [Subscriptions](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/subscriptions/page.tsx): `src/app/subscriptions/page.tsx`
- [Complaints](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/complaints/page.tsx): `src/app/complaints/page.tsx`
- [User accounts](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/users/page.tsx): `src/app/users/page.tsx`
- [Shop orders](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/shop-orders/page.tsx): `src/app/shop-orders/page.tsx`

### Catalog management

- [Service catalog](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/services/page.tsx): `src/app/services/page.tsx`
- [Shop products](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/shop-products/page.tsx): `src/app/shop-products/page.tsx`
- [Provider resources](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/resources/page.tsx): `src/app/resources/page.tsx`

### Platform controls

- [Broadcasts](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/broadcast/page.tsx): `src/app/broadcast/page.tsx`
- [WhatsApp bot](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/whatsapp-bot/WhatsAppBotClient.tsx): `src/app/whatsapp-bot/WhatsAppBotClient.tsx`
- [App configuration](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/app/app-control/page.tsx): `src/app/app-control/page.tsx`

### Shared runtime

- [Backend API client](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Firebase resources](https://github.com/community-vercel/ustaadpro-admin/blob/main/src/lib/firebaseResources.ts): `src/lib/firebaseResources.ts`

### Other components

- **Administrator**
- **UstaadPro API**
- **Firebase**

## Connections

- Administrator → Login page: opens
- Login page → Admin login API: submits credentials
- Admin login API → UstaadPro API: authenticates
- Admin login API → Session signing: creates session
- Admin auth gate → Session signing: validates cookie
- Administrator → Dashboard: views metrics
- Dashboard → Backend API client: loads summary
- Dashboard → Backend API client: requests cleanup
- Administrator → Service orders: manages orders
- Service orders → Backend API client: loads order pages
- Administrator → Complaints: reviews complaints
- Complaints → Backend API client: loads complaints
- Administrator → Service catalog: edits catalog
- Service catalog → Backend API client: saves services
- Administrator → Shop products: manages inventory
- Shop products → Backend API client: loads and saves
- Administrator → Provider resources: reviews providers
- Provider resources → Firebase resources: loads resources
- Administrator → WhatsApp bot: controls bot
- WhatsApp bot → Backend API client: controls and configures
- Administrator → App configuration: configures app
- App configuration → Backend API client: loads and saves settings
- Backend API client → UstaadPro API: sends requests
- Administrator → Payment receipts: reviews receipts
- Administrator → Subscriptions: manages plans
- Administrator → User accounts: manages users
- Administrator → Shop orders: reviews shop orders
- Administrator → Broadcasts: sends broadcasts
