# 9090856788/courier_delivery_app architecture

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

- Interactive diagram: https://gitdiagram.com/9090856788/courier_delivery_app
- Repository: https://github.com/9090856788/courier_delivery_app

## Overview

CargoPilot is a courier logistics platform with a public customer experience and a protected operations console, backed by an Express REST API. The main workflow lets customers track shipments or request a shipping quote; authenticated staff create and manage parcels, record checkpoints, and review operational metrics. The backend routes requests through controllers to parcel/pricing and analytics logic, with MongoDB or a documented in-memory fallback. The graph reflects the supplied route/controller excerpts, source index, and README; unsampled feature internals are represented at their documented subsystem paths.

Main entry points: [`backend/server.js`](https://github.com/9090856788/courier_delivery_app/blob/master/backend/server.js) (Express API), [`src/App.jsx`](https://github.com/9090856788/courier_delivery_app/blob/master/src/App.jsx) (Admin console), [`backend/controllers/parcelController.js`](https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/parcelController.js) (Parcel operations), [`src/features/parcels/parcelSlice.js`](https://github.com/9090856788/courier_delivery_app/blob/master/src/features/parcels/parcelSlice.js) (Parcel state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Customer experience"]
  node_publicapp["Public web app<br/>[App.jsx]"]
  node_tracking["Parcel tracking<br/>[TrackParcel.jsx]"]
  node_quote["Rate calculator<br/>[CalculateCost.jsx]"]
end

subgraph group_admin["Operations console"]
  node_console["Admin console<br/>[App.jsx]"]
  node_login["Staff login<br/>[Login.jsx]"]
  node_dashboard["KPI dashboard<br/>[Dashboard.jsx]"]
  node_create["Parcel creation<br/>[CreateParcel.jsx]"]
  node_manage["Parcel management<br/>[ManageParcels.jsx]"]
  node_details["Parcel details<br/>[ParcelDetails.jsx]"]
  node_milestones["Checkpoint tracking<br/>[ParcelTracking.jsx]"]
  node_analytics["Analytics reports<br/>[Analytics.jsx]"]
  node_staffadmin["Staff provisioning<br/>[AddAdmin.jsx]"]
  node_authstate["Auth state<br/>[authSlice.js]"]
  node_parcelstate["Parcel state<br/>[parcelSlice.js]"]
  node_dashstate["Dashboard state<br/>[dashboardSlice.js]"]
end

subgraph group_api["API and services"]
  node_api["Express API<br/>[server.js]"]
  node_parcelroutes["Parcel routes<br/>[parcelRoutes.js]"]
  node_authroutes["Auth routes<br/>[authRoutes.js]"]
  node_dashroutes["Dashboard routes<br/>[dashboardRoutes.js]"]
  node_analyticroutes["Analytics routes<br/>[analyticsRoutes.js]"]
  node_parcelctrl["Parcel operations"]
  node_authctrl["Authentication<br/>[authController.js]"]
  node_dashctrl["Dashboard metrics"]
  node_analyticctrl["Analytics reporting"]
  node_pricing["Cost calculation<br/>[calculateCost.js]"]
  node_trackingid["Tracking ID generation"]
  node_authmw["Access control<br/>[authMiddleware.js]"]
end

subgraph group_data["Persistence and identity"]
  node_mongodb[("MongoDB")]
  node_dbconnect["Database connection<br/>[dbConnection.js]"]
  node_memorystore[("Memory fallback<br/>[memoryStore.js]")]
  node_parcelmodel[("Parcel records<br/>[parcelSchema.js]")]
  node_usermodel[("User records<br/>[userSchema.js]")]
end

node_customer(("Customer"))
node_adminuser(("Operations staff"))

node_customer -->|"uses"| node_publicapp
node_publicapp -->|"routes to"| node_tracking
node_publicapp -->|"routes to"| node_quote
node_tracking -.->|"requests tracking"| node_api
node_quote -.->|"requests quote"| node_api
node_adminuser -->|"uses"| node_console
node_console -->|"routes to"| node_login
node_console -->|"routes to"| node_dashboard
node_console -->|"routes to"| node_create
node_console -->|"routes to"| node_manage
node_console -->|"routes to"| node_details
node_console -->|"routes to"| node_milestones
node_console -->|"routes to"| node_analytics
node_console -->|"routes to"| node_staffadmin
node_create -->|"dispatches create"| node_parcelstate
node_manage -->|"uses"| node_parcelstate
node_dashboard -->|"uses"| node_parcelstate
node_dashboard -->|"uses"| node_dashstate
node_login -.->|"dispatches login"| node_authstate
node_staffadmin -->|"dispatches registration"| node_authstate
node_authstate -->|"posts credentials"| node_api
node_parcelstate -.->|"requests parcel actions"| node_api
node_api -->|"mounts route"| node_parcelroutes
node_api -->|"mounts route"| node_authroutes
node_api -->|"mounts route"| node_dashroutes
node_api -->|"mounts route"| node_analyticroutes
node_parcelroutes -->|"dispatches handlers"| node_parcelctrl
node_authroutes -->|"dispatches handlers"| node_authctrl
node_dashroutes -->|"dispatches handler"| node_dashctrl
node_analyticroutes -->|"dispatches handlers"| node_analyticctrl
node_parcelroutes -->|"protects endpoints"| node_authmw
node_authroutes -->|"protects endpoints"| node_authmw
node_parcelctrl -->|"calculates price"| node_pricing
node_parcelctrl -->|"generates ID"| node_trackingid
node_parcelctrl -->|"reads and writes"| node_parcelmodel
node_authctrl -->|"uses user model"| node_usermodel
node_authmw -->|"looks up user"| node_usermodel
node_dashctrl -.->|"uses analytics service"| node_analyticctrl
node_api -->|"connects at startup"| node_dbconnect
node_dbconnect -.->|"connects when configured"| node_mongodb
node_api -.->|"falls back to"| node_memorystore

click node_publicapp "https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/App.jsx"
click node_tracking "https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/pages/TrackParcel.jsx"
click node_quote "https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/pages/CalculateCost.jsx"
click node_console "https://github.com/9090856788/courier_delivery_app/blob/master/src/App.jsx"
click node_login "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Login.jsx"
click node_dashboard "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Dashboard.jsx"
click node_create "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/CreateParcel.jsx"
click node_manage "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ManageParcels.jsx"
click node_details "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ParcelDetails.jsx"
click node_milestones "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ParcelTracking.jsx"
click node_analytics "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Analytics.jsx"
click node_staffadmin "https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/AddAdmin.jsx"
click node_authstate "https://github.com/9090856788/courier_delivery_app/blob/master/src/features/auth/authSlice.js"
click node_parcelstate "https://github.com/9090856788/courier_delivery_app/blob/master/src/features/parcels/parcelSlice.js"
click node_dashstate "https://github.com/9090856788/courier_delivery_app/blob/master/src/features/dashboard/dashboardSlice.js"
click node_api "https://github.com/9090856788/courier_delivery_app/blob/master/backend/server.js"
click node_parcelroutes "https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/parcelRoutes.js"
click node_authroutes "https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/authRoutes.js"
click node_dashroutes "https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/dashboardRoutes.js"
click node_analyticroutes "https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/analyticsRoutes.js"
click node_parcelctrl "https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/parcelController.js"
click node_authctrl "https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/authController.js"
click node_dashctrl "https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/dashboardController.js"
click node_analyticctrl "https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/analyticsController.js"
click node_pricing "https://github.com/9090856788/courier_delivery_app/blob/master/backend/services/calculateCost.js"
click node_trackingid "https://github.com/9090856788/courier_delivery_app/blob/master/backend/services/generateTrackingId.js"
click node_authmw "https://github.com/9090856788/courier_delivery_app/blob/master/backend/middlewares/authMiddleware.js"
click node_dbconnect "https://github.com/9090856788/courier_delivery_app/blob/master/backend/db/dbConnection.js"
click node_memorystore "https://github.com/9090856788/courier_delivery_app/blob/master/backend/db/memoryStore.js"
click node_parcelmodel "https://github.com/9090856788/courier_delivery_app/blob/master/backend/models/parcelSchema.js"
click node_usermodel "https://github.com/9090856788/courier_delivery_app/blob/master/backend/models/userSchema.js"

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_publicapp,node_tracking,node_quote toneBlue
class node_console,node_login,node_dashboard,node_create,node_manage,node_details,node_milestones,node_analytics,node_staffadmin,node_authstate,node_parcelstate,node_dashstate toneAmber
class node_api,node_parcelroutes,node_authroutes,node_dashroutes,node_analyticroutes,node_parcelctrl,node_authctrl,node_dashctrl,node_analyticctrl,node_pricing,node_trackingid,node_authmw toneMint
class node_mongodb,node_dbconnect,node_memorystore,node_parcelmodel,node_usermodel toneRose
class node_customer,node_adminuser toneIndigo
```

## Components

### Customer experience

- [Public web app](https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Parcel tracking](https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/pages/TrackParcel.jsx): `frontend/src/pages/TrackParcel.jsx`
- [Rate calculator](https://github.com/9090856788/courier_delivery_app/blob/master/frontend/src/pages/CalculateCost.jsx): `frontend/src/pages/CalculateCost.jsx`

### Operations console

- [Admin console](https://github.com/9090856788/courier_delivery_app/blob/master/src/App.jsx): `src/App.jsx`
- [Staff login](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Login.jsx): `src/pages/Login.jsx`
- [KPI dashboard](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Parcel creation](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/CreateParcel.jsx): `src/pages/CreateParcel.jsx`
- [Parcel management](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ManageParcels.jsx): `src/pages/ManageParcels.jsx`
- [Parcel details](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ParcelDetails.jsx): `src/pages/ParcelDetails.jsx`
- [Checkpoint tracking](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/ParcelTracking.jsx): `src/pages/ParcelTracking.jsx`
- [Analytics reports](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/Analytics.jsx): `src/pages/Analytics.jsx`
- [Staff provisioning](https://github.com/9090856788/courier_delivery_app/blob/master/src/pages/AddAdmin.jsx): `src/pages/AddAdmin.jsx`
- [Auth state](https://github.com/9090856788/courier_delivery_app/blob/master/src/features/auth/authSlice.js): `src/features/auth/authSlice.js`
- [Parcel state](https://github.com/9090856788/courier_delivery_app/blob/master/src/features/parcels/parcelSlice.js): `src/features/parcels/parcelSlice.js`
- [Dashboard state](https://github.com/9090856788/courier_delivery_app/blob/master/src/features/dashboard/dashboardSlice.js): `src/features/dashboard/dashboardSlice.js`

### API and services

- [Express API](https://github.com/9090856788/courier_delivery_app/blob/master/backend/server.js): `backend/server.js`
- [Parcel routes](https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/parcelRoutes.js): `backend/routes/parcelRoutes.js`
- [Auth routes](https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Dashboard routes](https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/dashboardRoutes.js): `backend/routes/dashboardRoutes.js`
- [Analytics routes](https://github.com/9090856788/courier_delivery_app/blob/master/backend/routes/analyticsRoutes.js): `backend/routes/analyticsRoutes.js`
- [Parcel operations](https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/parcelController.js): `backend/controllers/parcelController.js`
- [Authentication](https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/authController.js): `backend/controllers/authController.js`
- [Dashboard metrics](https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/dashboardController.js): `backend/controllers/dashboardController.js`
- [Analytics reporting](https://github.com/9090856788/courier_delivery_app/blob/master/backend/controllers/analyticsController.js): `backend/controllers/analyticsController.js`
- [Cost calculation](https://github.com/9090856788/courier_delivery_app/blob/master/backend/services/calculateCost.js): `backend/services/calculateCost.js`
- [Tracking ID generation](https://github.com/9090856788/courier_delivery_app/blob/master/backend/services/generateTrackingId.js): `backend/services/generateTrackingId.js`
- [Access control](https://github.com/9090856788/courier_delivery_app/blob/master/backend/middlewares/authMiddleware.js): `backend/middlewares/authMiddleware.js`

### Persistence and identity

- **MongoDB**
- [Database connection](https://github.com/9090856788/courier_delivery_app/blob/master/backend/db/dbConnection.js): `backend/db/dbConnection.js`
- [Memory fallback](https://github.com/9090856788/courier_delivery_app/blob/master/backend/db/memoryStore.js): `backend/db/memoryStore.js`
- [Parcel records](https://github.com/9090856788/courier_delivery_app/blob/master/backend/models/parcelSchema.js): `backend/models/parcelSchema.js`
- [User records](https://github.com/9090856788/courier_delivery_app/blob/master/backend/models/userSchema.js): `backend/models/userSchema.js`

### Other components

- **Customer**
- **Operations staff**

## Connections

- Customer → Public web app: uses (evidence: `frontend/src/App.jsx`)
- Public web app → Parcel tracking: routes to (evidence: `frontend/src/App.jsx`)
- Public web app → Rate calculator: routes to (evidence: `frontend/src/App.jsx`)
- Parcel tracking → Express API: requests tracking
- Rate calculator → Express API: requests quote
- Operations staff → Admin console: uses (evidence: `src/App.jsx`)
- Admin console → Staff login: routes to (evidence: `src/App.jsx`)
- Admin console → KPI dashboard: routes to (evidence: `src/App.jsx`)
- Admin console → Parcel creation: routes to (evidence: `src/App.jsx`)
- Admin console → Parcel management: routes to (evidence: `src/App.jsx`)
- Admin console → Parcel details: routes to (evidence: `src/App.jsx`)
- Admin console → Checkpoint tracking: routes to (evidence: `src/App.jsx`)
- Admin console → Analytics reports: routes to (evidence: `src/App.jsx`)
- Admin console → Staff provisioning: routes to (evidence: `src/App.jsx`)
- Parcel creation → Parcel state: dispatches create (evidence: `src/pages/CreateParcel.jsx`)
- Parcel management → Parcel state: uses (evidence: `src/pages/ManageParcels.jsx`)
- KPI dashboard → Parcel state: uses (evidence: `src/pages/Dashboard.jsx`)
- KPI dashboard → Dashboard state: uses (evidence: `src/pages/Dashboard.jsx`)
- Staff login → Auth state: dispatches login
- Staff provisioning → Auth state: dispatches registration (evidence: `src/pages/AddAdmin.jsx`)
- Auth state → Express API: posts credentials (evidence: `src/features/auth/authSlice.js`)
- Parcel state → Express API: requests parcel actions
- Express API → Parcel routes: mounts route (evidence: `backend/server.js`)
- Express API → Auth routes: mounts route (evidence: `backend/server.js`)
- Express API → Dashboard routes: mounts route (evidence: `backend/server.js`)
- Express API → Analytics routes: mounts route (evidence: `backend/server.js`)
- Parcel routes → Parcel operations: dispatches handlers (evidence: `backend/routes/parcelRoutes.js`)
- Auth routes → Authentication: dispatches handlers (evidence: `backend/routes/authRoutes.js`)
- Dashboard routes → Dashboard metrics: dispatches handler (evidence: `backend/routes/dashboardRoutes.js`)
- Analytics routes → Analytics reporting: dispatches handlers (evidence: `backend/routes/analyticsRoutes.js`)
- Parcel routes → Access control: protects endpoints (evidence: `backend/routes/parcelRoutes.js`)
- Auth routes → Access control: protects endpoints (evidence: `backend/routes/authRoutes.js`)
- Parcel operations → Cost calculation: calculates price (evidence: `backend/controllers/parcelController.js`)
- Parcel operations → Tracking ID generation: generates ID (evidence: `backend/controllers/parcelController.js`)
- Parcel operations → Parcel records: reads and writes (evidence: `backend/controllers/parcelController.js`)
- Authentication → User records: uses user model (evidence: `backend/controllers/authController.js`)
- Access control → User records: looks up user (evidence: `backend/middlewares/authMiddleware.js`)
- Dashboard metrics → Analytics reporting: uses analytics service
- Express API → Database connection: connects at startup (evidence: `backend/server.js`)
- Database connection → MongoDB: connects when configured (evidence: `README.md`)
- Express API → Memory fallback: falls back to (evidence: `README.md`)
