# aviratpatil/shipment-project architecture

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

- Interactive diagram: https://gitdiagram.com/aviratpatil/shipment-project
- Repository: https://github.com/aviratpatil/shipment-project

## Overview

ShipmentPro is a logistics platform whose main workflow is browser login followed by managing customers, shipments, and fleet operations through a role-aware REST API backed by PostgreSQL. The dashboard also exposes analytics, a driver portal, live shipment/truck notifications, and ShipBot. The README documents the analytics and AI services and their database role; their deeper runtime integration is not shown in the sampled source, so those links are documented rather than inferred from imports.

Main entry points: [`frontend/src/App.tsx`](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/App.tsx) (Dashboard app), [`frontend/src/api/client.ts`](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/api/client.ts) (API client), [`backend/src/server.ts`](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/server.ts) (Express API), [`backend/src/services/shipment.service.ts`](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/shipment.service.ts) (Shipment management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Dashboard app<br/>[App.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_login["Login view<br/>[LoginView.tsx]"]
  node_dashboard["Dashboard views<br/>[DashboardView.tsx]"]
  node_shipment_ui["Shipment views<br/>[ShipmentsView.tsx]"]
  node_customer_ui["Customer view<br/>[CustomersView.tsx]"]
  node_fleet_ui["Fleet and driver views<br/>[FleetView.tsx]"]
  node_manifest_ui["Manifest view<br/>[ManifestView.tsx]"]
  node_notifications["Live notifications"]
  node_analytics_ui["Analytics view<br/>[AnalyticsView.tsx]"]
  node_chat_ui["ShipBot interface<br/>[ChatBot.tsx]"]
end

subgraph group_api["Core API"]
  node_api_server["Express API<br/>[server.ts]"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_websocket["WebSocket server<br/>[websocket.ts]"]
  node_database[("PostgreSQL")]
end

subgraph group_operations["Logistics operations"]
  node_customers["Customer management"]
  node_shipments["Shipment management"]
  node_fleet["Fleet and drivers<br/>[truck.service.ts]"]
end

subgraph group_insights["Analytics and AI"]
  node_analytics_service["Analytics service<br/>[app.py]"]
  node_ai_service["AI assistant service<br/>[app.py]"]
  node_ingest["Knowledge ingestion<br/>[ingest.py]"]
end

node_operator(("User"))

node_operator -->|"uses"| node_webapp
node_webapp -->|"shows"| node_login
node_webapp -->|"routes views"| node_dashboard
node_webapp -->|"routes views"| node_shipment_ui
node_webapp -->|"routes views"| node_customer_ui
node_webapp -->|"routes views"| node_fleet_ui
node_webapp -->|"routes views"| node_manifest_ui
node_webapp -->|"renders"| node_notifications
node_webapp -->|"routes views"| node_analytics_ui
node_webapp -->|"renders"| node_chat_ui
node_login -->|"requests auth"| node_api_client
node_dashboard -.->|"requests data"| node_api_client
node_shipment_ui -->|"requests shipments"| node_api_client
node_customer_ui -->|"requests customers"| node_api_client
node_fleet_ui -->|"requests fleet"| node_api_client
node_manifest_ui -->|"requests manifest"| node_api_client
node_api_client -->|"sends REST"| node_api_server
node_api_server -->|"routes auth"| node_auth
node_api_server -->|"routes customers"| node_customers
node_api_server -->|"routes shipments"| node_shipments
node_api_server -->|"routes fleet"| node_fleet
node_auth -->|"reads and writes"| node_database
node_customers -->|"reads and writes"| node_database
node_shipments -->|"reads and writes"| node_database
node_fleet -->|"reads and writes"| node_database
node_api_server -->|"initializes"| node_websocket
node_shipments -->|"publishes updates"| node_websocket
node_notifications -.->|"receives events"| node_websocket
node_analytics_ui -.->|"requests reports"| node_analytics_service
node_chat_ui -.->|"requests assistance"| node_ai_service
node_analytics_service -.->|"queries shared data"| node_database
node_ai_service -.->|"uses vector store"| node_database
node_ingest -.->|"loads knowledge"| node_database

click node_webapp "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/api/client.ts"
click node_login "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/LoginView.tsx"
click node_dashboard "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/DashboardView.tsx"
click node_shipment_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ShipmentsView.tsx"
click node_customer_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/CustomersView.tsx"
click node_fleet_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/FleetView.tsx"
click node_manifest_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ManifestView.tsx"
click node_notifications "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/NotificationToast.tsx"
click node_analytics_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/AnalyticsView.tsx"
click node_chat_ui "https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ChatBot.tsx"
click node_api_server "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/server.ts"
click node_auth "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/auth.service.ts"
click node_customers "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/customer.service.ts"
click node_shipments "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/shipment.service.ts"
click node_fleet "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/truck.service.ts"
click node_websocket "https://github.com/aviratpatil/shipment-project/blob/main/backend/src/lib/websocket.ts"
click node_analytics_service "https://github.com/aviratpatil/shipment-project/blob/main/analytics-service/app.py"
click node_ai_service "https://github.com/aviratpatil/shipment-project/blob/main/ai-service/app.py"
click node_ingest "https://github.com/aviratpatil/shipment-project/blob/main/ai-service/ingest.py"

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_webapp,node_api_client,node_login,node_dashboard,node_shipment_ui,node_customer_ui,node_fleet_ui,node_manifest_ui,node_notifications,node_analytics_ui,node_chat_ui,node_operator toneBlue
class node_api_server,node_auth,node_websocket,node_database toneAmber
class node_customers,node_shipments,node_fleet toneMint
class node_analytics_service,node_ai_service,node_ingest toneRose
```

## Components

### Web application

- [Dashboard app](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Login view](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/LoginView.tsx): `frontend/src/components/LoginView.tsx`
- [Dashboard views](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/DashboardView.tsx): `frontend/src/components/DashboardView.tsx`
- [Shipment views](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ShipmentsView.tsx): `frontend/src/components/ShipmentsView.tsx`
- [Customer view](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/CustomersView.tsx): `frontend/src/components/CustomersView.tsx`
- [Fleet and driver views](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/FleetView.tsx): `frontend/src/components/FleetView.tsx`
- [Manifest view](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ManifestView.tsx): `frontend/src/components/ManifestView.tsx`
- [Live notifications](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/NotificationToast.tsx): `frontend/src/components/NotificationToast.tsx`
- [Analytics view](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/AnalyticsView.tsx): `frontend/src/components/AnalyticsView.tsx`
- [ShipBot interface](https://github.com/aviratpatil/shipment-project/blob/main/frontend/src/components/ChatBot.tsx): `frontend/src/components/ChatBot.tsx`

### Core API

- [Express API](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Authentication](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/auth.service.ts): `backend/src/services/auth.service.ts`
- [WebSocket server](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/lib/websocket.ts): `backend/src/lib/websocket.ts`
- **PostgreSQL**

### Logistics operations

- [Customer management](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/customer.service.ts): `backend/src/services/customer.service.ts`
- [Shipment management](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/shipment.service.ts): `backend/src/services/shipment.service.ts`
- [Fleet and drivers](https://github.com/aviratpatil/shipment-project/blob/main/backend/src/services/truck.service.ts): `backend/src/services/truck.service.ts`

### Analytics and AI

- [Analytics service](https://github.com/aviratpatil/shipment-project/blob/main/analytics-service/app.py): `analytics-service/app.py`
- [AI assistant service](https://github.com/aviratpatil/shipment-project/blob/main/ai-service/app.py): `ai-service/app.py`
- [Knowledge ingestion](https://github.com/aviratpatil/shipment-project/blob/main/ai-service/ingest.py): `ai-service/ingest.py`

### Other components

- **User**

## Connections

- User → Dashboard app: uses
- Dashboard app → Login view: shows (evidence: `frontend/src/App.tsx`)
- Dashboard app → Dashboard views: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → Shipment views: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → Customer view: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → Fleet and driver views: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → Manifest view: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → Live notifications: renders (evidence: `frontend/src/App.tsx`)
- Dashboard app → Analytics view: routes views (evidence: `frontend/src/App.tsx`)
- Dashboard app → ShipBot interface: renders (evidence: `frontend/src/App.tsx`)
- Login view → API client: requests auth
- Dashboard views → API client: requests data
- Shipment views → API client: requests shipments (evidence: `frontend/src/components/ShipmentsView.tsx`)
- Customer view → API client: requests customers (evidence: `frontend/src/components/CustomersView.tsx`)
- Fleet and driver views → API client: requests fleet (evidence: `frontend/src/components/FleetView.tsx`)
- Manifest view → API client: requests manifest (evidence: `frontend/src/components/ManifestView.tsx`)
- API client → Express API: sends REST (evidence: `frontend/src/api/client.ts`)
- Express API → Authentication: routes auth (evidence: `backend/src/server.ts`)
- Express API → Customer management: routes customers (evidence: `backend/src/server.ts`)
- Express API → Shipment management: routes shipments (evidence: `backend/src/server.ts`)
- Express API → Fleet and drivers: routes fleet (evidence: `backend/src/server.ts`)
- Authentication → PostgreSQL: reads and writes (evidence: `backend/src/services/auth.service.ts`)
- Customer management → PostgreSQL: reads and writes (evidence: `backend/src/services/customer.service.ts`)
- Shipment management → PostgreSQL: reads and writes (evidence: `backend/src/services/shipment.service.ts`)
- Fleet and drivers → PostgreSQL: reads and writes (evidence: `backend/src/services/truck.service.ts`)
- Express API → WebSocket server: initializes (evidence: `backend/src/server.ts`)
- Shipment management → WebSocket server: publishes updates (evidence: `backend/src/controllers/shipment.controller.ts`)
- Live notifications → WebSocket server: receives events
- Analytics view → Analytics service: requests reports
- ShipBot interface → AI assistant service: requests assistance
- Analytics service → PostgreSQL: queries shared data
- AI assistant service → PostgreSQL: uses vector store
- Knowledge ingestion → PostgreSQL: loads knowledge
