# waseemnasir2k26/load-broker-portal architecture

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

- Interactive diagram: https://gitdiagram.com/waseemnasir2k26/load-broker-portal
- Repository: https://github.com/waseemnasir2k26/load-broker-portal

## Overview

FreightCommand is a React demo portal for freight brokers, shippers, carriers, dispatchers, and drivers. Users sign in under a role, then work through load posting and bidding, assignment and shipment updates, tracking, messaging, carrier scoring, and contract generation. AppContext holds shared demo operational state; AuthContext provides role and permission state. The README documents the main capabilities, while the source excerpts and index establish only selected routes and component relationships, so unsampled connections are omitted.

Main entry points: [`src/App.jsx`](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/App.jsx) (Route and access control), [`src/context/AppContext.jsx`](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/context/AppContext.jsx) (Operational state), [`src/components/loads/LoadDetail.jsx`](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/loads/LoadDetail.jsx) (Load detail and bids), [`src/components/tracking/TrackingSearch.jsx`](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingSearch.jsx) (Tracking search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_entry["App bootstrap<br/>[main.jsx]"]
  node_router["Route and access control<br/>[App.jsx]"]
  node_login["Role sign-in<br/>[LoginPage.jsx]"]
  node_auth["Role and permissions<br/>[AuthContext.jsx]"]
  node_accounts["Demo roles<br/>[demoAccounts.js]"]
  node_shell["Portal navigation<br/>[Layout.jsx]"]
  node_topbar["Role switcher<br/>[TopBar.jsx]"]
end

subgraph group_loads["Load operations"]
  node_state["Operational state<br/>[AppContext.jsx]"]
  node_loadboard["Load board"]
  node_loaddetail["Load detail and bids<br/>[LoadDetail.jsx]"]
  node_driver["Driver load updates"]
  node_history["Shipment history"]
end

subgraph group_tracking["Shipment tracking"]
  node_trackingpage["Tracking search<br/>[TrackingSearch.jsx]"]
  node_map["Live tracking map<br/>[TrackingMap.jsx]"]
  node_timeline["Tracking timeline"]
end

subgraph group_collaboration["Collaboration and contracts"]
  node_messages["Shipment messaging<br/>[MessageThread.jsx]"]
  node_contracts["Contract generation"]
end

subgraph group_insights["Dashboards and insights"]
  node_dashboard["Role dashboards<br/>[DashboardPage.jsx]"]
  node_scores["Carrier scores"]
  node_carrierprofile["Carrier performance profile<br/>[CarrierProfile.jsx]"]
  node_guide["Product guide<br/>[GuidePage.jsx]"]
  node_settings["User settings<br/>[SettingsPage.jsx]"]
  node_formatters["Formatting utilities<br/>[formatters.js]"]
  node_logger["Structured logging<br/>[logger.js]"]
  node_debug["Debug panel<br/>[DebugPanel.jsx]"]
end

node_user(("Portal user"))

node_user -->|"opens portal"| node_entry
node_entry -->|"renders"| node_router
node_entry -->|"provides auth"| node_auth
node_entry -->|"provides state"| node_state
node_router -->|"checks access"| node_auth
node_router -->|"routes to"| node_login
node_router -->|"routes to"| node_dashboard
node_router -->|"routes to"| node_loadboard
node_router -->|"routes to"| node_loaddetail
node_router -->|"routes to"| node_history
node_router -->|"routes to"| node_trackingpage
node_router -->|"wraps routes"| node_shell
node_router -->|"renders"| node_debug
node_auth -->|"reads role data"| node_accounts
node_topbar -->|"uses role state"| node_auth
node_loadboard -->|"uses operational state"| node_state
node_loaddetail -->|"reads and updates"| node_state
node_loaddetail -->|"renders thread"| node_messages
node_loaddetail -->|"renders map"| node_map
node_loaddetail -->|"renders timeline"| node_timeline
node_driver -->|"updates shipment"| node_state
node_history -->|"reads shipments"| node_state
node_trackingpage -->|"searches shipments"| node_state
node_trackingpage -->|"renders map"| node_map
node_trackingpage -->|"renders timeline"| node_timeline
node_messages -->|"uses message state"| node_state
node_dashboard -->|"reads operational state"| node_state
node_scores -->|"shows profile"| node_carrierprofile
node_carrierprofile -->|"formats values"| node_formatters
node_loaddetail -->|"formats values"| node_formatters
node_trackingpage -->|"formats values"| node_formatters
node_auth -->|"logs auth events"| node_logger
node_state -->|"logs state events"| node_logger
node_debug -->|"reads logs"| node_logger

click node_entry "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/main.jsx"
click node_router "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/App.jsx"
click node_login "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/LoginPage.jsx"
click node_auth "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/context/AuthContext.jsx"
click node_accounts "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/data/demoAccounts.js"
click node_shell "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/layout/Layout.jsx"
click node_topbar "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/layout/TopBar.jsx"
click node_state "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/context/AppContext.jsx"
click node_loadboard "https://github.com/waseemnasir2k26/load-broker-portal/tree/master/src/components/loads"
click node_loaddetail "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/loads/LoadDetail.jsx"
click node_driver "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/dashboard/DriverDashboard.jsx"
click node_history "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/ShipmentHistoryPage.jsx"
click node_trackingpage "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingSearch.jsx"
click node_map "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingMap.jsx"
click node_timeline "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingTimeline.jsx"
click node_messages "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/messages/MessageThread.jsx"
click node_contracts "https://github.com/waseemnasir2k26/load-broker-portal/tree/master/src/components/contracts"
click node_dashboard "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/DashboardPage.jsx"
click node_scores "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/CarrierScoresPage.jsx"
click node_carrierprofile "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/carriers/CarrierProfile.jsx"
click node_guide "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/GuidePage.jsx"
click node_settings "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/SettingsPage.jsx"
click node_formatters "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/utils/formatters.js"
click node_logger "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/utils/logger.js"
click node_debug "https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/debug/DebugPanel.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_router,node_login,node_auth,node_accounts,node_shell,node_topbar,node_user toneBlue
class node_state,node_loadboard,node_loaddetail,node_driver,node_history toneAmber
class node_trackingpage,node_map,node_timeline toneMint
class node_messages,node_contracts toneRose
class node_dashboard,node_scores,node_carrierprofile,node_guide,node_settings,node_formatters,node_logger,node_debug toneIndigo
```

## Components

### Access and shell

- [App bootstrap](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/main.jsx): `src/main.jsx`
- [Route and access control](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/App.jsx): `src/App.jsx`
- [Role sign-in](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/LoginPage.jsx): `src/pages/LoginPage.jsx`
- [Role and permissions](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Demo roles](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/data/demoAccounts.js): `src/data/demoAccounts.js`
- [Portal navigation](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/layout/Layout.jsx): `src/components/layout/Layout.jsx`
- [Role switcher](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/layout/TopBar.jsx): `src/components/layout/TopBar.jsx`

### Load operations

- [Operational state](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [Load board](https://github.com/waseemnasir2k26/load-broker-portal/tree/master/src/components/loads): `src/components/loads`
- [Load detail and bids](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/loads/LoadDetail.jsx): `src/components/loads/LoadDetail.jsx`
- [Driver load updates](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/dashboard/DriverDashboard.jsx): `src/components/dashboard/DriverDashboard.jsx`
- [Shipment history](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/ShipmentHistoryPage.jsx): `src/pages/ShipmentHistoryPage.jsx`

### Shipment tracking

- [Tracking search](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingSearch.jsx): `src/components/tracking/TrackingSearch.jsx`
- [Live tracking map](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingMap.jsx): `src/components/tracking/TrackingMap.jsx`
- [Tracking timeline](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/tracking/TrackingTimeline.jsx): `src/components/tracking/TrackingTimeline.jsx`

### Collaboration and contracts

- [Shipment messaging](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/messages/MessageThread.jsx): `src/components/messages/MessageThread.jsx`
- [Contract generation](https://github.com/waseemnasir2k26/load-broker-portal/tree/master/src/components/contracts): `src/components/contracts`

### Dashboards and insights

- [Role dashboards](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/DashboardPage.jsx): `src/pages/DashboardPage.jsx`
- [Carrier scores](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/CarrierScoresPage.jsx): `src/pages/CarrierScoresPage.jsx`
- [Carrier performance profile](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/carriers/CarrierProfile.jsx): `src/components/carriers/CarrierProfile.jsx`
- [Product guide](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/GuidePage.jsx): `src/pages/GuidePage.jsx`
- [User settings](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/pages/SettingsPage.jsx): `src/pages/SettingsPage.jsx`
- [Formatting utilities](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/utils/formatters.js): `src/utils/formatters.js`
- [Structured logging](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/utils/logger.js): `src/utils/logger.js`
- [Debug panel](https://github.com/waseemnasir2k26/load-broker-portal/blob/master/src/components/debug/DebugPanel.jsx): `src/components/debug/DebugPanel.jsx`

### Other components

- **Portal user**

## Connections

- Portal user → App bootstrap: opens portal (evidence: `src/main.jsx`)
- App bootstrap → Route and access control: renders (evidence: `src/main.jsx`)
- App bootstrap → Role and permissions: provides auth (evidence: `src/main.jsx`)
- App bootstrap → Operational state: provides state (evidence: `src/main.jsx`)
- Route and access control → Role and permissions: checks access (evidence: `src/App.jsx`)
- Route and access control → Role sign-in: routes to (evidence: `src/App.jsx`)
- Route and access control → Role dashboards: routes to (evidence: `src/App.jsx`)
- Route and access control → Load board: routes to (evidence: `src/App.jsx`)
- Route and access control → Load detail and bids: routes to (evidence: `src/App.jsx`)
- Route and access control → Shipment history: routes to (evidence: `src/App.jsx`)
- Route and access control → Tracking search: routes to (evidence: `src/App.jsx`)
- Route and access control → Portal navigation: wraps routes (evidence: `src/App.jsx`)
- Route and access control → Debug panel: renders (evidence: `src/App.jsx`)
- Role and permissions → Demo roles: reads role data (evidence: `src/context/AuthContext.jsx`)
- Role switcher → Role and permissions: uses role state (evidence: `src/components/layout/TopBar.jsx`)
- Load board → Operational state: uses operational state (evidence: `src/components/loads/LoadDetail.jsx`)
- Load detail and bids → Operational state: reads and updates (evidence: `src/components/loads/LoadDetail.jsx`)
- Load detail and bids → Shipment messaging: renders thread (evidence: `src/components/loads/LoadDetail.jsx`)
- Load detail and bids → Live tracking map: renders map (evidence: `src/components/loads/LoadDetail.jsx`)
- Load detail and bids → Tracking timeline: renders timeline (evidence: `src/components/loads/LoadDetail.jsx`)
- Driver load updates → Operational state: updates shipment (evidence: `src/components/dashboard/DriverDashboard.jsx`)
- Shipment history → Operational state: reads shipments (evidence: `src/pages/ShipmentHistoryPage.jsx`)
- Tracking search → Operational state: searches shipments (evidence: `src/components/tracking/TrackingSearch.jsx`)
- Tracking search → Live tracking map: renders map (evidence: `src/components/tracking/TrackingSearch.jsx`)
- Tracking search → Tracking timeline: renders timeline (evidence: `src/components/tracking/TrackingSearch.jsx`)
- Shipment messaging → Operational state: uses message state (evidence: `src/components/messages/MessageThread.jsx`)
- Role dashboards → Operational state: reads operational state (evidence: `src/pages/DashboardPage.jsx`)
- Carrier scores → Carrier performance profile: shows profile (evidence: `src/pages/CarrierScoresPage.jsx`)
- Carrier performance profile → Formatting utilities: formats values (evidence: `src/components/carriers/CarrierProfile.jsx`)
- Load detail and bids → Formatting utilities: formats values (evidence: `src/components/loads/LoadDetail.jsx`)
- Tracking search → Formatting utilities: formats values (evidence: `src/components/tracking/TrackingSearch.jsx`)
- Role and permissions → Structured logging: logs auth events (evidence: `src/context/AuthContext.jsx`)
- Operational state → Structured logging: logs state events (evidence: `src/context/AppContext.jsx`)
- Debug panel → Structured logging: reads logs (evidence: `src/components/debug/DebugPanel.jsx`)
