# shanmukhapriyab/hydrogentrackernew architecture

> Architecture diagram of the GitHub repository shanmukhapriyab/hydrogentrackernew, 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/shanmukhapriyab/hydrogentrackernew
- Repository: https://github.com/shanmukhapriyab/hydrogentrackernew

## Overview

Hydrogen Tracker is a role-based application for tracking hydrogen production, storage, orders, shipments, and deliveries. Users sign in, enter a role-specific dashboard, and use operational pages that call the API; the backend persists records in MongoDB and exposes analytics, notifications, and live resource-change events. The graph preserves the major domain areas visible in the tree and index. Some page-to-API links are supported by the SOURCE INDEX rather than inspected source excerpts; unsampled behavior is not inferred beyond those references.

Main entry points: [`frontend/src/App.tsx`](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/App.tsx) (Page router), [`frontend/src/lib/api.ts`](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/lib/api.ts) (HTTP API client), [`backend/server.js`](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/server.js) (API and event server), [`frontend/src/components/Layout.tsx`](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/components/Layout.tsx) (Application layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User interface"]
  node_app["Page router<br/>[App.tsx]"]
  node_login["Sign-in<br/>[Login.tsx]"]
  node_layout["Application layout<br/>[Layout.tsx]"]
  node_producer["Producer dashboard"]
  node_productionui["Production management"]
  node_storageui["Storage management"]
  node_logisticsui["Logistics dashboard"]
  node_shipmentui["Shipment details"]
  node_deliveryui["Delivery management"]
  node_customerui["Customer dashboard"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_analyticsui["Reports analytics"]
  node_profileui["Profile settings"]
  node_notificationsui["Notifications<br/>[Notifications.tsx]"]
  node_api["HTTP API client<br/>[api.ts]"]
  node_realtime["Realtime client<br/>[realtime.ts]"]
end

subgraph group_backend["API services"]
  node_server["API and event server<br/>[server.js]"]
  node_productionroute["Production routes<br/>[production.js]"]
  node_storageroute["Storage routes<br/>[storage.js]"]
  node_shipmentroute["Shipment routes<br/>[shipments.js]"]
  node_analyticsroute["Analytics routes<br/>[analytics.js]"]
  node_resource["Shared resource routes<br/>[resource.js]"]
  node_usersroute["User routes<br/>[users.js]"]
end

subgraph group_domain["Hydrogen operations"]
  node_production[("Production records<br/>[Production.js]")]
  node_storage[("Storage records<br/>[Storage.js]")]
  node_shipment[("Shipment records<br/>[Shipment.js]")]
  node_order[("Order records<br/>[Order.js]")]
  node_delivery[("Delivery records<br/>[Delivery.js]")]
  node_notification[("Notification records<br/>[Notification.js]")]
end

subgraph group_platform["Identity and live data"]
  node_auth["Authentication middleware<br/>[auth.js]"]
  node_authroutes["Authentication routes<br/>[auth.js]"]
  node_userrecords[("User records<br/>[User.js]")]
  node_mongo[("MongoDB")]
end

node_user(("Role-based user"))

node_user -->|"signs in"| node_login
node_app -->|"renders"| node_login
node_app -->|"wraps pages"| node_layout
node_app -->|"routes role"| node_producer
node_app -->|"routes page"| node_productionui
node_app -->|"routes page"| node_storageui
node_app -->|"routes page"| node_logisticsui
node_app -->|"routes page"| node_shipmentui
node_app -->|"routes page"| node_deliveryui
node_app -->|"routes role"| node_customerui
node_app -->|"routes role"| node_adminui
node_app -->|"routes page"| node_analyticsui
node_app -->|"routes page"| node_profileui
node_app -->|"routes page"| node_notificationsui
node_user -->|"uses"| node_layout
node_layout -->|"requests data"| node_api
node_layout -->|"subscribes"| node_realtime
node_login -->|"authenticates"| node_api
node_producer -->|"requests data"| node_api
node_productionui -->|"requests data"| node_api
node_storageui -->|"manages tanks"| node_api
node_storageui -->|"subscribes"| node_realtime
node_logisticsui -->|"requests data"| node_api
node_shipmentui -->|"requests data"| node_api
node_deliveryui -->|"requests data"| node_api
node_customerui -->|"requests data"| node_api
node_adminui -->|"requests data"| node_api
node_analyticsui -->|"requests data"| node_api
node_profileui -.->|"requests data"| node_api
node_notificationsui -->|"requests data"| node_api
node_api -->|"sends HTTP"| node_server
node_realtime -->|"opens socket"| node_server
node_server -->|"mounts routes"| node_authroutes
node_server -->|"mounts routes"| node_productionroute
node_server -->|"mounts routes"| node_storageroute
node_server -->|"mounts routes"| node_shipmentroute
node_server -->|"mounts routes"| node_resource
node_server -->|"mounts routes"| node_usersroute
node_server -->|"mounts routes"| node_analyticsroute
node_server -->|"protects routes"| node_auth
node_authroutes -->|"reads users"| node_userrecords
node_usersroute -->|"uses users"| node_userrecords
node_productionroute -->|"accesses records"| node_production
node_storageroute -->|"reads writes"| node_storage
node_storageroute -->|"creates alerts"| node_notification
node_shipmentroute -->|"accesses records"| node_shipment
node_analyticsroute -->|"queries"| node_production
node_analyticsroute -->|"queries"| node_storage

click node_app "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/App.tsx"
click node_login "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/Login.tsx"
click node_layout "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/components/Layout.tsx"
click node_producer "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProducerDashboard.tsx"
click node_productionui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProductionManagement.tsx"
click node_storageui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/StorageManagement.tsx"
click node_logisticsui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/LogisticsDashboard.tsx"
click node_shipmentui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ShipmentDetails.tsx"
click node_deliveryui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/DeliveryManagement.tsx"
click node_customerui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/CustomerDashboard.tsx"
click node_adminui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/AdminDashboard.tsx"
click node_analyticsui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ReportsAnalytics.tsx"
click node_profileui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProfileSettings.tsx"
click node_notificationsui "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/Notifications.tsx"
click node_api "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/lib/api.ts"
click node_realtime "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/lib/realtime.ts"
click node_server "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/server.js"
click node_auth "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/middleware/auth.js"
click node_authroutes "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/auth.js"
click node_productionroute "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/production.js"
click node_storageroute "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/storage.js"
click node_shipmentroute "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/shipments.js"
click node_analyticsroute "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/analytics.js"
click node_resource "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/resource.js"
click node_usersroute "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/users.js"
click node_production "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Production.js"
click node_storage "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Storage.js"
click node_shipment "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Shipment.js"
click node_order "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Order.js"
click node_delivery "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Delivery.js"
click node_notification "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Notification.js"
click node_userrecords "https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/User.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_app,node_login,node_layout,node_producer,node_productionui,node_storageui,node_logisticsui,node_shipmentui,node_deliveryui,node_customerui,node_adminui,node_analyticsui,node_profileui,node_notificationsui,node_api,node_realtime,node_user toneBlue
class node_server,node_productionroute,node_storageroute,node_shipmentroute,node_analyticsroute,node_resource,node_usersroute toneAmber
class node_production,node_storage,node_shipment,node_order,node_delivery,node_notification toneMint
class node_auth,node_authroutes,node_userrecords,node_mongo toneRose
```

## Components

### User interface

- [Page router](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign-in](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Application layout](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/components/Layout.tsx): `frontend/src/components/Layout.tsx`
- [Producer dashboard](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProducerDashboard.tsx): `frontend/src/pages/ProducerDashboard.tsx`
- [Production management](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProductionManagement.tsx): `frontend/src/pages/ProductionManagement.tsx`
- [Storage management](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/StorageManagement.tsx): `frontend/src/pages/StorageManagement.tsx`
- [Logistics dashboard](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/LogisticsDashboard.tsx): `frontend/src/pages/LogisticsDashboard.tsx`
- [Shipment details](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ShipmentDetails.tsx): `frontend/src/pages/ShipmentDetails.tsx`
- [Delivery management](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/DeliveryManagement.tsx): `frontend/src/pages/DeliveryManagement.tsx`
- [Customer dashboard](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/CustomerDashboard.tsx): `frontend/src/pages/CustomerDashboard.tsx`
- [Admin dashboard](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/AdminDashboard.tsx): `frontend/src/pages/AdminDashboard.tsx`
- [Reports analytics](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ReportsAnalytics.tsx): `frontend/src/pages/ReportsAnalytics.tsx`
- [Profile settings](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/ProfileSettings.tsx): `frontend/src/pages/ProfileSettings.tsx`
- [Notifications](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/pages/Notifications.tsx): `frontend/src/pages/Notifications.tsx`
- [HTTP API client](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Realtime client](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/frontend/src/lib/realtime.ts): `frontend/src/lib/realtime.ts`

### API services

- [API and event server](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/server.js): `backend/server.js`
- [Production routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/production.js): `backend/routes/production.js`
- [Storage routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/storage.js): `backend/routes/storage.js`
- [Shipment routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/shipments.js): `backend/routes/shipments.js`
- [Analytics routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/analytics.js): `backend/routes/analytics.js`
- [Shared resource routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/resource.js): `backend/routes/resource.js`
- [User routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/users.js): `backend/routes/users.js`

### Hydrogen operations

- [Production records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Production.js): `backend/models/Production.js`
- [Storage records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Storage.js): `backend/models/Storage.js`
- [Shipment records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Shipment.js): `backend/models/Shipment.js`
- [Order records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Delivery records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Delivery.js): `backend/models/Delivery.js`
- [Notification records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/Notification.js): `backend/models/Notification.js`

### Identity and live data

- [Authentication middleware](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`
- [Authentication routes](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/routes/auth.js): `backend/routes/auth.js`
- [User records](https://github.com/shanmukhapriyab/hydrogentrackernew/blob/main/backend/models/User.js): `backend/models/User.js`
- **MongoDB**

### Other components

- **Role-based user**

## Connections

- Role-based user → Sign-in: signs in
- Page router → Sign-in: renders (evidence: `frontend/src/App.tsx`)
- Page router → Application layout: wraps pages (evidence: `frontend/src/App.tsx`)
- Page router → Producer dashboard: routes role (evidence: `frontend/src/App.tsx`)
- Page router → Production management: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Storage management: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Logistics dashboard: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Shipment details: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Delivery management: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Customer dashboard: routes role (evidence: `frontend/src/App.tsx`)
- Page router → Admin dashboard: routes role (evidence: `frontend/src/App.tsx`)
- Page router → Reports analytics: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Profile settings: routes page (evidence: `frontend/src/App.tsx`)
- Page router → Notifications: routes page (evidence: `frontend/src/App.tsx`)
- Role-based user → Application layout: uses (evidence: `frontend/src/components/Layout.tsx`)
- Application layout → HTTP API client: requests data (evidence: `frontend/src/components/Layout.tsx`)
- Application layout → Realtime client: subscribes (evidence: `frontend/src/components/Layout.tsx`)
- Sign-in → HTTP API client: authenticates (evidence: `frontend/src/pages/Login.tsx`)
- Producer dashboard → HTTP API client: requests data (evidence: `frontend/src/pages/ProducerDashboard.tsx`)
- Production management → HTTP API client: requests data (evidence: `frontend/src/pages/ProductionManagement.tsx`)
- Storage management → HTTP API client: manages tanks (evidence: `frontend/src/pages/StorageManagement.tsx`)
- Storage management → Realtime client: subscribes (evidence: `frontend/src/pages/StorageManagement.tsx`)
- Logistics dashboard → HTTP API client: requests data (evidence: `frontend/src/pages/LogisticsDashboard.tsx`)
- Shipment details → HTTP API client: requests data (evidence: `frontend/src/pages/ShipmentDetails.tsx`)
- Delivery management → HTTP API client: requests data (evidence: `frontend/src/pages/DeliveryManagement.tsx`)
- Customer dashboard → HTTP API client: requests data (evidence: `frontend/src/pages/CustomerDashboard.tsx`)
- Admin dashboard → HTTP API client: requests data (evidence: `frontend/src/pages/AdminDashboard.tsx`)
- Reports analytics → HTTP API client: requests data (evidence: `frontend/src/pages/ReportsAnalytics.tsx`)
- Profile settings → HTTP API client: requests data
- Notifications → HTTP API client: requests data (evidence: `frontend/src/pages/Notifications.tsx`)
- HTTP API client → API and event server: sends HTTP (evidence: `frontend/src/lib/api.ts`)
- Realtime client → API and event server: opens socket (evidence: `frontend/src/lib/realtime.ts`)
- API and event server → Authentication routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Production routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Storage routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Shipment routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Shared resource routes: mounts routes (evidence: `backend/server.js`)
- API and event server → User routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Analytics routes: mounts routes (evidence: `backend/server.js`)
- API and event server → Authentication middleware: protects routes (evidence: `backend/server.js`)
- Authentication routes → User records: reads users (evidence: `backend/routes/auth.js`)
- User routes → User records: uses users (evidence: `backend/routes/users.js`)
- Production routes → Production records: accesses records (evidence: `backend/routes/production.js`)
- Storage routes → Storage records: reads writes (evidence: `backend/routes/storage.js`)
- Storage routes → Notification records: creates alerts (evidence: `backend/routes/storage.js`)
- Shipment routes → Shipment records: accesses records (evidence: `backend/routes/shipments.js`)
- Analytics routes → Production records: queries (evidence: `backend/routes/analytics.js`)
- Analytics routes → Storage records: queries (evidence: `backend/routes/analytics.js`)
