# kundarwork-debug/apml-portal architecture

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

- Interactive diagram: https://gitdiagram.com/kundarwork-debug/apml-portal
- Repository: https://github.com/kundarwork-debug/apml-portal

## Overview

APML Portal is a React-based operations workspace that brings calculators, directories, document creation, file/media access, and information pages into one routed application. The main user flow is browser entry → shared portal shell → a selected tool → its result or connected service. The graph preserves the README’s major capabilities and the principal page modules; connections are limited to routes, imports, and service calls visible in the excerpts, source index, or README. Some integration and page internals were not sampled, so their links are omitted where evidence is insufficient.

Main entry points: [`src/App.jsx`](https://github.com/kundarwork-debug/apml-portal/blob/main/src/App.jsx) (Route map), [`src/lib/supabaseAuth.js`](https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/supabaseAuth.js) (Admin authentication), [`src/lib/firebase.js`](https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/firebase.js) (Firebase access), [`src/pages/Editor.jsx`](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Editor.jsx) (Quotation editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Portal application"]
  node_entry["React entry<br/>[main.jsx]"]
  node_routes["Route map<br/>[App.jsx]"]
  node_shell["Shared shell<br/>[Shell.jsx]"]
  node_modules["Module catalog<br/>[modules.js]"]
  node_home["Home workspace<br/>[Home.jsx]"]
end

subgraph group_workflows["Work tools"]
  node_editor["Quotation editor<br/>[Editor.jsx]"]
  node_localrate["Local rate calculator<br/>[LocalRate.jsx]"]
  node_carrate["Car rate calculator<br/>[CarRate.jsx]"]
  node_lite["APML Lite<br/>[ApmlLite.jsx]"]
end

subgraph group_resources["Shared resources"]
  node_directory["Branch directory<br/>[Directory.jsx]"]
  node_officers["Field officers<br/>[FieldOfficer.jsx]"]
  node_drive["APML Drive<br/>[Drive.jsx]"]
  node_gallery["Media gallery<br/>[Gallery.jsx]"]
end

subgraph group_services["Connected services"]
  node_health["System health<br/>[SystemHealth.jsx]"]
  node_quality["Quality monitor<br/>[QualityMonitor.jsx]"]
  node_admin["Administration<br/>[Admin.jsx]"]
  node_firebase["Firebase access<br/>[firebase.js]"]
  node_supabase["Admin authentication<br/>[supabaseAuth.js]"]
  node_firebase_db[("Firebase Realtime Database")]
  node_cloudinary["Cloudinary media service"]
  node_worker["Cloudflare Worker<br/>[worker.js]"]
  node_health_api["System health API<br/>[system-health.js]"]
end

subgraph group_information["Information and support"]
  node_bugreport["Bug report<br/>[BugReport.jsx]"]
  node_about["About and policies<br/>[InfoPage.jsx]"]
  node_policy["Privacy and terms<br/>[PolicyPage.jsx]"]
end

node_browser(("Portal user"))

node_browser -->|"opens"| node_entry
node_entry -->|"renders"| node_routes
node_routes -->|"wraps routes"| node_shell
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_editor
node_routes -->|"routes to"| node_health
node_routes -->|"routes to"| node_quality
node_routes -->|"routes to"| node_admin
node_routes -->|"routes to"| node_localrate
node_routes -->|"routes to"| node_carrate
node_routes -->|"routes to"| node_directory
node_routes -->|"routes to"| node_officers
node_routes -->|"routes to"| node_drive
node_routes -->|"routes to"| node_gallery
node_routes -->|"routes to"| node_lite
node_routes -->|"routes to"| node_bugreport
node_routes -->|"routes to"| node_about
node_routes -->|"routes to"| node_policy
node_home -->|"reads catalog"| node_modules
node_editor -->|"requests presence"| node_firebase
node_editor -->|"uploads PDF"| node_cloudinary
node_drive -->|"reads files"| node_firebase_db
node_drive -->|"uses admin auth"| node_supabase
node_gallery -->|"updates media"| node_firebase_db
node_gallery -->|"uses admin auth"| node_supabase
node_directory -->|"uses admin auth"| node_supabase
node_officers -->|"uses Firebase"| node_firebase
node_officers -->|"uses admin auth"| node_supabase
node_firebase -->|"connects to"| node_firebase_db
node_supabase -->|"not connected"| node_firebase
node_worker -.->|"may support API"| node_health_api

click node_entry "https://github.com/kundarwork-debug/apml-portal/blob/main/src/main.jsx"
click node_routes "https://github.com/kundarwork-debug/apml-portal/blob/main/src/App.jsx"
click node_shell "https://github.com/kundarwork-debug/apml-portal/blob/main/src/components/Shell.jsx"
click node_modules "https://github.com/kundarwork-debug/apml-portal/blob/main/src/data/modules.js"
click node_home "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Home.jsx"
click node_editor "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Editor.jsx"
click node_localrate "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/LocalRate.jsx"
click node_carrate "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/CarRate.jsx"
click node_lite "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/ApmlLite.jsx"
click node_directory "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Directory.jsx"
click node_officers "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/FieldOfficer.jsx"
click node_drive "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Drive.jsx"
click node_gallery "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Gallery.jsx"
click node_health "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/SystemHealth.jsx"
click node_quality "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/QualityMonitor.jsx"
click node_admin "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Admin.jsx"
click node_firebase "https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/firebase.js"
click node_supabase "https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/supabaseAuth.js"
click node_worker "https://github.com/kundarwork-debug/apml-portal/blob/main/cloudflare/worker.js"
click node_health_api "https://github.com/kundarwork-debug/apml-portal/blob/main/api/system-health.js"
click node_bugreport "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/BugReport.jsx"
click node_about "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/InfoPage.jsx"
click node_policy "https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/PolicyPage.jsx"

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_entry,node_routes,node_shell,node_modules,node_home,node_browser toneBlue
class node_editor,node_localrate,node_carrate,node_lite toneAmber
class node_directory,node_officers,node_drive,node_gallery toneMint
class node_health,node_quality,node_admin,node_firebase,node_supabase,node_firebase_db,node_cloudinary,node_worker,node_health_api toneRose
class node_bugreport,node_about,node_policy toneIndigo
```

## Components

### Portal application

- [React entry](https://github.com/kundarwork-debug/apml-portal/blob/main/src/main.jsx): `src/main.jsx`
- [Route map](https://github.com/kundarwork-debug/apml-portal/blob/main/src/App.jsx): `src/App.jsx`
- [Shared shell](https://github.com/kundarwork-debug/apml-portal/blob/main/src/components/Shell.jsx): `src/components/Shell.jsx`
- [Module catalog](https://github.com/kundarwork-debug/apml-portal/blob/main/src/data/modules.js): `src/data/modules.js`
- [Home workspace](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`

### Work tools

- [Quotation editor](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Editor.jsx): `src/pages/Editor.jsx`
- [Local rate calculator](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/LocalRate.jsx): `src/pages/LocalRate.jsx`
- [Car rate calculator](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/CarRate.jsx): `src/pages/CarRate.jsx`
- [APML Lite](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/ApmlLite.jsx): `src/pages/ApmlLite.jsx`

### Shared resources

- [Branch directory](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Directory.jsx): `src/pages/Directory.jsx`
- [Field officers](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/FieldOfficer.jsx): `src/pages/FieldOfficer.jsx`
- [APML Drive](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Drive.jsx): `src/pages/Drive.jsx`
- [Media gallery](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Gallery.jsx): `src/pages/Gallery.jsx`

### Connected services

- [System health](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/SystemHealth.jsx): `src/pages/SystemHealth.jsx`
- [Quality monitor](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/QualityMonitor.jsx): `src/pages/QualityMonitor.jsx`
- [Administration](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/Admin.jsx): `src/pages/Admin.jsx`
- [Firebase access](https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/firebase.js): `src/lib/firebase.js`
- [Admin authentication](https://github.com/kundarwork-debug/apml-portal/blob/main/src/lib/supabaseAuth.js): `src/lib/supabaseAuth.js`
- **Firebase Realtime Database**
- **Cloudinary media service**
- [Cloudflare Worker](https://github.com/kundarwork-debug/apml-portal/blob/main/cloudflare/worker.js): `cloudflare/worker.js`
- [System health API](https://github.com/kundarwork-debug/apml-portal/blob/main/api/system-health.js): `api/system-health.js`

### Information and support

- [Bug report](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/BugReport.jsx): `src/pages/BugReport.jsx`
- [About and policies](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/InfoPage.jsx): `src/pages/InfoPage.jsx`
- [Privacy and terms](https://github.com/kundarwork-debug/apml-portal/blob/main/src/pages/PolicyPage.jsx): `src/pages/PolicyPage.jsx`

### Other components

- **Portal user**

## Connections

- Portal user → React entry: opens (evidence: `src/main.jsx`)
- React entry → Route map: renders (evidence: `src/main.jsx`)
- Route map → Shared shell: wraps routes (evidence: `src/App.jsx`)
- Route map → Home workspace: routes to (evidence: `src/App.jsx`)
- Route map → Quotation editor: routes to (evidence: `src/App.jsx`)
- Route map → System health: routes to (evidence: `src/App.jsx`)
- Route map → Quality monitor: routes to (evidence: `src/App.jsx`)
- Route map → Administration: routes to (evidence: `src/App.jsx`)
- Route map → Local rate calculator: routes to (evidence: `src/App.jsx`)
- Route map → Car rate calculator: routes to (evidence: `src/App.jsx`)
- Route map → Branch directory: routes to (evidence: `src/App.jsx`)
- Route map → Field officers: routes to (evidence: `src/App.jsx`)
- Route map → APML Drive: routes to (evidence: `src/App.jsx`)
- Route map → Media gallery: routes to (evidence: `src/App.jsx`)
- Route map → APML Lite: routes to (evidence: `src/App.jsx`)
- Route map → Bug report: routes to (evidence: `src/App.jsx`)
- Route map → About and policies: routes to (evidence: `src/App.jsx`)
- Route map → Privacy and terms: routes to (evidence: `src/App.jsx`)
- Home workspace → Module catalog: reads catalog (evidence: `src/pages/Home.jsx`)
- Quotation editor → Firebase access: requests presence (evidence: `src/pages/Editor.jsx`)
- Quotation editor → Cloudinary media service: uploads PDF (evidence: `src/pages/Editor.jsx`)
- APML Drive → Firebase Realtime Database: reads files (evidence: `src/pages/Drive.jsx`)
- APML Drive → Admin authentication: uses admin auth (evidence: `src/pages/Drive.jsx`)
- Media gallery → Firebase Realtime Database: updates media (evidence: `src/pages/Gallery.jsx`)
- Media gallery → Admin authentication: uses admin auth (evidence: `src/pages/Gallery.jsx`)
- Branch directory → Admin authentication: uses admin auth (evidence: `src/pages/Directory.jsx`)
- Field officers → Firebase access: uses Firebase (evidence: `src/pages/FieldOfficer.jsx`)
- Field officers → Admin authentication: uses admin auth (evidence: `src/pages/FieldOfficer.jsx`)
- Firebase access → Firebase Realtime Database: connects to (evidence: `src/lib/firebase.js`)
- Admin authentication → Firebase access: not connected
- Cloudflare Worker → System health API: may support API
