# alasaihi001/cargo-express architecture

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

- Interactive diagram: https://gitdiagram.com/alasaihi001/cargo-express
- Repository: https://github.com/alasaihi001/cargo-express

## Overview

Cargo Express is a logistics and shipment-management portal with separate client, agent, assistant, and administrator experiences. Users authenticate, then manage orders and shipments, documents and invoices, payments, notifications, or support claims through role-specific dashboards and API routes. The sampled routes show token-based authorization and Prisma-backed operations; the broader domain branches are supported by the file tree, but their specific runtime calls were not sampled. Dashed links mark those unverified connections.

Main entry points: [`app/api`](https://github.com/alasaihi001/cargo-express/tree/main/app/api) (Role-specific API routes), [`lib/prisma.ts`](https://github.com/alasaihi001/cargo-express/blob/main/lib/prisma.ts) (Prisma client), [`lib/jwt-utils.ts`](https://github.com/alasaihi001/cargo-express/blob/main/lib/jwt-utils.ts) (Token verification), [`app/api/reclamations/route.ts`](https://github.com/alasaihi001/cargo-express/blob/main/app/api/reclamations/route.ts) (Claims and support)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and access"]
  node_authui["Sign-in and registration<br/>[page.tsx]"]
  node_authcontext["Authentication context<br/>[auth-context.tsx]"]
  node_jwt["Token verification<br/>[jwt-utils.ts]"]
end

subgraph group_portals["Role-based portals"]
  node_clientportal["Client portal<br/>[page.tsx]"]
  node_agentportal["Agent dashboard<br/>[page.tsx]"]
  node_assistantportal["Assistant portal<br/>[page.tsx]"]
  node_adminportal["Admin portal<br/>[page.tsx]"]
end

subgraph group_logistics["Logistics and support"]
  node_orders["Orders and shipments<br/>[route.ts]"]
  node_documents["Documents and invoices<br/>[page.tsx]"]
  node_claims["Claims and support<br/>[route.ts]"]
  node_payments["Payments and billing<br/>[route.ts]"]
  node_notifications["Notifications<br/>[route.ts]"]
  node_reports["Reports and analytics<br/>[route.ts]"]
end

subgraph group_platform["API and persistence"]
  node_api["Role-specific API routes"]
  node_dbclient["Prisma client<br/>[prisma.ts]"]
  node_database[("Application database")]
  node_uikit["Shared interface components"]
end

node_client(("Client"))
node_staff(("Operations staff"))

node_client -->|"signs in"| node_authui
node_staff -.->|"signs in"| node_authui
node_authui -->|"uses"| node_authcontext
node_authcontext -.->|"establishes session"| node_jwt
node_client -.->|"uses"| node_clientportal
node_staff -.->|"uses"| node_agentportal
node_staff -.->|"uses"| node_assistantportal
node_staff -.->|"uses"| node_adminportal
node_clientportal -.->|"requests data"| node_api
node_agentportal -.->|"requests data"| node_api
node_assistantportal -.->|"requests data"| node_api
node_adminportal -.->|"requests data"| node_api
node_api -.->|"routes requests"| node_orders
node_api -.->|"routes requests"| node_documents
node_api -.->|"routes requests"| node_claims
node_api -.->|"routes requests"| node_payments
node_api -.->|"routes requests"| node_notifications
node_api -.->|"routes requests"| node_reports
node_orders -->|"verifies token"| node_jwt
node_orders -->|"reads and writes"| node_dbclient
node_claims -->|"verifies token"| node_jwt
node_claims -->|"reads and writes"| node_dbclient
node_claims -->|"creates alerts"| node_notifications
node_reports -->|"verifies token"| node_jwt
node_reports -->|"queries data"| node_dbclient
node_payments -->|"verifies token"| node_jwt
node_payments -->|"reads and writes"| node_dbclient
node_notifications -->|"verifies token"| node_jwt
node_notifications -->|"reads and writes"| node_dbclient
node_dbclient -.->|"queries"| node_database
node_authui -->|"renders controls"| node_uikit

click node_authui "https://github.com/alasaihi001/cargo-express/blob/main/app/auth/login/page.tsx"
click node_authcontext "https://github.com/alasaihi001/cargo-express/blob/main/contexts/auth-context.tsx"
click node_jwt "https://github.com/alasaihi001/cargo-express/blob/main/lib/jwt-utils.ts"
click node_clientportal "https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/client/page.tsx"
click node_agentportal "https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/agent/page.tsx"
click node_assistantportal "https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/assistant/page.tsx"
click node_adminportal "https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/admin/page.tsx"
click node_orders "https://github.com/alasaihi001/cargo-express/blob/main/app/api/commandes/route.ts"
click node_documents "https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/agent/documents/page.tsx"
click node_claims "https://github.com/alasaihi001/cargo-express/blob/main/app/api/reclamations/route.ts"
click node_payments "https://github.com/alasaihi001/cargo-express/blob/main/app/api/paiements/route.ts"
click node_notifications "https://github.com/alasaihi001/cargo-express/blob/main/app/api/notifications/route.ts"
click node_reports "https://github.com/alasaihi001/cargo-express/blob/main/app/api/admin/reports/route.ts"
click node_api "https://github.com/alasaihi001/cargo-express/tree/main/app/api"
click node_dbclient "https://github.com/alasaihi001/cargo-express/blob/main/lib/prisma.ts"
click node_uikit "https://github.com/alasaihi001/cargo-express/tree/main/components/ui"

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_authui,node_authcontext,node_jwt,node_client toneBlue
class node_clientportal,node_agentportal,node_assistantportal,node_adminportal toneAmber
class node_orders,node_documents,node_claims,node_payments,node_notifications,node_reports toneMint
class node_api,node_dbclient,node_database,node_uikit toneRose
class node_staff toneIndigo
```

## Components

### Identity and access

- [Sign-in and registration](https://github.com/alasaihi001/cargo-express/blob/main/app/auth/login/page.tsx): `app/auth/login/page.tsx`
- [Authentication context](https://github.com/alasaihi001/cargo-express/blob/main/contexts/auth-context.tsx): `contexts/auth-context.tsx`
- [Token verification](https://github.com/alasaihi001/cargo-express/blob/main/lib/jwt-utils.ts): `lib/jwt-utils.ts`

### Role-based portals

- [Client portal](https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/client/page.tsx): `app/dashboard/client/page.tsx`
- [Agent dashboard](https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/agent/page.tsx): `app/dashboard/agent/page.tsx`
- [Assistant portal](https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/assistant/page.tsx): `app/dashboard/assistant/page.tsx`
- [Admin portal](https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/admin/page.tsx): `app/dashboard/admin/page.tsx`

### Logistics and support

- [Orders and shipments](https://github.com/alasaihi001/cargo-express/blob/main/app/api/commandes/route.ts): `app/api/commandes/route.ts`
- [Documents and invoices](https://github.com/alasaihi001/cargo-express/blob/main/app/dashboard/agent/documents/page.tsx): `app/dashboard/agent/documents/page.tsx`
- [Claims and support](https://github.com/alasaihi001/cargo-express/blob/main/app/api/reclamations/route.ts): `app/api/reclamations/route.ts`
- [Payments and billing](https://github.com/alasaihi001/cargo-express/blob/main/app/api/paiements/route.ts): `app/api/paiements/route.ts`
- [Notifications](https://github.com/alasaihi001/cargo-express/blob/main/app/api/notifications/route.ts): `app/api/notifications/route.ts`
- [Reports and analytics](https://github.com/alasaihi001/cargo-express/blob/main/app/api/admin/reports/route.ts): `app/api/admin/reports/route.ts`

### API and persistence

- [Role-specific API routes](https://github.com/alasaihi001/cargo-express/tree/main/app/api): `app/api`
- [Prisma client](https://github.com/alasaihi001/cargo-express/blob/main/lib/prisma.ts): `lib/prisma.ts`
- **Application database**
- [Shared interface components](https://github.com/alasaihi001/cargo-express/tree/main/components/ui): `components/ui`

### Other components

- **Client**
- **Operations staff**

## Connections

- Client → Sign-in and registration: signs in
- Operations staff → Sign-in and registration: signs in
- Sign-in and registration → Authentication context: uses (evidence: `app/auth/login/page.tsx`)
- Authentication context → Token verification: establishes session
- Client → Client portal: uses
- Operations staff → Agent dashboard: uses
- Operations staff → Assistant portal: uses
- Operations staff → Admin portal: uses
- Client portal → Role-specific API routes: requests data
- Agent dashboard → Role-specific API routes: requests data
- Assistant portal → Role-specific API routes: requests data
- Admin portal → Role-specific API routes: requests data
- Role-specific API routes → Orders and shipments: routes requests
- Role-specific API routes → Documents and invoices: routes requests
- Role-specific API routes → Claims and support: routes requests
- Role-specific API routes → Payments and billing: routes requests
- Role-specific API routes → Notifications: routes requests
- Role-specific API routes → Reports and analytics: routes requests
- Orders and shipments → Token verification: verifies token (evidence: `app/api/commandes/route.ts`)
- Orders and shipments → Prisma client: reads and writes (evidence: `app/api/commandes/route.ts`)
- Claims and support → Token verification: verifies token (evidence: `app/api/reclamations/route.ts`)
- Claims and support → Prisma client: reads and writes (evidence: `app/api/reclamations/route.ts`)
- Claims and support → Notifications: creates alerts (evidence: `app/api/reclamations/route.ts`)
- Reports and analytics → Token verification: verifies token (evidence: `app/api/admin/reports/route.ts`)
- Reports and analytics → Prisma client: queries data (evidence: `app/api/admin/reports/route.ts`)
- Payments and billing → Token verification: verifies token (evidence: `app/api/paiements/route.ts`)
- Payments and billing → Prisma client: reads and writes (evidence: `app/api/paiements/route.ts`)
- Notifications → Token verification: verifies token (evidence: `app/api/notifications/route.ts`)
- Notifications → Prisma client: reads and writes (evidence: `app/api/notifications/route.ts`)
- Prisma client → Application database: queries
- Sign-in and registration → Shared interface components: renders controls (evidence: `app/auth/login/page.tsx`)
