# atharv290/greenxlogics architecture

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

- Interactive diagram: https://gitdiagram.com/atharv290/greenxlogics
- Repository: https://github.com/atharv290/greenxlogics

## Overview

GreenLogix connects shippers and transporters through role-based logistics management and AI-assisted freight matching. The principal workflow is creating a shipment or registering a truck, persisting it, requesting recommendations, and presenting match and fleet/shipment views; transporters can confirm assignments. The map also includes authentication and dashboard capabilities documented by the README. Relationships among sampled backend and matching modules are evidenced by excerpts; some frontend internals and integrations are unsampled, so their connections are intentionally limited.

Main entry points: [`Frontend/src/app/routes.tsx`](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/routes.tsx) (Role routes), [`Backend/src/app.js`](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/app.js) (Express application), [`Backend/src/services/aiTriggerService.js`](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/services/aiTriggerService.js) (Matching orchestration), [`Backend/src/config/db.js`](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/config/db.js) (PostgreSQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webapp["Web app<br/>[App.tsx]"]
  node_web_routes["Role routes<br/>[routes.tsx]"]
  node_auth_pages["Login and signup<br/>[LoginPage.tsx]"]
  node_shipper_dash["Shipper dashboard"]
  node_transporter_dash["Transporter dashboard"]
  node_shipments_view["Shipment views<br/>[AllShipments.tsx]"]
  node_fleet_view["Fleet views<br/>[AllFleets.tsx]"]
  node_matching_view["AI matching view<br/>[AIMatchingView.tsx]"]
  node_shipment_form["New shipment form"]
  node_truck_form["New truck form<br/>[NewTruckAdding.tsx]"]
  node_assignment_view["Truck assignments"]
end

subgraph group_api["Backend API"]
  node_api_app["Express application<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[auth.routes.js]"]
  node_auth_controller["Authentication<br/>[auth.controller.js]"]
  node_auth_middleware["Token authorization<br/>[auth.middleware.js]"]
  node_shipment_routes["Shipment routes"]
  node_shipment_controller["Shipment operations"]
  node_transporter_routes["Transporter routes"]
  node_truck_controller["Truck operations"]
end

subgraph group_data["Persistence"]
  node_user_model["User records<br/>[user.model.js]"]
  node_shipment_model["Shipment records<br/>[shipments.model.js]"]
  node_truck_model["Truck and assignments<br/>[truck.model.js]"]
  node_database[("PostgreSQL pool<br/>[db.js]")]
end

subgraph group_matching["AI matching"]
  node_matching_trigger["Matching orchestration"]
  node_ai_api["Matching endpoint<br/>[app.py]"]
  node_ai_engine["Recommendation engine<br/>[engin.py]"]
end

node_user(("Logistics user"))

node_user -->|"uses"| node_webapp
node_webapp -->|"provides routes"| node_web_routes
node_web_routes -->|"routes to"| node_auth_pages
node_web_routes -->|"routes to"| node_shipper_dash
node_web_routes -->|"routes to"| node_transporter_dash
node_web_routes -->|"routes to"| node_shipments_view
node_web_routes -->|"routes to"| node_fleet_view
node_web_routes -->|"routes to"| node_matching_view
node_shipper_dash -->|"renders"| node_shipment_form
node_transporter_dash -->|"renders"| node_truck_form
node_fleet_view -->|"renders"| node_assignment_view
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_shipment_routes
node_api_app -->|"mounts"| node_transporter_routes
node_api_app -->|"protects routes"| node_auth_middleware
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and creates"| node_user_model
node_shipment_routes -->|"dispatches"| node_shipment_controller
node_shipment_controller -->|"creates and reads"| node_shipment_model
node_shipment_controller -->|"triggers matching"| node_matching_trigger
node_transporter_routes -->|"dispatches"| node_truck_controller
node_truck_controller -->|"manages trucks"| node_truck_model
node_truck_controller -->|"triggers matching"| node_matching_trigger
node_user_model -->|"uses pool"| node_database
node_shipment_model -->|"uses pool"| node_database
node_truck_model -->|"uses pool"| node_database
node_matching_trigger -->|"queries and stores matches"| node_database
node_matching_trigger -->|"posts match inputs"| node_ai_api
node_ai_api -->|"runs matching"| node_ai_engine

click node_webapp "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/App.tsx"
click node_web_routes "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/routes.tsx"
click node_auth_pages "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/LoginPage.tsx"
click node_shipper_dash "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/ShipperDashboard.tsx"
click node_transporter_dash "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/TransporterDashboard.tsx"
click node_shipments_view "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AllShipments.tsx"
click node_fleet_view "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AllFleets.tsx"
click node_matching_view "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AIMatchingView.tsx"
click node_shipment_form "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/NewShipmentModal.tsx"
click node_truck_form "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/NewTruckAdding.tsx"
click node_assignment_view "https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/TruckShipmentsModal.tsx"
click node_api_app "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/app.js"
click node_auth_routes "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/auth.routes.js"
click node_auth_controller "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/auth.controller.js"
click node_auth_middleware "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/middleware/auth.middleware.js"
click node_shipment_routes "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/shipments.routes.js"
click node_shipment_controller "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/shipment.controller.js"
click node_transporter_routes "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/transporters.routes.js"
click node_truck_controller "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/addTruck.controller.js"
click node_user_model "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/user.model.js"
click node_shipment_model "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/shipments.model.js"
click node_truck_model "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/truck.model.js"
click node_database "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/config/db.js"
click node_matching_trigger "https://github.com/atharv290/greenxlogics/blob/main/Backend/src/services/aiTriggerService.js"
click node_ai_api "https://github.com/atharv290/greenxlogics/blob/main/AIServices/app.py"
click node_ai_engine "https://github.com/atharv290/greenxlogics/blob/main/AIServices/engin.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_web_routes,node_auth_pages,node_shipper_dash,node_transporter_dash,node_shipments_view,node_fleet_view,node_matching_view,node_shipment_form,node_truck_form,node_assignment_view,node_user toneBlue
class node_api_app,node_auth_routes,node_auth_controller,node_auth_middleware,node_shipment_routes,node_shipment_controller,node_transporter_routes,node_truck_controller toneAmber
class node_user_model,node_shipment_model,node_truck_model,node_database toneMint
class node_matching_trigger,node_ai_api,node_ai_engine toneRose
```

## Components

### Web application

- [Web app](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/App.tsx): `Frontend/src/app/App.tsx`
- [Role routes](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/routes.tsx): `Frontend/src/app/routes.tsx`
- [Login and signup](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/LoginPage.tsx): `Frontend/src/app/pages/LoginPage.tsx`
- [Shipper dashboard](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/ShipperDashboard.tsx): `Frontend/src/app/pages/ShipperDashboard.tsx`
- [Transporter dashboard](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/TransporterDashboard.tsx): `Frontend/src/app/pages/TransporterDashboard.tsx`
- [Shipment views](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AllShipments.tsx): `Frontend/src/app/pages/AllShipments.tsx`
- [Fleet views](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AllFleets.tsx): `Frontend/src/app/pages/AllFleets.tsx`
- [AI matching view](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/pages/AIMatchingView.tsx): `Frontend/src/app/pages/AIMatchingView.tsx`
- [New shipment form](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/NewShipmentModal.tsx): `Frontend/src/app/components/NewShipmentModal.tsx`
- [New truck form](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/NewTruckAdding.tsx): `Frontend/src/app/components/NewTruckAdding.tsx`
- [Truck assignments](https://github.com/atharv290/greenxlogics/blob/main/Frontend/src/app/components/TruckShipmentsModal.tsx): `Frontend/src/app/components/TruckShipmentsModal.tsx`

### Backend API

- [Express application](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/app.js): `Backend/src/app.js`
- [Authentication routes](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/auth.routes.js): `Backend/src/routes/auth.routes.js`
- [Authentication](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/auth.controller.js): `Backend/src/controllers/auth.controller.js`
- [Token authorization](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/middleware/auth.middleware.js): `Backend/src/middleware/auth.middleware.js`
- [Shipment routes](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/shipments.routes.js): `Backend/src/routes/shipments.routes.js`
- [Shipment operations](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/shipment.controller.js): `Backend/src/controllers/shipment.controller.js`
- [Transporter routes](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/routes/transporters.routes.js): `Backend/src/routes/transporters.routes.js`
- [Truck operations](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/controllers/addTruck.controller.js): `Backend/src/controllers/addTruck.controller.js`

### Persistence

- [User records](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/user.model.js): `Backend/src/models/user.model.js`
- [Shipment records](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/shipments.model.js): `Backend/src/models/shipments.model.js`
- [Truck and assignments](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/models/truck.model.js): `Backend/src/models/truck.model.js`
- [PostgreSQL pool](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/config/db.js): `Backend/src/config/db.js`

### AI matching

- [Matching orchestration](https://github.com/atharv290/greenxlogics/blob/main/Backend/src/services/aiTriggerService.js): `Backend/src/services/aiTriggerService.js`
- [Matching endpoint](https://github.com/atharv290/greenxlogics/blob/main/AIServices/app.py): `AIServices/app.py`
- [Recommendation engine](https://github.com/atharv290/greenxlogics/blob/main/AIServices/engin.py): `AIServices/engin.py`

### Other components

- **Logistics user**

## Connections

- Logistics user → Web app: uses (evidence: `README.md`)
- Web app → Role routes: provides routes (evidence: `Frontend/src/app/App.tsx`)
- Role routes → Login and signup: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Role routes → Shipper dashboard: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Role routes → Transporter dashboard: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Role routes → Shipment views: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Role routes → Fleet views: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Role routes → AI matching view: routes to (evidence: `Frontend/src/app/routes.tsx`)
- Shipper dashboard → New shipment form: renders (evidence: `Frontend/src/app/pages/ShipperDashboard.tsx`)
- Transporter dashboard → New truck form: renders (evidence: `Frontend/src/app/pages/TransporterDashboard.tsx`)
- Fleet views → Truck assignments: renders (evidence: `Frontend/src/app/pages/AllFleets.tsx`)
- Express application → Authentication routes: mounts (evidence: `Backend/src/app.js`)
- Express application → Shipment routes: mounts (evidence: `Backend/src/app.js`)
- Express application → Transporter routes: mounts (evidence: `Backend/src/app.js`)
- Express application → Token authorization: protects routes (evidence: `Backend/src/app.js`)
- Authentication routes → Authentication: dispatches (evidence: `Backend/src/routes/auth.routes.js`)
- Authentication → User records: reads and creates (evidence: `Backend/src/controllers/auth.controller.js`)
- Shipment routes → Shipment operations: dispatches (evidence: `Backend/src/routes/shipments.routes.js`)
- Shipment operations → Shipment records: creates and reads (evidence: `Backend/src/controllers/shipment.controller.js`)
- Shipment operations → Matching orchestration: triggers matching (evidence: `Backend/src/controllers/shipment.controller.js`)
- Transporter routes → Truck operations: dispatches (evidence: `Backend/src/routes/transporters.routes.js`)
- Truck operations → Truck and assignments: manages trucks (evidence: `Backend/src/controllers/addTruck.controller.js`)
- Truck operations → Matching orchestration: triggers matching (evidence: `Backend/src/controllers/addTruck.controller.js`)
- User records → PostgreSQL pool: uses pool (evidence: `Backend/src/models/user.model.js`)
- Shipment records → PostgreSQL pool: uses pool (evidence: `Backend/src/models/shipments.model.js`)
- Truck and assignments → PostgreSQL pool: uses pool (evidence: `Backend/src/models/truck.model.js`)
- Matching orchestration → PostgreSQL pool: queries and stores matches (evidence: `Backend/src/services/aiTriggerService.js`)
- Matching orchestration → Matching endpoint: posts match inputs (evidence: `Backend/src/services/aiTriggerService.js`)
- Matching endpoint → Recommendation engine: runs matching (evidence: `AIServices/app.py`)
